Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host...

45
Guide to TCP/IP, Second E dition 1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Transcript of Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host...

Page 1: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 1

Guide To TCP/IP, Second Edition

Chapter 8

The Dynamic Host Configuration Protocol (DHCP)

Page 2: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 2

Objectives

• Understand the basic services DHCP offers to its clients; explain DHCP’s background, history, and origins; discuss DHCP leases; and describe the basic software components that permit DHCP to function

• Understand the specifics of IP address management using DHCP

• Explain the DHCP Discovery, renewal, and release processes

Page 3: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 3

Objectives (cont.)

• Understand the basic DHCP packet structure and types of DHCP messages in use

• Describe broadcast and unicast addressing, and understand why a DHCP server uses one over the other

• Describe relay agent communications• Discuss Microsoft DHCP scopes and classes

Page 4: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 4

Introducing DHCP

• Provides a way for client computer to request an IP address

• DHCP delivers the necessary configuration information– IP address

– Subnet mask

– IP Gateways

– Address for DNS servers

– Address for WINS servers

Page 5: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 5

Introducing DHCP (cont.)

• Administer client IP address assignments and configuration data from a single, centralized server

• Address pool or address scope

• One or more range of IP address

• Exclude an address or range of address

• Address lease

Page 6: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 6

How DHCP Works

• Client perspective on DHCP– Client is configured to “Obtain an IP address

automatically”

– At boot-up the client broadcasts DHCP address request

– DHCP servers reply offers an address lease

– Client accepts address lease offer

– Server offers an IP address with a lease time limit

– Half the lease time the client attempts to renew lease

Page 7: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 7

How DHCP Works (cont.)

Page 8: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 8

The Role Of Leases

• Length of leases vary

• One to three weeks in length are typical

• One to three days for networks with temps or roving workers

• Four to eight hours are common on ISP networks

Page 9: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 9

DHCP Software Elements

• Three elements to DHCP software– DHCP client

• Built-in DHCP client software in Windows and UNIX operating systems

– DHCP Server• Manages address pools and related configuration of Windows

and UNIX servers

– DHCP relay agent• Intercepts address requests

• Repackages requests and unicasts to a DHCP server

Page 10: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 10

DHCP Lease Types

• Two types of address leases– Manual address lease– Dynamic address lease

• Typical IP addressing schemes– Servers have fixed IP addresses– Routers have fixed IP addresses– Clients use dynamic IP Addresses

Page 11: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 11

More About DHCP Leases

• IPCONFIG command supports the /release and /renew switches

• How DHCP integrates with DSN– Server address are advertised using DNS– DNS is not a dynamic environment– Client address are resolved when using email

addresses• [email protected]

Page 12: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 12

Understanding IP Address Management With DHCP

• Booting for the first time or after a lease expires– DHCP Discovery

• Discovery broadcast

– Renewal process• Rebinding process

• Client must completely release its address if rebinding fails

• Servers and clients use PING and ARP as error prevention methods

Page 13: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 13

The Standard Address Discovery Process

• DHCP Discovery process uses four packets– DHCP Discover packet– DHCP Offer packet– DHCP Request packet– DHCP Acknowledgment packet

Page 14: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 14

The Standard Address Discovery Process (cont.)

Page 15: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 15

The Discover Packet

• Client broadcasts a Discover Packet– Client hardware address– Source IP address 0.0.0.0– Destination address 255.255.255.255– Preferred address– Message Type value 1– Client Identifier– DHCP options

Page 16: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 16

The Discover Packet (cont.)

• DHCP options– Option 1: Client’s subnet mask– Option 3: Routers on the client’s subnet– Option 6: Domain name servers– Option 15: Domain name– Option 44: NetBIOS over TCP/IP name servers– Option 46: NetBIOS over TCP/IP node type– Option 47: NetBIOS over TCP/IP scope– Option 57: Maximum DHCP message size– Option 255: End of options

Page 17: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 17

The Discover Packet (cont.)

Page 18: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 18

The Offer Packet

• DHCP server sends the Offer packet– An IP address is offered– Packet is sent by unicast

Page 19: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 19

The Offer Packet (cont.)

Page 20: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 20

The Request Packet

• DHCP Request packet

• DHCP Decline packet

Page 21: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 21

The Request Packet (cont.)

Page 22: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 22

The Acknowledgment Packet

• Sent from Server

• Contains configuration options requested by client

• Duplicate IP address test

Page 23: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 23

The Acknowledgment Packet (cont.)

Page 24: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 24

The Renewal Process

• The Renewal Time (T1)– Renewal packet is unicast directly to the DHCP server

