Do you need to reboot CentOS7 after IP Transfer (ip swap).
FYI, running CentOS7.
After performing an IP Swap neither networks are responsive (SSH and HTTPD). I then use the 'Launch Console' to perform a reboot on both one after the other and the IP swap is successful after reboot.
Is it possible to IP Swap without rebooting? I'm practicing this for minimal downtime < 1min. or so.
BTW. 'Network Helper' is enabled.
Thanks for any help!
7 Replies
Yes, you can swap IP addresses without rebooting. However, you'll need to configure networking manually for both Linodes to do so.
You can set up the network configuration on both Linodes to have both of the IP addresses. That way when you swap the IP addresses over it'll be ready to go right away. However, that means you won't be able to use Network Helper any longer as it'll overwrite the custom configuration. I'd recommend turning it off in your Linode's configuration profile if you go that route.
@mjones Thanks for the response.
I've tried testing this on CentOS 8, and I have not been able to make it work. Can you go into detail with how exactly we should manually configure the network?
I believe the Network Helper only overwrites the network settings on restart? In this case, I believe it should be possible to only temporarily assign both IP addresses during the IP swap. If the machine later reboots, it would be okay if the Network Helper overwrites the network configuration with only a single IP, because it would be the new IP. Am I missing something here?
Specifically, I'd like to ip addr add new_ip/24 dev eth0 && systemctl restart NetworkManager
, perhaps with some updated routing config (I think this is where my issue is, I'm not sure how I should be configuring routing since the default route will be via the old IP).
Hi @joshmcguigan ! I'd be happy to clarify. You're right in that Network Helper only updates the network configuration on boot, so it would be fine to add a new IP address into the configuration temporarily. If you do and leave Network Helper enabled, then your Linode will be updated with a new configuration for just the IP addresses it still has assigned to it on boot.
From what I understand CentOS 8 uses nmcli to add new IP addresses from the command line. You could use a command like so, where "10.10.10.10" is the IP address you want to add:
nmcli con mod eth0 +ipv4.addresses "10.10.10.10/24"
You may need to set the configuration to "Manual" if it's not already:
nmcli con mod eth0 ipv4.method manual
Then, restart the interface:
nmcli con up eth0
I tested it out on a fresh CentOS 8 Linode and it works as expected.
Thanks for the quick response @mjones. I'm not sure why, but by default SELinux was blocking nmcli
from updating my network settings. But I was able to solve that temporarily with setenforce 0
.
In any case I believe nmcli
is just a wrapper around manually editing /etc/sysconfig/network-scripts/ifcfg-eth0
, which is what I was doing before.
I believe the issue is that I am trying to swap public IPs and these steps don't include setting a gateway address, so there is no routing configured for the machine to know that the internet is reachable through the new IP.
I tested it out on a fresh CentOS 8 Linode and it works as expected.
Can you share exactly how you tested this? I've tried creating two new Linodes, ssh
ing into one of them to setup the other IP as described above, then swapping IPs from the Linode console. After the IP swap neither machine is accessible until I swap the IPs back.
I was able to make this work by replacing the existing IP/gateway with the desired IP/gateway, then running systemctl restart NetworkManager && nmcli con down eth0; nmcli con up eth0
, then doing an IP swap from the Linode console.
The downside is there was a period of ~5 minutes where I couldn't connect to either machine (using either IP). I think there may be some ARP table cache somewhere in the Linode network which needs to expire? This forum post suggests using a gratuitous ARP, but I haven't tried that yet.
I did some testing with gratuitous ARP and it seems to help, but I'm still not able to get consistently fast IP swaps. I am going to explore alternate options.
Thanks for the help.