8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

50
8 Chapter 8 1 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP

Transcript of 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

Page 1: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 1

The Dynamic Host Configuration Protocol (DHCP)

A Guide to TCP/IP

Page 2: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 2

Objectives

After reading this chapter and completing the exercises you will be able to:

• Understand the basic services DHCP offers to its clients

• Explain DHCP’s background, history, and origins

• Describe the basic software components that permit DHCP to function

Page 3: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 3

Objectives

After reading this chapter and completing the exercises you will be able to:

• Understand the specifics of IP address management using DHCP

• Read and understand basic DHCP message types

• Explain and configure basic settings for DHCP services

Page 4: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 4

Introducing DHCP

• DHCP is a service that permits network administrators to set up servers to allocate and manage collections of IP addresses for workstations, desktop computers, and other client machines that do not require fixed IP addresses

• DHCP can also supply important IP configuration data for clients, including the subnet mask, the local IP gateway (router) address, and even DNS and WINS data, where needed or appropriate

Page 5: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

5

Introducing DHCP

• DHCP servers can manage one or more ranges of IP addresses, each of which may be called an address pool (if considered as a range of available addresses from which unused addresses may be allocated), or an address scope (if considered as a range of numeric IP addresses that fall under DHCP’s control)

Page 6: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 6

Introducing DHCP

• Here’s a brief rundown of how DHCP works, from a client perspective:

– When TCP/IP is configured on the client computer, the Obtain an IP address automatically option button is the only necessary set-up element. Everything is automatic

– The next time the workstation attempts to access the network (older versions of Windows must be rebooted first), it broadcasts a DHCP address request to the network because it has no IP address, but is now configured as a DHCP client. All DHCP servers present on the same cable segment or broadcast domain receive this request, and send back a message that indicates a willingness to grant an address lease, if an address is available

Page 7: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 7

DHCP’s Origins

• The DHCP protocol is an extension of an

earlier IP protocol called BOOTP

• BOOTP was originally developed to permit

diskless workstations to bootstrap from a

Programmable Read-Only Memory (PROM) or

Erasable PROM (EPROM) on their network

interface cards

Page 8: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 8

DHCP Software Elements

• Three pieces of software that work together define a complete DHCP networking environment:

– DHCP client

– DHCP server

– DHCP relay agent

• Please note that most other DHCP requests—such as lease renewals or surrenders—occur as unicast messages because as soon as a machine obtains an IP address and a default IP gateway address, it is able to communicate directly with the DHCP server and no longer needs an intermediary

Page 9: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 9

DHCP Lease Types

• A DHCP server recognizes three types of address leases:

– Manual: With a manual lease, the administrator explicitly assigns all IP addresses manually

– Automatic: The DHCP server permanently assigns certain IP addresses

– Dynamic: The DHCP server assigns addresses for specific periods of time

Page 10: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 10

More About DHCP Leases

• Here’s a brief explanation of why dynamic address leasing is the best practice presently used for clients:

– Server addresses are advertised using the DNS, which resolves domain names into IP addresses, and vice versa

– DNS is not a dynamic environment so all address updates must be entered manually

– Client addresses usually come into play only when e-mail addresses of the form [email protected] must be resolved. E-mail servers can resolve this information when clients connect so dynamic address resolution works perfectly well for clients

Page 11: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 11

More About DHCP Leases

• A typical IP addressing scheme on a network might look like this:

– Servers have fixed IP addresses because their DNS entries must stay consistent

– Routers (or IP gateways, be they routers or other machines) have fixed IP addresses because their addresses are key parts of any subnet’s IP configuration

– Clients use dynamic IP addresses because e-mail access through POP3, SMTP, and IMAP4 avoids the need for fixed addresses (resolution occurs each time a message transfer is made)

Page 12: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 12

Understanding IP Address Management with DHCP

• When a DHCP client has no IP address (booting for the first time, or after a lease expires), it must broadcast a request for an IP address to obtain one—this process is called DHCP Discovery

• DHCP servers that can hear this discovery broadcast offer an IP address to a client for a specific amount of time (the lease time)

• The default DHCP lease time varies according to which server is used (eight days for Windows 2000 and 36 hours for Windows NT 4.0, for example)

Page 13: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 13

Understanding IP Address Management with DHCP

• 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 the client cannot renew the address from that DHCP server within the stipulated lease period, that client must begin the more desperate process of renewing the address from another DHCP server

