Linux:/sbin/dhclient to bind to a specific interface

dhclientdhcplinuxnetworking

I'm running RHEL5.5 and have several network interfaces (eth0, eth1, eth2) on the machine. I wish to make /sbin/dhclient bind its UDP port 68 on specific interfaces (eth0 and eth2) but when I do 'netstat -anp | grep 68' I see:

udp        0      0 0.0.0.0:68       0.0.0.0:*                 6109/dhclient

which interferes with another software daemon running its own DHCP client that wishes to run on a specific interface (eth1) not serviced by /sbin/dhclient

Can I get /sbin/dhclient to not bind to UDP port 0.0.0.0:68?

I have configured /etc/dhclient.conf to only service the interfaces I want (eth0 and eth2 in this case) but it still binds to 0.0.0.0:68 which prevents the custom DHCP client from running on eth1.

Any help appreciated, thanks.

Best Answer

DHCP by definition works by the client using the broadcast address to find all responding DHCP servers. It then chooses one of them (based on an algorithm, and AFAIK this is mostly to do with response times) and asks for an address. This address is then bound to the interface that is being configured.

Again, by definition, broadcasts are sent on all network interfaces. So, unless you are willing to write your own DHCP client (the sources are freely available), there is not much you can do about that.

However, you could use a different port. Read the man page for dhclient for details. This would then also require a DHCP server that listens on that port. The standard ISC DHCP server supports this with the -p option. Again, read the man page for dhcpd.

Related Topic