We use a Netopia R9100 ethernet-to-ethernet router between our inside network and the outside world, and it has provisions for only one default gateway: it's the blue line in the diagram:
On the rare occasions when the primary DSL circuit goes down, we manually login to the router to change the external IP address, netmask, and default gateway to use the backup circuit (shown in red).![]()
This manual change - which takes just a few seconds - brings the inside network fully back up (albeit slower) for browsing or any other outbound activities, but for inbound traffic we come to a complete halt. This is a problem mainly for email, so we found a strategy that allows us to use a VPN to a remote site to provide immediate mail service.
All of our outbound VPNs have NAT -- Network Address Translation -- applied to the tunnels, which means that we can get to the customer network, but they can't get back to us. Otherwise one customer could get to not only our network, but to other, unrelated, customers. This seems like a bad idea.
We use the Netopia "Server List" facility to create a "pinhole" that opens a port on the tunnel: any inbound traffic to the designated port is routed to a particular server inside our network. We do this for SSH and SMTP, and it's the latter that allows for VPN-based backup MX.
Fortunately, we use the excellent Postfix mail server, which makes this problem easy to fix.
The first step is to add our domain name ("unixwiz.net") to the "relays" file, which tells postfix that it's allowed to relay mail for that domain: all others are refused. This restriction is designed to prevent mailserver hijack by spammers.
The next step is specific to the VPN tunnel: we add an entry to the "transport" file that directs where mail for the domain should be routed. This overrides any data obtained from DNS and lets us send mail through the tunnel:
Here, 192.168.7.254 is the IP address of the VPN tunnel as seen from the remote customer, and :25 is the TCP port number for the SMTP protocol./etc/postfix/relays unixwiz.net OK /etc/postfix/transport unixwiz.net smtp:[192.168.7.254]:25
Once the associated DB files are rebuilt (see this Tech Tip for information on using "make" to automate this), inbound email for unixwiz.net is routed to our mailserver via the VPN tunnel.
In the event of a primary DSL circuit failure, we manually update the router with the backup IP parameters, and the router automatically re-establishes the connection with the remote customer(s). From the customer network's point of view, all that's happened is that the tunnel was down for a short time.
When the main DSL circuit comes back, we revert the router to the original configuration and the tunnel rebuilds itself again.
Navigate: More Tech Tips