Skip to main content

Python Netlink library

Project description

Python netlink library. The main goal of the project is to implement complete NETLINK_ROUTE family as well as several other families (NETLINK_NETFILTER etc.)

Current feature status see in


More samples you can read in the project documentation. Low-level interface:

from pyroute2 import IPRoute

# get access to the netlink socket
ip = IPRoute()

# print interfaces
print ip.get_links()

# stop working with netlink and release all sockets

High-level transactional interface, IPDB:

from pyroute2 import IPDB
# local network settings
ip = IPDB()
# create bridge and add ports and addresses
# transaction will be started with `with` statement
# and will be committed at the end of the block
with ip.create(kind='bridge', ifname='rhev') as i:

The project contains several modules for different types of netlink messages, not only RTNL.


make install or pip install pyroute2


Python >= 2.6

  • test reqs (optional): python-coverage, python-nose
  • plugin reqs (optional): * ptrace: python-ptrace

Project details

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyroute2, version 0.1.12
Filename, size File type Python version Upload date Hashes
Filename, size pyroute2-0.1.12.tar.gz (51.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page