Documente Academic
Documente Profesional
Documente Cultură
Objectives
After completing this unit, students should be able to: Describe the purpose and operation of DHCP Configure DHCP clients Configure DHCP servers
Host Configuration
Static IP configuration stored on local storage medium (disk, EEPROM, ...) Requires one IP address for every machine Requires local configuration on each system Typically used for servers Dynamic IP configuration assigned by server Requires one IP address for every active machine only Does not require any local configuration Typically used for clients
Leasing an IP Address
In DHCP negotiation, the client agrees on a lease time with the server Before the lease time is over, the client has to: Abandon the lease Renew the lease All lease times are expressed as offset from now in seconds Prevents against problems when clocks are out of sync
DHCP Relay
DHCP Server
4. DHCPACK
DHCP Server
DHCP Renewal
T1(0.5* duration of lease) Client
Renewing State DHCPREQUEST (unicast) DHCPACK
Server
[commits configuration] or [ignores request]
T2
(0.875* duration of lease) Lease Expires
[Rebinding State] DHCPREQUEST (broadcast) [Init State] DHCPDISCOVER Graceful shutdown DHCPRELEASE Discards lease [commits configuration] or [ignores request]
DHCP Considerations
Every dynamic IP address needs a DNS entry Regular and reverse lookups! The get-lease-hostnames statement retrieves the hostname for each dynamic IP address and sends that to the client as hostname option Multiple DHCP servers: Make sure each DHCP server has its own range Make sure all static declarations are defined on each server Failover is supported, but no standards formally exist so no interoperability with other DHCP servers. See man dhcpd.conf for more information
Dynamic DNS
DDNS: Method where the DHCP server automatically registers hostname/IP address combinations with the DNS server using the client's "host-name" DHCP option Currently no formal RFC available - interim standard used by ISC DHCP server and ISC DNS server
# vi /etc/dhcpd.conf ddns-update-style interim; key DHCP_UPDATER { algorithm hmac-md5; secret "pRP5FapFoJ95JEL06sv4PQ=="; }; zone example-company.com. { primary 10.1.1.3; key DHCP_UPDATER; } zone 1.1.10.in-addr.arpa. { primary 10.1.1.3; key DHCP_UPDATER; } # vi /etc/named.conf key DHCP_UPDATER { algorithm hmac-md5; secret "pRP5FapFoJ95JEL06sv4PQ=="; }; zone example-company.com. { type master; file "named.example-company.com"; allow-update{ DHCP_UPDATER; }; } zone 1.1.10.in-addr.arpa. { type master; file "named.10.1.1"; allow-update{ DHCP_UPDATER; }; }
Troubleshooting DHCP
If server won't start at all: Check syntax of /etc/dhcpd.conf Check existence of state file Check server log file (/var/log/messages) Check server leases file (/var/lib/dhcp/dhcpd.leases) Check client IP address assignment Win9x: winipcfg WinNT/2000: ipconfig Linux: pump -s, dhcpcd -s, ifconfig Verify time on systems is synchronized Check DHCP packet exchange with a sniffer tcpdump ethereal
Checkpoint
1. In what situations can you use DHCP? (Choose all that apply.)
a. To configure laptops automatically, regardless of the network the users connect their laptop to. b. To configure classroom PCs automatically with an IP address after restoring an image made by, for instance, ghost. c. If your customers dial in over a PPP link and need a dynamic IP address for that connection. d. To configure servers with a static IP address by using static DHCP addresses.
2. The DHCP packet used to figure out which DHCP servers are willing to offer you a lease is called _________________. 3. When a DHCP client shuts down cleanly, it "gives back" its IP address to the server by sending a _________________ packet. 4. Put the following DHCP messages in the correct order:
a. DHCPACK b. DHCPREQUEST c. DHCPREPLY d. DHCPRELEASE e. DHCPDISCOVER f. DHCPOFFER
Unit Summary
It is very useful to configure IP clients dynamically No local configuration necessary Less IP addresses needed The DHCP protocol allows dynamic client configuration Linux can act as a DHCP client using the client daemons pump, dhcpcd or dhclient Linux can act as a DHCP server using the server daemon dhcpd The DHCP server is configured in /etc/dhcpd.conf The ISC DHCP server supports Dynamic DNS if you also use the ISC DNS server