I was wondering about how one could change a remote host primary IP address without getting disconnected at all (without being in a "no IP addr" state).
The matter is poorly discussed on Internet (according to my research). The best resource I found is a little bit tricky.
EXAMPLE : change 10.0.0.11/24 to 10.0.0.15/24
1. ssh root@10.0.0.11
2. ip addr add 10.0.0.15/24 dev eth0
3. logout
4. ssh root@10.0.0.15
5. ip addr del 10.0.0.11/24 dev eth0
Problem: The last command removes both IP addresses and the connection is lost because 10.0.0.11 is primary, and it removes its secondary addresses (to which 10.0.0.15 belongs) when deleted.
I know I could "cheat" by adding 10.0.0.11/25 (instead of 24). However, I think it is theorically possible to do this properly.
What do you think?
