5.7 Using DHCP Clients


5.7 Using DHCP Clients

The Dynamic Host Configuration Protocol (DHCP) allows a host to get its IP address, subnet mask, default gateway, DNS servers, and other information from the network, so that you don't have to type these parameters by hand. Network administrators like DHCP because users don't have to nag them for IP addresses when they want to connect to the network.

Like ifconfig , DHCP works on a network interface name . All Linux distributions have a network interface setup option for DHCP, so if you don't feel like digging around to try to find out what file controls the interface settings, it's all right to let your distribution's setup program do the work.

When your machine asks a DHCP server for an IP address, it is really asking for a lease on an address for a certain amount of time. When the lease is up, your machine can ask to renew the lease.

Most distributions use the ISC (Internet Software Consortium) dhclient program to request and retrieve IP address information from a DHCP server. To get a lease, you can run dhclient by hand on the command line, but before doing so you must remove any default gateway route. Once you have done that, you can request an IP lease by running the following command:

 dhclient eth0 

dhclient stores its process ID in /var/run/dhclient.pid and its lease information in /var/state/dhclient.leases .

Red Hat Linux versions 7 and earlier use a program called pump instead of dhclient . You can run it with pump -i interface , but you may want to consider getting dhclient from ISC or as an RPM.




How Linux Works
How Linux Works: What Every Superuser Should Know
ISBN: 1593270356
EAN: 2147483647
Year: 2004
Pages: 189
Authors: Brian Ward

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net