Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 $ip or $ifconfig 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?

share|improve this question
Why not have the services bind to and become available on every address? – Matthew Ife Mar 24 '13 at 11:57
Why do you want to change the ip addresses? – joeqwerty Mar 24 '13 at 14:00

I am not quite sure how you can change IP without modifying all ip bindings in the application configurations.

What about move to IPv6 and use lifetime in RA to perform graceful host ip change?

What's the purpose of changing IP addresses? I think it might be easier to deal with ip change from a higher level (load-balancer, firewall etc.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.