Saturday, April 19, 2003
Network anomalies solvedThe issues I was having with DHCP were getting to me.
I decided that since I was having problems with janet serving up DHCP for the wireless network, that I would have the WAP do that for me, since it had the functionality. Might as well use it.
Funny thing about the WAP though; being too friendly it's actually hostile to how I run the network here in the Facility in the Middle of Nowhere.
I enabled the DHCP server, and while I was able to have it assign my laptop an IP address, the WAP wasn't forwarding packets to janet so I couldn't see the Internet.
If I assigned a static IP address (and assigned the IP route) on the laptop, I could get out on the Internet.
It seems that the WAP wanted to route all the traffic out its WAN port, which in this case, is the port you would normally plug your DSL or cable modem into. But since I already have a machine acting as a firewall/NAT, this port on the WAP is empty.
Although if I change the configuration of the WAP from a “gateway” to a “router” the DHCP assigned IP address is routed correctly, but then the DHCP server on the WAP mysteriously stops working.
So … I can have the WAP serve up DHCP, but those addresses aren't routable, or I can have the addresses routable but can't assign them via DHCP. I just love how this stuff works so flawlessly.
So then I'm back to figuring out why DHCP on janet isn't working. Putting the DHCP server into debug mode, I see that it can see the request, but for some strange reason it can't send the response, saying that the network is unreachable. Which is odd, because the network is reachable.
DHCP works fine on linus, my development machine. And the only difference between the two is the number of NICs—one in linus, three in janet. Suspecting that there might be a problem with the Linux 2.0 networking stack, I disable the other two NICs in janet and suddenly, the DHCP server works! And with the WAP in “router” mode, janet sees the DHCP requests from the wireless side of the network.
Now, since I have RedHat 5.2 installed on these systems, and I still have the installation CDs, I pulls the source code (one of the wonders of open source) for the DHCP server and start poking around.
There are three big LINUX issues: the all-ones broadcast address, Linux 2.1
ip_bootp_agentenabling, and operations with more than one network interface.
In order for
dhcpdto work correctly with picky DHCP clients (e.g., Windows 95), it must be able to send packets with an IP destination address of 255.255.255.255. Unfortunately, Linux insists on changing 255.255.255.255 into the local subnet broadcast address (here, that's 188.8.131.52). This results in a DHCP protocol violation, and while many DHCP clients don't notice the problem, some (e.g., all Microsoft DHCP clients) do. Clients that have this problem will appear not to see
DHCPOFFERmessages from the server.
It is possible to work around this problem on some versions of Linux by creating a host route from your network interface address to 255.255.255.255. The command you need to use to do this on Linux varies from version to version. The easiest version is:
route add -host 255.255.255.255 dev eth0
Most older versions of the Linux kernel do not provide a networking API that allows
dhcpdto operate correctly if the system has more than one broadcast network interface. However, Linux 2.0 kernels with version numbers greater than or equal to 2.0.31 add an API feature: the
SO_BINDTODEVICEsocket option. If
SO_BINDTODEVICEis present, it is possible for dhcpd to operate on Linux with more than one network interface. In order to take advantage of this, you must be running a 2.0.31 or greater kernel, and you must have 2.0.31 system headers installed before you build
Fortunately, since RedHat 5.2 came bundled with Linux 2.0.36,
dhcpd was compiled to handle multiple interfaces. All I had to
do was add the appropriate route commands to have it work; I can now have
DHCP serve up
addresses for both the LAN and
Gregory (who came over tonight) also realized that his wireless card in his laptop just doesn't work with my WAP—he was able access the WAP using my wireless network card.
Gotta love i14y.