OS: Debian Wheezy

DHCP Server: isc-dhcp-server 4.2.2

I need dhcpd to listen to the specific interface on a machine with 2 active NICs. I added INTERFACES="eth5" to /etc/default/isc-dhcp-server but dhcpd still listens to all interfaces:

root@server:~# netstat -46lpn | grep dhcp
udp        0      0    *                           3229/dhcpd
udp        0      0  *                           3229/dhcpd
udp6       0      0 :::56980                :::*                                3229/dhcpd
raw        0      0     *               7           3229/dhcpd

The ISC DHCP server will only work when it binds to the all zeros address. Keep in mind that the DHCP server must communicate with clients that have no IP address, so binding to the IP associated with a specific interface doesn't make a lot of sense.

man dhcpd.conf

The local-address statement local-address address; This statement causes the DHCP server to listen for DHCP requests sent to the specified address, rather than requests sent to all addresses. Since serving directly attached DHCP clients implies that the server must respond to requests sent to the all-ones IP address, this option cannot be used if clients are on directly attached networks...it is only realistically useful for a server whose only clients are reached via unicasts, such as via DHCP relay agents.

Note: This statement is only effective if the server was compiled using the USE_SOCKETS #define statement, which is default on a small number of operating systems, and must be explicitly chosen at compile-time for all others. You can be sure if your server is compiled with USE_SOCKETS if you see lines of this format at startup:

  • This seems weird, why it needs all interfaces to work? What if the server has management interfaces that DHCP-server shouldn't serve? I also examined traffic with tcpdump, DHCP-server indeed listens to all interfaces but answers only on those passed as arguments to the dhcpd daemon. – Vladimir M. Nov 7 '16 at 7:07
  • @VladimirM. I don't disagree, the ISC DHCP is a bit weird about how it binds. DNSMasq seems able to bind the DHCP to a specific interface. – Zoredache Nov 7 '16 at 18:07

Your Answer

