I need to provide a Python program allowing the user to change dynamically the network parameters of his device (IP, mask, DNS & Gateway). For example, changing his IP from 192.168.1.10/24 to 192.168.1.15/24. I don't want to run my program as root - but I can give to my user some specifics rights (for instance add the user to a group which can modify the /usr/network/interfaces file).
What I found is the pynetlinux library but it only provides IP and mask modifications and needs to be run as root (or maybe I missused it).
I could probably do it by parsing the interfaces file and running some bash/shell commands but I don't want to re-invent the wheel. I'm pretty sure some people already had my issue and did something great about it.
I'm running on Ubuntu 12.04. I would need my programm to work also on Ubuntu 14.04, CentOS and RedHat
ifconfigdoes?