• This is called the rebinding process

• If rebinding fails, a client must completely release its address

Page 14: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 14

Understanding IP Address Management with DHCP

• The DHCP Discovery process relies on the initial DHCP broadcast

• Naturally, routers do not forward these discovery broadcasts so the entire discovery process is a local process

• There must be a DHCP server on the local network segment

• Because it is impractical to place a DHCP server on every network segment, the DHCP specification includes the relay agent process to help route the DHCP discovery broadcasts to another network segment

Page 15: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 15

The Standard Address Discovery Process

• When a DHCP client boots up, it performs the Standard Address Discovery process before it can communicate on the network

• After the process completes successfully, the DHCP client tests the IP address using a duplicate IP address ARP broadcast

Page 16: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 16

The Standard Address Discovery Process

• The DHCP Discovery process actually uses four packets:

– DHCP Discover packet

– DHCP Offer packet

– DHCP Request packet

– DHCP Acknowledge packet

Page 17: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 17

The Discover Packet

• During the DHCP Discovery process, the client broadcasts a Discover packet that identifies the client’s hardware address

• If the DHCP client was on the network before, the client also defines a preferred address—typically the client prefers the last address it used

• In the DHCP Discover packet shown in Figure 8-3, the Message Type value is one—this indicates that this packet is a DHCP Discover packet

• The Client Identifier field value is based on the client’s hardware address

Page 18: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 18

DHCP Discover Packet Is Always Sent as

a Hardware and IP Broadcast

Page 19: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 19

The Offer Packet

• The DHCP server sends the Offer packet to offer an IP address to the DHCP client

• The Offer packet includes the IP address that is offered to the client, and sometimes answers to the requested options in the DHCP Discover packet

• Note in the IP address field that the DHCP server offers 10.1.0.2 to the client

Page 20: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 20

DHCP Offer Packet Includes the Suggested

IP Address for the DHCP Client

Page 21: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 21

The Request Packet

• Once the Offer packet is received, the client can either accept the offer by issuing a DHCP Request packet, or reject the offer by sending a DHCP Decline packet

• Typically, a client only sends a Decline if it received more than one Offer

Page 22: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 22

DHCP Client May List Additional Configuration

Parameters in the DHCP Request Packet

Page 23: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 23

The Acknowledgement Packet

• The Acknowledgement packet is sent from the server to the client to indicate the completion of the four-packet DHCP Discovery process

• This response contains answers to any options to which the DHCP server replies

Page 24: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 24

The Acknowledgement Packet

• The Acknowledgement packet shown in Figure 8-6 includes some answers to the client’s request for information, as listed below:

– The client subnet mask is 255.255.0.0

– The client’s default gateway address is 10.0.0.1

– The client’s DNS server address is 10.0.0.1

Page 25: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 25

The Address Renewal Process

• When a DHCP client receives an address from a DHCP server, the client also receives a lease time and notes the time that the address was received

The Renewal Time (T1)

• T1 is defined as the time that the client tries to renew its network address by contacting the DHCP server that sent the original address to the client

Page 26: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 26

The Address Renewal Process

The Rebinding Time (T2)

• T2 is defined as the time that the client begins to broadcast a renewal request hoping that another DHCP server can extend the lease time

• The DHCP client continues to retry the rebinding process until one minute from the lease expiration time

• If the client is unsuccessful in renewing the lease, it must give up the address at the expiration of the lease time, and reinitialize

Page 27: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 27

DHCP Timeline Includes the Lease Time (LT), Renewal

Time (T1), and Rebinding Time (T2)

Page 28: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 28

DHCP Client Begins Advertising an Address of 0.0.0.0 When It Gives Up Its IP Address

Page 29: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 29

The DHCP Address Release Process

• Although not required by the

specification, the client should release its

address by sending a DHCP Release

packet to the server (called the release

process)

Page 30: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 30

DHCP Packet Structures

• Figure 8-9 shows the standard DHCP packet structure

Page 31: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 31

DHCP Packet Structures

Operation Code Field

• This 1-byte field indicates whether this packet is a DHCP request (0x01) or DHCP reply (0x02)

Hardware Type Field

• This 1-byte field identifies the hardware address type, and matches the values assigned for ARP hardware type definitions

Hardware Length Field

• This 1-byte field indicates the length of the hardware address

Page 32: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 32

DHCP Packet Structures

