December 24, 2019

GUIDE: IP Hotswap without reboot using Linode

IP Hotswap with less than 2 second interruption using Linode.

Very useful should you need to replace a production server instantly.

Limitations: This needs to be within the same datacentre
Note: Have your firewall disabled on both servers prior

To start, we login to the Linode Manager.

Our Linodes

Firstly, click Production. Head over to Networking.
Take note of IPV4 Information as listed below:

Redacted information

Open a terminal it's good practice to use LISH or Console. The connection will drop due to the change in servers.

Gain root access (on both servers)

Remember: the details you enter on Production, are the details listed on Example.

Head over to Networking on Production and have the details ready.

Scroll down to IP Transfer. Click Save.

Redacted information

On Example - Run: ifconfig

[email protected]:~# ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet IPV4  netmask  broadcast BROADCAST
        inet6 REDACTED prefixlen 64  scopeid 0x20<link>
        inet6 REDACTED prefixlen 64  scopeid 0x0<global>
        ether REDACTED  txqueuelen 1000  (Ethernet)
        RX packets 40999  bytes 23149496 (23.1 MB)
        RX errors 0  dropped 1  overruns 0  frame 0
        TX packets 38364  bytes 5080534 (5.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

On Production - Execute IPSwap:

ip addr flush dev eth0
ip link set eth0 up
ip addr add IPV4_EXAMPLE/24 broadcast BROADCAST_FROM_EXAMPLE dev eth0
ip route add default via GATEWAY_FROM_MANAGER
Remove all IPv4 addresses, enable network interfaces.
Configure the new IP address and broadcast.
Route traffic through this IP address and gateway.

To run this as one command use the example below:

ip addr flush dev eth0 && ip link set eth0 up && ip addr add broadcast dev eth0 && ip route add default via
Remember to change IPs

Don't forget to reverse this command on Example (to be able access the old production server)

You will now be able to access your servers in reverse order.

Related articles
Download YouTube Videos and Playlists
Block Advertisements at DNS level

Guide | Insight | Life | Linux | Tor