0

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?

2
  • 4
    Why not have the services bind to 0.0.0.0 and become available on every address? Mar 24, 2013 at 11:57
  • 1
    Why do you want to change the ip addresses?
    – joeqwerty
    Mar 24, 2013 at 14:00

1 Answer 1

0

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.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .