DHCP

From LQWiki
Jump to navigation Jump to search

DHCP (Dynamic Host Configuration Protocol) is a protocol which enables the dynamic assignment of IP addresses to network devices on a network. The dhcp client requests an IP address from the server, the dhcp server sends one and keeps track on which addresses have already been leased.

Getting a DHCP address

When computers get an IP address by DHCP, they run a daemon (Dhcpd) that keeps track of things.

Restarting DHCP

If your network interface goes down, you might need to restart the DHCP daemon.

Three daemons that do this are: dhclient, dhcpcd, and pump. Like so...

Fedora
  dhclient
Suse 9
  dhcpcd -i eth0

Distro Configuration

Debian
  dpkg --reconfigure etherconf
Slackware
  netconfig

TroubleShooting DHCP

Is there any dhcp traffic?

Maybe you have a device that is supposed to be plugged into your network and to acquire an IP address via dhcp. If this does not work, you may have to find out if the device sends a dhcp request at all. To find this out, you can use:

$ tcpdump -i eth1 port 67 and port 68
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes     
16:42:23.607779 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:1d:6e:9b:fd:17 (oui Unknown), length 548   

In this example you can tell the device actually sent a dhcp request. You should now examine if there were any dhcp replies.

See also