Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 CMPT 471 Networking II DHCP © Janice Regan, 2006-2013.

Similar presentations


Presentation on theme: "1 CMPT 471 Networking II DHCP © Janice Regan, 2006-2013."— Presentation transcript:

1 1 CMPT 471 Networking II DHCP © Janice Regan, 2006-2013

2 2 DHCP software  A commonly used DHCP package used on linux networks is the ISC (Internet software consortium) DHCP package  To help understand how this package is used read the linux documentation for The DHCP relay agent, dhcrelay (posted) The DHCP client, dhclient The DHCP server, dhcpd

3 © Janice Regan, 2006-2013 3 DHCP relay agents  Two types  One runs on IP routers (some dedicated routers include embedded DHCP relay agents for example the Cisco router in the lab)  One runs on general purpose hosts (may be operating as routers)  Relay agents can replace a DHCP server on some segments of a multisegment network installation  Each segment of a network running DHCP must contain either (or both)  At least 1 DHCP server  At least 1 DHCP relay agent (usually associated with the routers attached to the segment)

4 © Janice Regan, 2006-2013 4 DHCP relay agents  Relay agents forward DHCP messages from clients on a network segment with no DHCP server to a DHCP server on another network segment  Remember that the original DHCPDISCOVER message is broadcast on the network segment containing the source host. It must reach either a DHCP server or a DHCP relay agent.  If it reaches a relay agent then it will be forwarded to a DHCP server on another network segment or to another relay agent.  To forward a DCHP message the relay agent needs  the information in the DHCP message  One or more IP address that all DHCP messages it receives are forwarded to. (>1 if more than 1 DHCP server)

5 © Janice Regan, 2006-2013 5 DHCP Relay agent operation  It increments the hop count in the DHCP message  Inserts the IP address of the relay agent into the router IP address field if the router (gateway) IP address is 0.0.0.0  The router IP address will be set to 0.0.0.0 when a DHCPDISCOVER message is created.  The router IP address will thus record the IP address of the first relay agent on the path to the DHCP server  Appends any relay agent options  The end option will be moved to follow any appended options  Sends the packet the DHCP server or next relay agent

6 © Janice Regan, 2006-2013 6 DHCP servers and Relay Agents  The server will receive and process the request, adding the configuration information to the message  The server will unicast the response message (encapsulated in an IP datagram) to the address extracted from the router address field. The response does not passes through only one relay agent, the first relay agent encountered by the request.  When the packet reaches the host running the relay agent it will be sent to the relay agent

7 © Janice Regan, 2006-2013 7 DHCP Relay Agent operation  Relay agent receives the message from the DHCP server  Relay agent checks the router address field to determine the network interface over which the message should be sent  The router address will indicate which interface the original message arrived through  Relay agent checks the broadcast flag to see if the packet should be broadcast or unicast the host that sent the request  Relay agent sends the message to the host that sent the request

8 © Janice Regan, 2006-2013 8 Avoiding DHCP message collisions  If a network is shut down (like in a power failure) and all hosts come up at the same time the server may not be able to deal with all the resulting discover messages  Each client is required to delay its initial DHCP message by a random time between 0 and 10 seconds  The delay time between retransmissions is randomized by -1 to +1 seconds

9 © Janice Regan, 2006-2013 9 DHCP configuration  Host or router running the DHCP server will have a configuration file at a default location of /etc/dhcpd.conf  Defines the operation of DHCP in the network  Specifies basic network architecture  Specifies lease times and other necessary information  For details of configuration refer to reference  The DHCP Handbook, Droms and Lemon

10 © Janice Regan, 2006-2013 10 Subnet declarations  Defines scope: range of addresses in network # Subnet 1 subnet 192.168.11.0 netmask 255.255.255.0 { # subnet declarations } # Subnet 2 subnet 192.168.0.0 netmask 255.255.128.0 { # subnet declarations }

11 © Janice Regan, 2006-2013 11 Subnet Address allocation  Define range of addresses available for allocation # subnet 1 subnet 192.168.11.0 netmask 255.255.255.0 { range 192.168.11.1 192.168.11.251 # 192.168.11.252 reserved for DHCP server # 192.168.11.253 reserved for DNS server # 192.168.11.254 reserved for router }

12 © Janice Regan, 2006-2013 12 Router option  Define range of addresses available for allocation # subnet 1 subnet 192.168.11.0 netmask 255.255.255.0 { range 192.168.11.1 192.168.11.251 # 192.168.11.252 reserved for DHCP server # 192.168.11.253 reserved for DNS server # 192.168.11.254 reserved for router option routers 192.169.11.254 }

13 © Janice Regan, 2006-2013 13 DNS server option  Define range of addresses available for allocation # Subnet 1 subnet 192.168.11.0 netmask 255.255.255.0 { range 192.168.11.1 192.168.1.251 # 192.168.11.252 reserved for DHCP server # 192.168.11.253 reserved for DNS server # 192.168.11.254 reserved for router option domain-name-servers 192.169.11.253 }

14 © Janice Regan, 2006-2013 14 Subnet mask option  Define range of addresses available for allocation # Subnet 1 subnet 192.168.11.0 netmask 255.255.255.0 { range 192.168.11.1 192.168.1.251 # 192.168.11.252 reserved for DHCP server # 192.168.11.253 reserved for DNS server # 192.168.11.254 reserved for router option subnet-mask 255.255.255.0 }

15 © Janice Regan, 2006-2013 15 Specifying lease times # Subnet 1 subnet 192.168.11.0 netmask 255.255.255.0 { range 192.168.11.1 192.168.1.251 #default lease 30 days, maximum 45 days default-lease-time 2592000 maximum-lease-time 3888000 minimum-lease-time 600 }

16 © Janice Regan, 2006-2013 16 Lease times  Can be specified by client as an option in DHCP messages  If specified time is less the min-lease-time, min-lease-time will be used  If specified time is greater the max-lease- time, max-lease-time will be used

17 © Janice Regan, 2006-2013 17 Static Allocation using DHCP  Can statically allocate addresses for particular hosts  Microsoft DHCP uses the term reservation rather than static allocation  Can use all static addresses  Can mix static and dynamic addresses  For example static addresses for fixed wired clients, dynamic addresses for mobile client

18 © Janice Regan, 2006-2013 18 Specifying static leases # Subnet 1 Subnet 192.168.11.0 netmask 255.255.255.0 { range 192.168.11.1 192.168.1.251 default-lease-time 2592000 } host dhcpserver { fixed address 192.168.1.252 hardware ethernet 00:20:78:10:c8:12 default-lease-time 1000 }

19 © Janice Regan, 2006-2013 19 Host statements  Used for static ip addresses and enhanced security  Any request from a client that matches (same ethernet address) a host statement is considered to be from a “known” client.  Other requests are from “unknown” clients  The name in the host statement is used only to identify the host statement it is not the clients hostname  Can use host statements to make the dhcp server treat some addresses differently from other

20 © Janice Regan, 2006-2013 20 Using pools  Can use host statements to make the dhcp server treat some addresses differently from other  Example: permit only known clients to obtain leases from the specified range of addresses. Provide a small range for any clients pool { deny unknown clients range 192.168.11.23 192.168.11.128 } pool { allow unknown clients range 192.168.11.129 192.168.11.150 }


Download ppt "1 CMPT 471 Networking II DHCP © Janice Regan, 2006-2013."

Similar presentations


Ads by Google