Switch SMTP Servers

The University SMTP service is handled by the two hosts smtp1.qub.ac.uk and smtp2.qub.ac.uk. The service is normally handled by smtp1.qub.ac.uk and smtp2.qub.ac.uk is available as a backup. The active SMTP server is configured with the IP address for smtp.qub.ac.uk set as a secondary address. Switching the service requires the secondary IP address to be removed from the current active server and added to the network configuration on the current passive server. A small change also needs to made to the Exim configuration on each of the servers.

Exim Configuration

It is best to update the Exim configuration in advance of making changes to the network configuration. The SMTP transport section in the configuration file looks like this –

remote_smtp_52:
driver = smtp
port = 52
connect_timeout = 1m
interface = 143.117.16.195

Comment out the interface line on the active server and uncomment it on the target server. Make the changes active by restarting Exim on both servers after the network configurations (see below) have been updated. Make sure that eximon is running on both servers so you can check whether the SMTP traffic has successfully switched.

Network Configuration

Display the current IP address configuration on the active server –

# ip a show dev ens192 | grep inet

inet 143.117.16.80/24 brd 143.117.16.255 scope global noprefixroute ens192
inet 143.117.16.195/24 brd 143.117.16.255 scope global secondary noprefixroute ens192:1
inet6 fe80::250:56ff:fe8c:c405/64 scope link

The secondary address is highlighted. Remove the secondary address from the active server as follows –

# ip a del 143.117.16.195/24 dev ens192:1

Add the secondary address on the target server as follows –

# ip a add 143.117.16.195/24 dev ens192:1

Make these changes in quick succession on the active and target servers and then restart Exim on each using –

# systemctl restart exim

Monitor SMTP traffic on each server using eximon. It sometimes takes a couple of minutes for connecting hosts to pick up on the change depending on the refresh rate of their arp tables.