260 likes | 602 Views
CENG415 – Communication Networks. Lectures 21 DHCP – Dynamic Host Configuration Protocol. Configuration of IP addresses. How is a host allocated a certain IP address? Need to satisfy uniqueness requirement Need to provide same network address with all other hosts in same network
E N D
CENG415 – Communication Networks Lectures 21 DHCP – Dynamic Host Configuration Protocol
Configuration of IP addresses • How is a host allocated a certain IP address? • Need to satisfy uniqueness requirement • Need to provide same network address with all other hosts in same network • Manual configuration: ipconfig(Windows) or ifconfig (unix) • Requires system admin privileges • Error-prone • Dynamic configuration of IP addresses? • Simpler to manage, and also more efficient usage of the IP address space
DHCP • DHCP server allocates an available IP address to a host, when the latter is connected to the network or booted • Usually, one DHCP server for each administrative domain • DHCP runs over UDP/IP • But how does the host know the DHCP server address? • Host first sends DHCP-DISCOVER to IP broadcast address (255.255.255.255) • Message can be received by DHCP server directly, or it may be forwarded there through DHCP relay (can be a router)
DHCP • DHCP can be used for several other configuration operations • Router address • Computer name • DNS server addresses • DHCP server allocates IP addresses with certain lifetime • “Lease Time” • DHCP clients can renew addresses
DHCP Header there are more than 100 options
DHCP Header Fields • OpCode: 1 (Request), 2(Reply) • Hardware Type: 1 (pour Ethernet) • Hardware address length: 6 (for Ethernet) • Hop count: set to 0 by client • Transaction ID: Integer (used as ID for messages) • Seconds: Number of seconds since the client booted • Client IP address, Your IP address, server IP address, Gateway IP address, client hardware address, server host name, boot file name:The client will indicate the information it knows, the remaining fields stay empty.
Message Types The message type is transmitted as an option.
Options • DHCP can use the option field to transmit more configuration information: Subnet Mask, Name Server, Hostname, Domain Name, Default IP TTL, Broadcast Address, Static Route, Ethernet Encapsulation, X Window Manager, X Window Font, DHCP Msg Type, DHCP Renewal Time, DHCP Rebinding, SMTP-Server, Printer Name, …
DHCP (Discover) The client searches for a DHCP Server 1 Client DHCP Server DHCP DISCOVER Broadcast IP source = 0.0.0.0 IP dest =255.255.255.255 Port UDP dest = 67 DHCP Fields Client IP Address = 0.0.0.0 Hardware Address = 08007. . .
DHCP (Offer) server(s) respond(s) to client DHCP OFFER Broadcast DHCP Server Client 2 IP dest = 255.255.255.255 Port UDP dest = UDP Port 68 DHCP Fields Your IP Address = 131.107.7.29 Hardware Address = 08007… Subnet mask =…, Default gateway =… Lease time =… Renewal time =… DNS server =…
DHCP (Request) The client accepts the received configuration / Server(s) respond(s) to client 3 DHCP REQUEST Broadcast Client DHCP Server IP source = 0.0.0.0 IP dest = 255.255.255.255 Port UDP dest = 67 Champs DHCP 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 = …
DHCP (Ack) Server confirms the DHCP request and updates its table 4 DHCP Table 131.107.7.7 08004. . . 131.107.7.29 08007. . . DHCP ACK Broadcast DHCP Server Client 4 IP dest = 255.255.255.255 Port UDP des = 68 Champs DHCP IP Address = 131.107.7.29 Hardware Address = 08007… Subnet mask = … Default gateway = … Lease time = … Renewal time = … DNS server = …
Gratuitous ARP The client needs to insure that no other stations have the same address. Client will send some ARP messages asking: who has my IP address? If no answer perfect. 5 Client ARP REQUEST Broadcast Who has 131.107.7.29?
Lease renew After a time equal to 50% of the lease time, client renews the lease using a DHCP Request. DHCP REQUEST Client DHCP Server IP source = 131.107.7.29 IP dest = 255.255.255.255 Port UDP dest = 67 DHCP Fields 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 = …
Renew after reboot After a reboot the client renews the lease using DHCP Request. The client has only to check whether the previous received configuration still valid or not. DHCP REQUEST Broadcast Client DHCP Server IP source = 0.0.0.0 IP dest = 255.255.255.255 Port UDP dest = 67 DHCP Field 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 = …
A B DHCP on a routed network A broadcast does not traverse a router ! ONLY one DHCP server for the company, not for each IP Network DHCP Server = 10.1.1.1 BOOTP/DHCP RELAY AGENT DHCP DISCOVER unicast DHCP DISCOVER Broadcast 10.2.2.1 1 Gateway IP = 10.2.2.1 2 DHCP Server 10.1.1.1 Client
A B DHCP on a routed network DHCP Server = 10.1.1.1 BOOTP/DHCP RELAY AGENT DHCP OFFER unicast DHCP OFFER Broadcast 3 10.2.2.1 4 IP dest = 10.2.2.1 Port UDP dest= 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… Subnet mask = … Default gateway = … Lease time = … ... DHCP Server 10.1.1.1 Client
Windows Commands • Ipconfig /all • Ipconfig /renew • Ipconfig /release
Scenario of station thatneeds an IP address MAC : Dst : FF:FF:FF:FF:FF:FF Src : 2F:6C:04:54:DD:03 IP : Dst : 255.255.255.255 Src : 0.0.0.0 UDP : Dst : 67 (DHCP server) Src : 68 (DHCP client) MAC : Dst : FF:FF:FF:FF:FF:FF Src : 3A:22:4C:67:EE:1C IP : Dst : 0.0.0.0 Src : 128.81.15.2 UDP : Dst : 68 (DHCP client) Src : 67 (DHCP server) 2F:6C:04:54:DD:03 3A:22:4C:67:EE:1C
Broadcast Station A DHCP Server Bridge B1 Bridge B3 Bridge B2
Station A obtains the config • Station A • IP address: 128.81.15.3 • Mask: 255.255.255.0 • Gateway : 128.81.15.1 • DNS : 128.81.16.24