Reputation: 407
How to change the IP settings [mainly IP address, subnet mask and default gateway] in Linux using C/C++ ? I've seen examples that uses sockets but there are not much [besides they don't work]. I've tried this question but it does not work.
Whenever I try the code I use ifconfig to see my network configuration but they are still the same. I have openSUSE 13.2 and have both wireless and ethernet available connections.
I think another solution would be is to change the corresponding script file for the interface but I can't find these script files' locations.
Upvotes: 2
Views: 8388
Reputation: 16765
In most cases, such kind of operations requires root access. Run your application with root rights and it'll make it work.
Upvotes: 2