Etienne Perot
Etienne Perot

Reputation: 4882

Python interface to view/modify IP routing rules

I'm trying to find a Pythonic interface to what the ip route-style commands do on Linux, similar to how python-iptables is a nice Pythonic interface to iptables which directly calls the C library functions, rather than using subprocess to call and parse the output of running /usr/sbin/iptables. Does such a module exist?

If not, what would be the best way (preferably not involving subprocess-parsing) to do the following in Python:

Upvotes: 7

Views: 11061

Answers (1)

accdias
accdias

Reputation: 5372

Did you try pyroute2? Pyroute2 is a pure Python netlink and Linux network configuration library. It requires only Python standard modules and no other 3rd party libraries. Later it can change, but the dependency tree will remain as simple as possible.

Upvotes: 12

Related Questions