Hops Field

• This field is set to zero by the client, and may be used by relay agents as they assist a client in obtaining an IP address and/or configuration information

Transaction ID Number Field

• This 4-byte field contains a random number selected by the client, and is used to match requests and responses between the client and server

Page 33: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 33

DHCP Packet Structures

Seconds Since Boot Field

• This 2-byte field indicates the number of seconds that elapsed since the client began requesting a new address, or renewal of an existing address

Flags Field

• The first bit of the 2-byte Flags field can be toggled to one to indicate that the DHCP client cannot accept unicast MAC layer datagrams before the IP software is completely configured

Page 34: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 34

DHCP Packet Structures

Client IP Address Field

• The DHCP client fills in this 4-byte field with its IP address after it is assigned and bound to the IP stack

Your IP Address Field

• This 4-byte field contains the address being offered by the DHCP server

Server IP Address Field

• This 4-byte field contains the IP address of the DHCP server to use in the boot process

Page 35: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 35

DHCP Packet Structures

Gateway IP Address Field

• This 4-byte field contains the address of the DHCP relay agent, if one is used

Client Hardware Address Field

• This 16-byte field contains the hardware address of the client

Page 36: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 36

DHCP Packet Structures

Server Host Name Field

• This 64-byte field can contain the server host name, but such information is optional

• This field can contain a null-terminated string (all zeroes)

Boot File Field

• This field contains an optional boot filename or null-terminated string

Page 37: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 37

DHCP Options Fields

• DHCP options are used to expand the data that is included in the DHCP packet

Page 38: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 38

DHCP Options

Page 39: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 39

DHCP Options

Page 40: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 40

DHCP Option 53: Message Type

• This required option indicates the general purpose of any DHCP message

• As you may recall, the DHCP boot sequence uses the following message types:

– DHCP Message Type 1: Discover (client to server)

– DHCP Message Type 2: Offer (server to client)

– DHCP Message Type 3: Request (client to server)

– DHCP Message Type 4: ACK (server to client)

Page 41: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 41

Broadcast and Unicast in DHCP

• As you examine DHCP communications, you will note they use a strange mix of broadcast and unicast addressing

• DHCP clients must use broadcast until obtaining IP addresses through a successful completion of the Discovery, Offer, Request, and Acknowledgement processes

Page 42: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 42

DHCP Relay Agents

• The relay agent function is typically loaded on a router connected to the segment containing DHCP clients

• This relay agent device is configured with the address of the DHCP server, and can communicate unicast directly with that server

Page 43: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 43

DHCP Relay Agents

• Figure 8-11 shows the communication sequence on a network that supports a DHCP relay agent

Page 44: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 44

Microsoft DHCP Scopes and Classes

• Microsoft uses the term scope to define a

set of IP addresses that the Windows 2000

DHCP server can assign to clients

• Microsoft refers to a collection of multiple

individual scopes as a superscope

Page 45: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 45

The Future of DHCP

• As IPv6 development and deployment move forward, DHCP’s role changes significantly

• One of the great advantages of IPv6 is autoconfiguration—IPv6 hosts can create local IP addresses using their hardware addresses and the Neighbor Discovery process

Page 46: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 46

Troubleshooting DHCP

• The best way to troubleshoot DHCP is with an analyzer—compare a problematic boot up sequence with the standard four-packet boot up sequence

Page 47: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 47

Troubleshooting DHCP

• You can release and/or renew an IP address using the following commands:

– ipconfig/release - Releases the IP address for the specified adapter

– ipconfig/renew – Renews the IP address for the specified adapter

Page 48: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 48

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

• From the administrative side, DHCP makes is easy to define and manage pools of IP addresses, which Microsoft calls a scope in the singular and a superscope in the plural

Page 49: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 49

Summary

• 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

• DHCP supports three types of address allocation: manual, in which administrators directly manage all addresses; automatic, in which relatively static address assignments may be made under DHCP’s control; and dynamic, in which addresses are allocated with explicit expiration intervals called leases

Page 50: 8 Chapter 81 The Dynamic Host Configuration Protocol (DHCP) A Guide to TCP/IP.

8

Chapter 8 50

Summary

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

• A protocol analyzer is especially effective when diagnosing DHCP difficulties, particularly those related to the DHCP boot sequence, because it can display the sequence of messages that occurs on a network, which may then be compared to the usual, prescribed sequence