1

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!

4

1 Answer 1

5

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?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.