I want to change ip address of the wifi interface using python. How can I do it? You don't have to tell me the code. Just point me out. I'll hunt down. Thanks!
1 Answer
The easiest way would be to execute ifconfig from python and pass it the interface options like the ip and broadcast addresses and so on, for example:
from subprocess import call
call(["ifconfig", "eth0", "192.168.1.5", "netmask", "255.255.255.0", "broadcast", "192.168.2.255"])
Edit: There's also a python package that parses config files, you could use that to set the interface options, check this question Is there any python package that could configure IP address of network interface?
nmcli(command-line interface for NetworkManager). For older version there is cnetworkmanager that is implemented in Python and uses D-Bus to talk to NetworkManeger).