Python Netlink library
Project description
pyroute2
========
Python network configuration library
PyRoute2 uses Netlink protocol to communicate with the Linux kernel
and get all the information about network objects -- interfaces, routes,
addresses, ARP cache entries and so on. Some of network objects can be
also modified.
TODO
====
* VLAN linkinfo data
* bridge info: see `./net/bridge/br_netlink.c:br_fill_ifinfo()`
Example usage
=============
from pyroute2 import iproute
ip = iproute()
# lookup interface by name
dev = ip.link_lookup(ifname='eth0')[0]
# bring it down
ip.link('set', dev, state='down')
# change interface MAC address and rename it
ip.link('set', dev, address='00:11:22:33:44:55', ifname='bala')
# add primary IP address
ip.addr('add', dev, address='10.0.0.1', mask=24)
# add secondary IP address
ip.addr('add', dev, address='10.0.0.2', mask=24)
# bring it up
ip.link('set', dev, state='up')
Installation
============
make install
Requires
========
Python >= 2.6
Links
=====
* home: https://github.com/svinota/pyroute2
* bugs: https://github.com/svinota/pyroute2/issues
========
Python network configuration library
PyRoute2 uses Netlink protocol to communicate with the Linux kernel
and get all the information about network objects -- interfaces, routes,
addresses, ARP cache entries and so on. Some of network objects can be
also modified.
TODO
====
* VLAN linkinfo data
* bridge info: see `./net/bridge/br_netlink.c:br_fill_ifinfo()`
Example usage
=============
from pyroute2 import iproute
ip = iproute()
# lookup interface by name
dev = ip.link_lookup(ifname='eth0')[0]
# bring it down
ip.link('set', dev, state='down')
# change interface MAC address and rename it
ip.link('set', dev, address='00:11:22:33:44:55', ifname='bala')
# add primary IP address
ip.addr('add', dev, address='10.0.0.1', mask=24)
# add secondary IP address
ip.addr('add', dev, address='10.0.0.2', mask=24)
# bring it up
ip.link('set', dev, state='up')
Installation
============
make install
Requires
========
Python >= 2.6
Links
=====
* home: https://github.com/svinota/pyroute2
* bugs: https://github.com/svinota/pyroute2/issues
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.
Source Distribution
pyroute2-0.1.1.tar.gz
(23.9 kB
view details)
File details
Details for the file pyroute2-0.1.1.tar.gz
.
File metadata
- Download URL: pyroute2-0.1.1.tar.gz
- Upload date:
- Size: 23.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
4d029c41831a3511e3b2124eeb3bec2e27b50cbb29143ba896b5ea3a0d28e6fa
|
|
MD5 |
706911e49cafa97a2e5477808f05960f
|
|
BLAKE2b-256 |
5d48f92c39287d40b794bd0ac6ca8dca16c01e494b6138c7a139a50b6082b66e
|