DHCP Dynamic Host Configuration Protocol Agenda • Introduction • BOOTP Packet Format • DHCP 2/18 Groep T Leuven – Information department 2003-2004 - Information management 2 Introduction – RARP is limited • RARP only returns IP address • Does not cross routers • Difficult to program Need for mask Need for default gateway Need for DNS server Need for ... 3/18 Groep T Leuven – Information department 2003-2004 - Information management 3 BOOTP Packet Format IP datagram UDP datagram IP Header 20 bytes 4/18 Groep T Leuven – Information department UDP Header BOOTP request/reply 8 bytes 300 bytes 2003-2004 - Information management 4 BOOTP Header Opcode (1=request, 2=reply) Hardware type 1=Ethernet Hardware Address length Hop count Transaction ID Number of seconds (Unused) 300 bytes Client IP address Your IP address Server IP address Gateway IP address Client hardware address Server hostname Boot filename Vendor specific information 5/18 Groep T Leuven – Information department 2003-2004 - Information management 5 UDP Port numbers • Client uses port 68 • Server uses port 67 6/18 Groep T Leuven – Information department 2003-2004 - Information management 6 DHCP – Dynamic host configuration protocol • Extension of BOOTP • Provides TCP/IP configuration parameters • RFC 2131 7/18 Groep T Leuven – Information department 2003-2004 - Information management 7 DHCP – DHCP Discover The Client is looking for available DHCP servers 1 Client DHCP SERVER DHCP DISCOVER Broadcast Source IP Address = 0.0.0.0 Destination IP Address = 255.255.255.255 UDP port 67 Client IP Address = 0.0.0.0 Hardware Address = 08007. . . ... ... 8/18 Groep T Leuven – Information department 2003-2004 - Information management 8 DHCP – DHCP Offer The servers response to the clients DHCP OFFER Client 2 DHCP OFFER Broadcast DHCP SERVER Destination IP Address = 255.255.255.255 UDP Port 68 Your IP Address = 131.107.7.29 Hardware Address = 08007. . . Subnet mask Default gateway Lease time Renewal time DNS server WINS server 9/18 Groep T Leuven – Information department 2003-2004 - Information management 9 DHCP – DHCP REQUEST Intends to accept the parameters 3 Client DHCP REQUEST Broadcast DHCP SERVER Source IP Address = 0.0.0.0 Destination IP Address = 255.255.255.255 UDP port 67 Client IP Address = 131.107.7.29 Server IP Address = 131.107.7.1 Hardware Address = 08007. . . Subnet mask Default gateway Lease time Renewal time DNS server Groep T Leuven – Information department 2003-2004 - Information management 10/18 WINS server 10 DHCP – DHCP ACK The servers confirms the DHCP REQUEST + updates his database 4 Client 4 DHCP ACK Broadcast DHCP Table 131.107.7.7 08004. . . 131.107.7.29 08007. . . DHCP SERVER UDP Port 68 IP Address = 131.107.7.29 Hardware Address = 08007. . . Subnet mask Default gateway Lease time Renewal time DNS server WINS server 11/18 Groep T Leuven – Information department 2003-2004 - Information management 11 DHCP – Gratuitous ARP Client checks for unique IP address 5 Client ARP REQUEST Broadcast IP Address = 131.107.7.29 Hardware Address = 08007. . . 12/18 Groep T Leuven – Information department 2003-2004 - Information management 12 DHCP – Renewing the Lease After T1 (= 0,5 x LT) the client will renew the lease By issuing a DHCP REQUEST Client DHCP REQUEST DHCP SERVER Source IP Address = 131.107.7.29 Destination IP Address = 255.255.255.255 UDP port 67 Client IP Address = 131.107.7.29 Server IP Address = 131.107.7.1 Hardware Address = 08007. . . Subnet mask Default gateway Lease time Renewal time DNS server WINS server 2003-2004 - Information management 13/18 Groep T Leuven – Information department 13 DHCP – Renewing the Lease after REBOOT After REBOOT the client will renew the lease By issuing a DHCP REQUEST Client DHCP REQUEST Broadcast DHCP SERVER Source IP Address = 0.0.0.0 Destination IP Address = 255.255.255.255 UDP port 67 Client IP Address = 131.107.7.29 Server IP Address = 131.107.7.1 Hardware Address = 08007. . . Subnet mask Default gateway Lease time Renewal time DNS server WINS server 2003-2004 - Information management 14/18 Groep T Leuven – Information department 14 DHCP on a routed network Broadcast does not cross routers ! IP helper address = 10.1.1.1 DHCP DISCOVER Broadcast 1 A BOOTP/DHCP RELAY AGENT DHCP DISCOVER unicast 10.2.2.1 Gateway IP address = 10.2.2.1 Client 15/18 Groep T Leuven – Information department 2 B DHCP Server 10.1.1.1 2003-2004 - Information management 15 DHCP on a routed network Broadcast does not cross routers ! IP helper address = 10.1.1.1 DHCP OFFER Broadcast BOOTP/DHCP RELAY AGENT 10.2.2.1 DHCP OFFER unicast 3 4 A Destination IP Address = 10.2.2.1 UDP Port 67 Your IP Address = 10.2.2.7 Server IP Address = 10.1.1.1 Gateway IP Address = 10.2.2.1 Hardware Address = 08007. . . DHCP Server Subnet mask 10.1.1.1 Default gateway Lease time ... 2003-2004 - Information management B Client 16/18 Groep T Leuven – Information department 16 DHCP Commands • WIN NT/2K – ipconfig /release – ipconfig /renew • WIN95 – winipcfg 17/18 Groep T Leuven – Information department 2003-2004 - Information management 17 DHCP DHCPNACK DHCPDECLINE The server.to.client communication, refusing the request for configuration parameter. The client.to.server communication, indicating that the network address is already in use. (arp) DHCPRELEASE The client.to.server communication, relinquishing network address and canceling remaining lease. 18/18 Groep T Leuven – Information department 2003-2004 - Information management 18