• 0.5 * duration_or_lease (i.e., lease time)

• The rebinding Time (T2)– Broadcast a renewal request to any listening DHCP

servers• 0.875 * duration_of_lease

• Continues rebinding process until one minute from the lease expiration time

• Client releases it address if unsuccessful and reinitializes to start DHCP Discovery process

Page 25: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 25

The Renewal Process (cont.)

Page 26: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 26

The Renewal Process (cont.)

Page 27: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 27

The DHCP Address Release Process

• DHCP Release packet

• Sent over UDP

• DHCP server does not send acknowledgements

Page 28: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 28

DHCP Packet Structures

• DHCP packet fields– Operation Code (OPCODE) Field

• DHCP Request (0x01)

• DHCP Reply (0x02)

– Hardware Type Field– Hardware Length Field– Hops Field– Transaction ID Number Field

Page 29: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 29

DHCP Packet Structures (cont.)

• DHCP packet fields (cont.)– Seconds Since Boot Field– Flags Field– Client IP Address Field– Your IP Address Field– Server IP Address Field– Gateway IP Address Field

Page 30: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 30

DHCP Packet Structures (cont.)

• DHCP packet fields (cont.)– Client Hardware Address Field– Server Host Name Field– Boot File Field

• DHCP Options– Expand the data that is included in the packet– DHCP Option 53: Message Type

• Required in all DHCP packets

Page 31: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 31

DHCP Packet Structures (cont.)

Page 32: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 32

DHCP Packet Structures (cont.)

Page 33: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 33

Broadcast And Unicast in DHCP

Page 34: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 34

Communications With A DHCP Relay Agent

• Routers do not forward broadcasts

• Relay agents accepts discovery broadcasts and unicasts them to the DHCP server

• Relay agent function is usually enabled on a router

Page 35: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 35

Communications With A DHCP Relay Agent (cont.)

Page 36: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 36

Communications With A DHCP Relay Agent (cont.)

Page 37: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 37

Microsoft DHCP Scopes And Classes

• Scope is a range of consecutive IP addresses

• Superscope is a group of non-consecutive IP address– A collection of scopes

Page 38: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 38

Troubleshooting DHCP

• Troubleshoot DHCP with an analyzer

• IPCONFIG utility– ipconfig /release– ipconfig /renew

Page 39: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 39

Troubleshooting DHCP (cont.)

Page 40: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 40

Chapter Summary

• DHCP provides a way for computers to obtain usable, unique IP addresses and necessary TCP/IP configurations even when no IP addresses were assigned to those machines

• As long as a DHCP server or relay is available on the cable segment where an initial DHCP Request message is broadcast, the DHCP service makes it easy and automatic to include computers on a TCP/IP network

Page 41: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 41

Chapter Summary (cont.)

• From the administrative side, DHCP makes is easy to define and manage pools of IP addresses, which Microsoft calls a scope when referring to a set of IP addresses under DHCP’s management, and a superscope when referring to a collection of IP address scopes

Page 42: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 42

Chapter Summary (cont.)

• DHCP’s origins lie in an earlier TCP/IP Application layer protocol, called BOOTP, used to enable diskless workstations to boot remotely across a network

• Basic BOOTP and DHCP formats are entirely compatible, so that by configuring a router to forward BOOTP, it also forwards DHCP packets

Page 43: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 43

Chapter Summary (cont.)

• DHCP supports two types of address allocation: manual, in which administrators directly manage all addresses; and dynamic, in which addresses are allocated with explicit expiration intervals called leases

• Many of DHCP’s functions and messages relate to obtaining, renewing, and releasing dynamic address leases, primarily for client machines

Page 44: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 44

Chapter Summary (cont.)

• When a DHCP client starts, it begins the DHCP Discovery process, during which the client receives an IP address and lease

• In the middle of the lease time, the client starts a renewal process to determine if it can keep the address past the lease time

• If not, the client releases its IP address and starts the Discovery process over

Page 45: Guide to TCP/IP, Second Edition1 Guide To TCP/IP, Second Edition Chapter 8 The Dynamic Host Configuration Protocol (DHCP)

Guide to TCP/IP, Second Edition 45

Chapter Summary (cont.)

• DHCP supports a wide variety of message types and options, but only Message Type 53 (DHCP Message) is mandatory for any given DHCP message

• Because DHCP can ferry a surprisingly large range of configuration information (including all kinds of network services, such as e-mail and NetBIOS over TCP/IP), the protocol makes use of several message options

• A protocol analyzer is especially effective when diagnosing DHCP difficulties, particularly those related to the DHCP boot sequence