I have a pool of public IP addresses. There are some services in my box which binds to these. What i'm trying to achieve is to automate the IP change process.
Best way to do this is to write a script which will do the following:
0) Kill the services which are bound the current IPs 1) Read the current IP address of an interface.
2) Pick a IP from the pool statically given in the script with the restriction that it won't pick the IP which is currently in use.
3) Change the IP using
4) Restart the Services
I do this manually like below:
ifconfig eth0:0 "existing ip" netmask "address" broadcast "address" down ifconfig eth0:0 "new ip" netmask "address" broadcast "address" up pkill service1 ./service -l "new ip address"
How should i do this?