DHCP Servers with Multiple NICs



DHCP Servers with Multiple NICs

When a DHCP configured PC boots, it requests its IP address from the DHCP server. It does this by sending a standardized DHCP broadcast request packet to the DHCP server with a source IP address of 255.255.255.255.

If your DHCP server has more than one interface, you have to add a route for this 255.255.255.255 address so that it knows the interface on which to send the reply; if not, it sends it to the default gateway. (In both of the next two examples, we assume that DHCP requests will be coming in on interface eth0.)

Note

More information on adding Linux routes and routing may be found in Chapter 3.


Note

You can't run your DHCP sever on multiple interfaces because you can have only one route to network 255.255.255.255. If you try to do it, you'll discover that DHCP server working on only one interface.


Temporary Solution

You can temporarily add a route to 255.255.255.255 using the route add command:

     [root@bigboy tmp]# route add -host 255.255.255.255 dev eth0

If you want this routing state to be maintained after a reboot, use the permanent solution that's discussed next.

Permanent Solution

The new Fedora Linux method of adding static routes doesn't seem to support sending traffic out an interface that's not destined for a specific gateway IP address. The DHCP packet destined for address 255.255.255.255 isn't intended to be relayed to a gateway, but it should be sent using the MAC address of the DHCP client in the Ethernet frame. To avoid this problem add the route add command to your /etc/rc.local script.