dhcpd sending on the same IP it receives on

Phil Mayers p.mayers at imperial.ac.uk
Wed Dec 12 12:55:27 UTC 2007

Glenn Satchell wrote:
>> Date: Tue, 11 Dec 2007 12:04:29 -0800
>> From: Scott Baker <bakers at web-ster.com>
>> To: dhcp-users at isc.org
>> Subject: dhcpd sending on the same IP it receives on
>> My DHCP server has multiple ips on its primary NIC. For example:
>> eth0   =
>> eth0:0 =
>> I have my access equipment set to send DHCP relay to, but
>> when the DHCP server responds it sends the response packet out via
>> the address since that is the primary address on that NIC.
>> This causes my access equipment to drop the packet because the IP it
>> sent to, and got the response from do not match.
>> Is there way to tell the dhcpd daemon to send the packets outbound
>> using the same IP (interface) that it received the packet on?
>> The simple answer is to reverse the IPs so that is the
>> primary, but that's not really feasible since I have other services
>> that require that be the primary IP.
>> -- 
>> Scott Baker - Canby Telcom
>> RHCE - System Administrator - 503.266.8253
> Have a look at the server-identifier statement, and maybe the
> local-address statement. Between them they may do what you want.
> In general though, the source address on an IP packet is a function of
> the IP kernel driver and not the application. Virtual interfaces are
> not like separate physical interfaces, the packets always go in and out
> via eth0, it's just that it will accept packets with either IP
> address.

That's not entirely true. The source IP is a function of the socket 
bound IP. If this is INADDR_ANY, it'll default to an in-kernel decision. 
AFACIT dhcpd binds a single FD to INADDR_ANY.

I have tried to use dhcpd in various policy-routed ways in the past, and 
it is hard. It would be nice if dhcpd behaved in a similar manner to 
bind/named and ntpd, and bound a file descriptor to each IP 
(re-discovering the IPs every N minutes) and always replied via the same 
file descriptor the request came in on.

More information about the dhcp-users mailing list