2

I am using CentOS.

I have a management server which has password-less ssh access to four other servers. I don't have physical access to these servers. In other words, I have to make all configurations over ssh.

I want to create a bash script on the management server to change the IP address for the other servers, but if I give a wrong IP (ex. the IP used in network), the management server will lose access to the other server.

What can I do to prevent or mitigate this problem?

3
  • Have you tried running the script with nohup? Commented May 9, 2014 at 13:27
  • 1
    Sounds like a perfect use case for dns, or a a systems management software like: puppet, ansible, chef or salt stack. Commented May 9, 2014 at 19:49
  • 1
    Good practice is to have at least 2 network interfaces on each server, one of which is on a dedicated management network. If you need to change IP addresses, change just one interface's address at a time, so that you never lose connectivity. Commented May 10, 2014 at 0:48

1 Answer 1

7

Assuming I'm reading correctly, your problem isn't that you want to know how to change the IP address, it's that you want to prevent changing it to something that stops future access.

This isn't necessarily a technical problem, it's a quality issue. However, you might try something like this (you'll need to work out how to achieve it in detail).

  • Write a script that you run on the remote host.
  • That script changes the IP address, and then pings the management_server.
  • If the ping works, the script exits.
  • If the ping fails, the script sets the IP address back to the original and then exits.

If you're actually asking 'I can't get to my server because it's got the wrong IP address, what can I do?' then that's significantly different, and you'll need to speak to whoever does have physical access so they can fix it.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.