24
1 Kyung Hee University Chapter 18 Chapter 18 Host Configuration Host Configuration : : DHCP DHCP

1 Kyung Hee University Chapter 18 Host Configuration : DHCP

Embed Size (px)

Citation preview

Page 1: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

11Kyung Hee University

Chapter 18Chapter 18Host Configuration :Host Configuration :

DHCPDHCP

Page 2: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

22Kyung Hee University

18.1 Introduction18.1 Introduction The information that is held in each computer attached

to a TCP/IP internet

Its IP address

Its subnet mask

The IP address of a router

The IP address of a name server

The above information is usually stored in a configuration file and accessed by the computer during the bootstrap process

In the case of a diskless computer, the operating system and networking S/W can be stored in ROM. But the above information cannot be stored in ROM

Page 3: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

33Kyung Hee University

PreviousPrevious ProtocolProtocol

RARP ( Reverse Address Resolution Protocol)

Provide the IP address for a booted computer

Map a physical address to an IP address

But deprecated today for two reasons

RARP used the broadcast service of the data link layer– So RARP server must be present in each network

RARP can provide only the IP address of the computer– Today, a computer requires IP address, subnet mask, IP

address of router, IP address of name server.

Page 4: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

44Kyung Hee University

PreviousPrevious Protocol (cont’)Protocol (cont’)

BOOTP ( Bootstrap Protocol)

Prerunner of DHCP

Client/Server protocol designed

BOOTP server can be anywhere in the Internet BOOTP can provide all pieces of information

But BOOTP is a static configuration protocol

BOOTP can not support dynamic configuration

Page 5: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

55Kyung Hee University

DHCPDHCP

Dynamic Host Configuration Protocol

DHCP is a client/server protocol designed to provide the four pieces of information for a diskless computer or a computer that is booted for the first time.

Successor to BOOTP and is backward compatible with it– Meaning that a host running the BOOTP client can request a

static configuration to a DHCP server

DHCP provides temporary IP addresses for a limited period of time

Page 6: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

66Kyung Hee University

18.2 DHCP Operation18.2 DHCP Operation

1. A client broadcasts a DHCPDISCOVER message using destination port 67

2. Servers respond with a DHCPOFFER message including an IP address

Offering the duration of the lease - default : one hour The server that sends a DHCPOFFER locks the offered IP

address so that it is not available to any other clients If the client receives no DHCPOFER message, it will try four

more times, each with a SPAN of two seconds. If there is no reply to any of these DHCPDISCOVERs, the

client sleeps for five minutes before trying again

3. The client chooses one of the offers and sends a HCPREQUEST message to the selected sever

Page 7: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

77Kyung Hee University

DHCP Operation (cont’)DHCP Operation (cont’)

4. The server responds with a DHCPACK message and creates the binding between the client physical address and its IP address

5. Before 50 percent of the lease period is reached, the client sends another DHCPREQUEST and asks for renewal

6. If the server responds with a DHCPACK, the client has a new lease agreement and can reset its timer. If the server responds with a DHCPNACK, the client must immediately stop using the IP address and find another server (step 1)

7. If the sever does not respond, the client sends another DHCPREQUEST when the lease time reaches 87.5 percent. If the client terminates the lease prematurely, the client sends a DHCPRELEASE message to the server.

Page 8: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

88Kyung Hee University

DHCP Operation (cont’)DHCP Operation (cont’)

Client and server on the same network

1. The DHCP server issues an active open command on UDP port number 67 and waits for a client

2. A booted client issues an active open command on port number 68.

3. The server responds with either a broadcast or a unicast message using UDP source port number 67 and destination port 68

Page 9: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

99Kyung Hee University

DHCP Operation (cont’)DHCP Operation (cont’)

Client and server on the same network

Page 10: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

1010Kyung Hee University

DHCP Operation (cont’)DHCP Operation (cont’)

Client and server on two different networks

DHCP request is broadcast because the client does not know the IP address of server

Broadcast IP datagram cannot pass through any router

To solve above problem, one of the hosts can be used as a relay, called relay agent.

Relay agent knows the unicast address of a DHCP server Listen for broadcast message on port 67

Page 11: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

1111Kyung Hee University

DHCP Operation (cont’)DHCP Operation (cont’)

Client and server on two different networks

Page 12: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

1212Kyung Hee University

DHCP Operation (cont’)DHCP Operation (cont’)

