210 likes | 377 Vues
Bootstrap and Autoconfiguration (DHCP). Chapter 22. Look at client-server for bootstrapping Computer must know IP address before sending or receiving datagrams Needs router address, subnet mask, address of name server
E N D
Bootstrap and Autoconfiguration (DHCP) Chapter 22
Look at client-server for bootstrapping • Computer must know IP address before sending or receiving datagrams • Needs router address, subnet mask, address of name server • Look at protocol to allow host to determine information automatically at startup • Client & server communicate using UDP • Remember…UDP relies on IP to transfer messages • How use UDP to find IP address? • Will look at special IP addresses mentioned in Chap 3
History of Bootstrapping • Chap 5 mentioned RARP • Protocol to permit computer to get IP address • More general BOOTP replaced RARP • BOOTstrap Protocol • DHCP developed as successor to BOOTP • Dynamic Host Configuration Protocol • Most features of DCHP also apply to BOOTP • For simplicity, only talk about DHCP
DHCP uses UDP and IP • Can be implemented with an application program • Operates in client-server paradigm • Requires a single packet exchange • IP address • Router address • Name server address • Option: field for vendor-specific info
Using IP to Determine an IP Address • DHCP uses UDP to carry messages • UDP messages encapsulated in IP datagrams • Recall in Chap 3 several special-case IP addrs • Specifically, all 1’s specifies limited broadcast • IP SW can do even before knowing its local IP addr “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”
Example • Client A wants to use DHCP; B is server • (B is on same physical net) • A uses limited broadcast for its initial DHCP request • B probably cannot send a directed reply back • B sends reply datagram to network interface SW • Interface SW needs to map next hop IP addr to HW addr • Would use ARP, but • A does not know its address to answer the ARP request • B has two choices • Broadcast the reply • Manually add entry to its ARP cache • System may not allow application program to do
DHCP Retransmission Policy • UDP uses IP for delivery • We know it is an unreliable service • DHCP puts responsibility for reliability on client • DHCP also: • Requires that UDP use checksums • IP does not have checksum for the data • Requires that the do not fragment bit be set • To accommodate clients with little memory • Allows multiple replies (accepts & processes the 1st)
Timeout & retransmission used for reliability • Client sends request; starts timer • If no reply before expires, must retransmit • DHCP server(s) can get overrun with requests • After power failure & all machines booting • Machines use different retransmission timeout • DHCP specification recommends random delay • In addition, start with random timeout value (0-4 seconds) • Double the time after each retransmissions • After reach 60 seconds, not double but still use randomization
DHCP Message Format • Fixed length fields • Client & server used loosely • Clients sends request • Server sends reply • DHCP can be used even if client already knows its IP address • To get other info Figure 22.1 The format of a DHCP message. To keep implementations small enough to fit in ROM, fields except for options have fixed length
Need for Dynamic Configuration • Early bootstrap protocols designed for static environment • Manager created configuration file • File changed infrequently • Then: wireless networking & portable computers • Static parameter assignment requires extensive involvement of managers • Enter parameters for each host & store in server config file • Assign each host an IP address • Configure server so it understands host ID to IP addr mapping
DHCP designed for automated address assignment • Gets all configuration information in one message • Allows dynamic address allocation to computers • Manager configures DHCP server with set of IP addresses • New computer connects & requests addr, server picks one
DHCP allows three types of assignments • Manual configuration • Manager configures specific address for specific computer • Automatic configuration • Server allowed to assign permanent address • Dynamic configuration • Server “loans” an address for a limited time • Assignment based on client’s identifier and the network to which it has connected • Server can allocate to different computers in different ways
DHCP Lease Concept • Dynamic address assignment is temporary • DHCP server leases an address to a client • Server specifies the lease period at allocation • During the lease, server cannot lease that address to any other client • At end of lease, client must renew or stop using addr • How long should the lease be? • Depends on network and needs of host • DHCP does not specify a fixed constant • Client requests a certain period; server informs client of the period it grants
Multiple Addresses & Relays • DHCP provides info about one interface • Multi-homed host has multiple interfaces • Each interface handled independently • Relay agent • Lets computer contact server on nonlocal net • Complicates multi-homed host configuration • Get multiple requests from same computer • Assume multi-homed client can identify each interface uniquely so server can tell requests apart
Address Acquisition States • State diagram has six states • At boot, client enters INITIALIZE state • Broadcasts DHCPDISCOVER message • Moves to SELECT state • Gets zero or more DHCPOFFER responses • Each contains configuration info & IP address • Client must choose one of the offers (first to arrive) • Sends DHCPREQUEST message to negotiate
Enters REQUEST state • Server acks request and starts lease with DHCPACK • Client enters BOUND state upon receipt of ack • Proceeds to use the address • This is the normal state of operation • To terminate a lease early, send DHCPRELEASE • Cannot send any more datagrams using the address • Leaves BOUND state; must enter INITIALIZE to use IP • Client has three timers in this state • First: 50% of the lease time; must attempt to renew lease • Moves to RENEW state • Server can send DHCPACK or DHCPNACK
Second: 87.5% • If no response, server is either down or unreachable • When second timer expires, move to REBIND state • Broadcasts DHCPREQUEST to any server on net • If get positive response, move back to BOUND • If get negative response, move back to INITIALIZE • Third: full lease period • If get no response in REBIND state, move back to INITIALIZE when this timer expires
DHCP and Domain Names • Not all procedures for attaching permanent host to internet are automated • DHCP protocol does not specify interaction with the domain name system (DNS) • However, some implementations do interact with DNS
Summary • DHCP allows a computer to obtain information at startup • Router address, DNS server address, IP address • Permits automatic and dynamic allocation of IP addresses • Dynamic allocation is necessary in environments where computers attach and detach quickly
Computer becomes client to use DHCP • Broadcasts request to DHCP servers • Selects one of the offers it receives • Exchanges messages to obtain lease on IP address • Relay agent can forward DHCP requests • Allows site to have one DHCP server for multiple subnets • Starts three timers • When first expires, must attempt to renew its lease • If second expires before renewal is done, attempts to rebind from any server • If third expires before renewal, client stops using IP address and returns to initial state to get new address