Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
4  
Why not have the services bind to 0.0.0.0 and become available on every address? –  Matthew Ife Mar 24 '13 at 11:57
1  
Why do you want to change the ip addresses? –  joeqwerty Mar 24 '13 at 14:00

1 Answer 1

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

 
discard

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.