CSC521 Communication Protocols 網路通訊協定 Ch. 22 Bootstrap And Autoconfiguration (DHCP, NDP or IPv6-ND) 吳俊興國立高雄大學資訊工程學系 Internetworking With TCP/IP, Vol I: Sixth Edition, Douglas E. Comer
Outline 1 Introduction 2 History Of IPv4 Bootstrapping 3 Using IP To Determine An IP Address 4 DHCP Retransmission And Randomization 5 DHCP Message Format 6 The Need For Dynamic Configuration 7 DHCP Leases And Dynamic Address Assignment 8 Multiple Addresses And Relays 9 DHCP Address Acquisition States 10 Early Lease Termination 11 Lease Renewal States 12 DHCP Options And Message Type 13 DHCP Option Overload 14 DHCP And Domain Names 15 Managed And Unmanaged Configuration 16 Managed And Unmanaged Configuration For IPv6 17 IPv6 Configuration Options And Potential Conflicts 18 IPv6 Neighbor Discovery Protocol (NDP) 19 ICMPv6 Router Solicitation Message 20 ICMPv6 Router Advertisement Message 21 ICMPv6 Neighbor Solicitation Message 22 ICMPv6 Neighbor Advertisement Message 23 ICMPv6 Redirect Message 24 Summary 2
System Startup To keep protocol software general IP stack designed with many parameters Values filled in when system starts Two possible sources of information Local storage device (e.g., disk) Server on the network 3
Bootstrapping RARP (Reverse ARP) BOOTstrap Protocol (BOOTP) Early alternative to RARP Provided more than just an IP address Obtained configuration parameters from a server Used UDP Dynamic Host Configuration Protocol (DHCP) Replaces and extends BOOTP Provides dynamic address assignment 4
Apparent Contradiction Contradiction: stack must be initialized before being initialized DHCP used to obtain parameters for an IP stack DHCP uses IP and UDP to obtain the parameters Solution: using limited broadcast IP address DHCP runs as application, bud only needs basic facilities An application program can use the limited broadcast IP address to force IP to broadcast a datagram on the local network before IP has discovered the IP address of the local network or the machine's IP address. destination: 255.255.255.255 Note: server cannot use ARP when replying to client because client does not know its own IP address 5
Using IP to Determine an IP Address Example: Suppose client A wants to use DHCP to find bootstrap information and B is the server on the same network A does not know B s IP address or the IP address of the network. How to issue a request? Broadcast using IP limited broadcast address IP destination: 255.255.255.255 Mac destination: FF:FF:FF:FF:FF:FF Can B send a directly reply? Client A does not recognize its IP address yet. B can know Client A s IP, but A can t response to ARP request from B. Two alternatives: either broadcast the reply or use information from the request packet to manually add an entry to its ARP cache (does not work) 6
DHCP Retransmission DHCP places all responsibility for reliable communication on the client Client handles retransmission DHCP requires that UDP use checksums IP sent with the do not fragment bit Allow multiple replies: accept and process the first Handling datagram loss: timeout and retransmission When the client transmits a request, it starts a timer Initial timeout selected at random (0 to 4 seconds) to avoid simultaneous retransmission Timeout for successive retransmissions doubled After reaching a large value, 60 seconds, it does not increase the timer, but continues to use randomization 7
Two-Step Bootstrap DHCP provides information, not data Client receives Name of file that contains boot image Address of server Client must use another means to obtain the image to run typically TFTP using UDP port 69 It is used to read files from, or write files to, a remote server That transfer is performed in lock-step, with only one packet (either a block of data, or an 'acknowledgement') ever in flight on the network at any time It cannot list directory contents It has no authentication or encryption mechanisms 8
DHCP Address Assignment Backward compatible with BOOTP Can assign addresses in three ways Manual (manager specifies binding as in BOOTP) Automatic (address assigned by server, and machine retains same address) permanent assignment Dynamic (address assigned by server, but machine may obtain new address for successive request) for a limited time Manager chooses type of assignment for each address Support for autoconfiguration To use DHCP, a host becomes a client by broadcasting a message to all servers on the local network The host then collects offers from servers, selects one of the offers, and verifies acceptance with the server 9
Dynamic Address Assignment Assign dynamic address or information to a client host Not all clients connect to the net simultaneously Needed by ISPs Client obtains an IP address and uses temporarily When client finishes, address is available for another client Also used on many corporate networks Basic mechanism Client is granted a lease on an address Server specifies length of lease At end of lease, client must renew lease or stop using address Actions controlled by finite state machine 10
Dynamic Host Configuration Protocol RFC2131 UDP port 67 supplying each network client with an IP address, subnet mask, default gateway, an IP address for a WINS server, an IP address for a DNS server, and address lease time 11
DHCP Finite State Machine 12
DHCP Message Format OP: request(1) or reply(2) HTYPE and HLEN: as in ARP (Ethernet: HTYPE=1, HLEN=6) HOPS: client places 0 increase if forwarded by a machine SECONDS: seconds since boot FLAGS: only the highest bit used ask to response by broadcast Address Fields: clients fill in as much as they know Client IP: filled if the client has known its IP but to ask other information Your IP: a server returns the client s IP here if it finds Client IP is zero Server IP or Host Name nonzero: only the matched server will answer it zero: any server can answer it 13
DHCP Options and Message Type Field Type-Length-Value (TLV) style Message: Code(53)+Length(1)+Type Subnet Mask: Code (1) 0x01 0x04 0xff 0xff 0xff 0x00 Time Offset: Code (2) 0x02 0x04 0x00 0x00 0xff 0xff Pad: Code(0) End: Code(255) 14
Questions For Discussion Explain the relationship among ARP, DHCP and DNS. What basic facility is needed? Why? 15
Summary Two protocols available for bootstrapping BOOTP (static binding of IP address to computer) DHCP (extension of BOOTP that adds dynamic binding of IP addresses) DHCP Server grants lease for an address Lease specifies length of time Host must renew lease or stop using address when lease expires Actions controlled by finite state machine 16