简体   繁体   中英

Is there a python module for managing interfaces on Ubuntu?

I did a bit of searching and I couldn't find anything that fit my needs. I am preferably looking for a python module which can:

  • Change the mac of my interface
  • Change the IP of my interface
  • Add an IP to the interface
  • Change the IP of the interface (static)

Does anybody know if there is something that exists for this? I am on Ubuntu.

python-netifaces can dump information about interfaces on linux, OSX and a few other platforms.

pynetlinux appears to provide some nice linux bindings around the relevant ioctls to change current run time state, but hasn't seen any real activity in over 6 months.

But, there doesn't appear any obvious projects which support a nice clean pythonic interface for manipulating /etc/network/... on Debian based distributions which presumably would be what you'd want/need to do to get decent persistent configuration changes.

Why is there any need for a Python module??? All can be done from the command line!

Eg take a look at: https://help.ubuntu.com/10.04/serverguide/network-configuration.html

Get the commands needed and execute them from Python.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM