Re: Web mirroring and ifconfig

webmasters@cs.niu.edu
Tue, 3 Feb 1998 17:27:29 -0600

In <199802032119.AA14813@corn.cso.niu.edu> sfahey@niu.edu writes:

>I'd like to be able to have a MIRROR machine pick up web traffic
>in the event that the MAIN server is down. I've written a program
>which runs on MIRROR and tests the functionality of MAIN. The
>program checks the following: ping MAIN, connect to MAIN:80,
>send a HEAD request to MAIN:80, receive HEAD response from MAIN:80.

>If connect, send, or receive fails then email is sent to webmaster.
>If ping fails then I'd like to have MIRROR accept MAIN's traffic.
>I think I can do this by running ifconfig with the alias parameter
>so that MIRROR receives MAIN's ip traffic. The ifconfig statement
>looks like this:

>ifconfig lan0 "ip.address.for.main" netmask 255.255.255.0 alias

>After this is run MIRROR's interface (lan0) will answer to both
>MIRROR and MAIN's ip address.

This will not work very will, as you have apparently discovered.

The problem is that packets get to your machine by the base network
address (probably an ethernet address). When something is sent to
your IP address, the sending host or router must map that to an
ethernet address using its arp table. Thus it will not send to the
new machine until the entry in its arp table has timed out. But, if
that entry is getting constant traffic, it may not time out. You
might be able to force an arp table update by sending the router a
packet from the aliased address. But I suspect that your aliased
address is receive-only, and you cannot send packets with it.

A better plan would be to use a phony hostname for your web server.
Let me illustrate with our cs department server. We currently are
using the hostname 'WWW.CS.NIU.EDU' for our web server. At present,
that address is defined in DNS to be an alias for MP.CS.NIU.EDU. As
an alternative, I could give WWW.CS.NIU.EDU its own IP address. In
fact, I could give it two addresses. Suppose that I gave it the two
address 131.156.1.2 (really the address of MP.CS.NIU.EDU) and
131.156.68.2 (really the address of UX.CS.NIU.EDU). Note that it is
allowable to give the same address to two hostnames. The result
would be that anyone wanting to make a connection to WWW.CS.NIU.EDU
would receive two addresses from the nameservers, and would try to
connect to one, then if that failed it would try to connect to the
other. When both machines are running, MP.CS.NIU.EDU would pick up
about half the web traffic, and UX.CS.NIU.EDU would pick up the other
half. When one machine is down, the other would get all of the
traffic, although half the connection attempts would first time out
on the machine that was down.