'How to change ip for ubuntu host in java [duplicate]

There is an ubuntu host with multiple ips. I want to make periodical change its ips in my java application. But I do not know how to do this. Does any one know about this?



Solution 1:[1]

You could use your Java application to rewrite /etc/sysconfig/network-scripts/ifcfg-ethX (or wherever your network scripts are) and set the IP address you want. Then you would need to ask your Java application to run a bash script, reloading either the device or the whole network.

I could paste a couple of examples here but you will find loads on internet. :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Desorder