DHCP eliminates the need for you to manually configure your system's TCP/IP information, and instead fetches that information from a central server. A program called dhclient allows FreeBSD to act as a DHCP client. When a system configured to use DHCP boots and dhclient starts, it sends out broadcast requests on UDP port 68, looking for any server on the LAN that will respond with DHCP information. Because these datagrams are sent to the broadcast address (255.255.255.255), it doesn't matter that the client machine doesn't have any TCP/IP information configured yet. If there is a DHCP server on the network, it listens on port 68 for these requests. When it receives a request for configuration information, it checks its database for a free IP address that can be assigned to the client. It then sends back (again to the broadcast address, because the client doesn't have an IP address yet) an "offer" containing the selected IP address. After some negotiation, all of which takes place on the broadcast address and thus is visible to all computers on the network, the DHCP server sends the client (on UDP port 67) all the TCP/IP configuration information that you would otherwise have had to set manually. The IP address that is assigned to the client is removed from the pool of available addresses so that it is not assigned to another client that requests DHCP configuration information. The host that is running dhclient applies the agreed-upon TCP/IP configuration, and from then on can use the routed IP network using the assigned IP address and other settings. IP Address LeasesWhen the DHCP server assigns an IP address to a client, the client does not "own" the address on any permanent basis. Rather, the address is leased, for a term that is configured on the DHCP server. The information about how long the lease is good for is sent to the client along with the configuration information. The leasing of IP addresses serves two purposes:
Advantages of DHCP over Static IP AddressesDepending on your situation, DHCP may have several advantages over simply assigning each system its own static IP addresses. These advantages include the following:
DHCP has become an integral part of any well-maintained corporate network and critical to the accepted best practices of network management. Even home network users will find DHCP to be indispensable, even if they don't know it existsit means they no longer have to worry about typing in esoteric TCP/IP information themselves, whether they're dialing up directly to an ISP or attaching themselves to a wireless home network. Indeed, DHCP has been one of the cornerstones of the proliferation of home broadband Internet in recent years, and without it millions of people would find the experience more technical than they were comfortable with. The only time when it is not appropriate to use DHCP is when you're running a server. Machines with assigned DNS names, and machines that provide services such as NFS shares and web and email, have to have static IP addresses so that client machines can reliably contact them. For this reason, a common corporate network topology is one where the internal network is based on DHCP, so that the hundreds or even thousands of employees, whose IP addresses aren't important, can all receive dynamic TCP/IP information within the corporate network; but the company's official web server is located on the DMZ network with a static IP address and a public DNS name so that it can be reached from anywhere on the planet at any time. Note The reason why many broadband service providers don't allow customers to run servers has not only to do with the limited upload speed of the cable or ADSL connection, but with the fact that assigning customers dynamic IP addresses through DHCP is far more economical than reserving static IP addresses for the thousands or tens of thousands of customers on the network. |