I'm creating a network testing tool (educational project) at work which is to be used by non technical staff. I have created a simple GUI with buttons for preconfigured IP addresses, of which I can manipulate the static IP address and the subnet mask of the Pi.
The only problem is that I can't find a way to change the default gateway in the same command (or at all using Python).
I'm currently using:
def setIP_XXX(): os.system('sudo ifconfig eth0 down') os.system('sudo ifconfig eth0 192.xxx.xxx.xx/24') os.system('sudo ifconfig eth0 up')
Any help in this area would be great as it's starting to become a very stressful experience.