Use of UDP ports

Page 13: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

1313Kyung Hee University

DHCP Operation (cont’)DHCP Operation (cont’)

Error Control

DHCP uses UDP, which does not provide error control

Therefore, DHCP must provide error control.

DHCP requires that UDP uses the checksum.– Using of the checksum in UDP is optional

The DHCP client uses timers and a retransmission policy if it does not receive the DHCP reply to a request.

– DHCP forces the client to use a random number to set its timers

Page 14: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

1414Kyung Hee University

DHCP Operation (cont’)DHCP Operation (cont’)

Packet Format

To make DHCP backward compatible with BOOTP, it is only added a one-bit flag to the packet.

Extra options have been added to the option field

Flag :

Let client specify a forced broadcast reply from the server

Option :

several options are added – Ex) the value 53 for the tag subfield is used to define the type of

interaction between the client and server – MAX : 312 bytes

Page 15: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

1515Kyung Hee University

DHCP Operation (cont’)DHCP Operation (cont’)

Packet Format

Page 16: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

1616Kyung Hee University

DHCP Operation (cont’)DHCP Operation (cont’)

Flag format and optional format

Page 17: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

1717Kyung Hee University

DHCP Operation (cont’)DHCP Operation (cont’)

Options for DHCP

Page 18: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

1818Kyung Hee University

18.3 Configuration18.3 Configuration

The DHCP has been devised to provide static and dynamic address allocation

DHCP has two DBs

One for statically binding between physical address and IP address

The other one with a pool of available IP addresses When a DHCP client requests a temporary IP addresses, the DHCP

sever assigns an IP address from a pool for a negotiable period of time

When a DHCP client sends a request to a DHCP server– At first, checking its static database– If not , selecting an IP address from the available pool

Leasing

The DHCP server issues a lease for a specific period of time

When the lease expires, the client must either stop using the IP address or renew the lease

Page 19: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

1919Kyung Hee University

Configuration (cont’)Configuration (cont’)

Optional with tag 53

Page 20: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

2020Kyung Hee University

Configuration (cont’)Configuration (cont’)

DHCP client transition diagram

Page 21: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

2121Kyung Hee University

Configuration (cont’)Configuration (cont’)

DHCP client transition diagram

INIT state

First sate of client The client broadcasts a DHCPDISCOVER message

Selecting state

After sending DHCPDISCOVER message, the client goes to the selecting state.

Server respond with DHCPOFFER message including IP address

Requesting state

After receiving DHCPOFFER message, the client goes to the requesting state.

The client sends a DHCPREQUEST message to the server The client remains in the requesting state until it receives a

DHCPACK message from the server

Page 22: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

2222Kyung Hee University

Configuration (cont’)Configuration (cont’)

Bound state After receiving DHCPACK message, the client goes to the

bound state In this state, the client can use IP address until the lease

expires When 50 percent of the lease period is reached, the client

sends another DHCPREQUEST to ask for renewal and goes to renewing state

Renewing state If the client receive a DHCPACK, it resets its timer and goes

back to the bound state If a DHCPACK is not received, and 87.5 percent of the lease

time expires, the client goes to the rebinding state

Rebinding state If the client receive a DHCPNACK or the lease expires, it goes

back to the initializing state If the client receives a DHCPACK, it goes to the bound state

and resets the timers

Page 23: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

2323Kyung Hee University

Configuration (cont’)Configuration (cont’)

Exchanging message

Page 24: 1 Kyung Hee University Chapter 18 Host Configuration : DHCP

2424Kyung Hee University

SummarySummary

Every computer attached to a TCP/IP internet must know its IP address, the IP address of a router, the IP address of an name server, and its subnet mask. Dynamic Host Configuration Protocol (DHCP) is a client-server application that deliver vital network information to either diskless computers or computers at first boot

One DHCP packet format is used for both the client request and the server reply. The DHCP server waits passively for a client request. A server reply can be broadcast or unicast. A DHCP request or reply is encapsulated in a UDP user datagram.

When the DHCP client and server are on different networks, a relay agent is used to send local DHCP request from a client to remote servers

When DHCP acts as static configuration protocol, it uses a table that maps IP addresses to physical addresses. When DHCP acts as a dynamic configuration protocol, it leases IP addresses to the requesting clients.

DHCP client is designed as a state machine that uses six main states and three timers to allow a host to lease an IP address for a specified period time.