Dynamic Host Configuration Protocol (DHCP) - ECE Users Pages

118 downloads 88 Views 197KB Size Report
Dynamic Host Configuration Protocol (DHCP). DHCP provides a temporary IP address for a limited period of time. DHCP has two databases. First one has static  ...
Dynamic Host Configuration Protocol (DHCP) DHCP provides a temporary IP address for a limited period of time DHCP has two databases. First one has static bindings for physical addresses (MAC) with IP addresses. Second one has a list of available IP addresses that may be assigned for a period of time. Client request to DHCP server causes server to see if MAC is in static database. If so assign the static IP entry to client. If not, choose from available pool. Assigned addresses are temporary (leased). When client’s lease expires, must renew or stop using.

Source: TCP/IP Protocol Suite by Forouzan, Chapter 16 For additional information see: http://www.dhcp.org/

Figure 16.8: Part I

Exchanging messages

Figure 16.8: Part II

Exchanging messages

DHCP Operation 1.

Client broadcasts on 255.255.255.255 a DHCPDISCOVER message using destination server port 67.

2.

Server(s) respond with DHCPOFFER message. Contains IP address, duration of lease which by default is one hour.If client does not receive a DHCPOFFER, attempts again up to 4 more attempts in two second intervals, then waits 5 minutes to try again.

3.

Client chooses one of the offers and sends DHCPREQUEST to the selected server.

4.

Server responds with DHCPACK and creates a binding between MAC address and the IP address offered. Client has rights to that IP address until lease expires.

5.

At the 50% of lease period expiration time, client sends a DHCPREQUEST to request renewal.

6.

If server responds with DHCPACK, client is good to go and resets client timer. If server denies request with DHCPNACK, client must immediately stop using that IP address and try to find another server.

7.

If no server responds with anything in step 6, client sends another DHCPREQUEST at 87.5% time of the original lease.

8.

If no server response, client uses IP until lease time expires and then starts from scratch. Client sends DHCPRELEASE message to the mean server.

Aside: Server cannot initiate early lease termination unless client sends a DHCPREQUEST.

Figure 16.7

DHCP transition diagram

DHCP Packet Details Operation Code: One byte field defines type of DHCP packet: Request = 1, Reply = 2 Hardware Type: One byte field defining physical network: Ethernet = 1 Hardware Length: One byte field specifying length of physical address: Ethernet = 6 Hop Count: One byte field maximum hops packet can go. Client sets this to 0 Transaction ID: Four Byte field used by client to make sure server is talking to this client and not another simultaneous request’s response Number of seconds: two byte field number of seconds since client became alive Flag: One bit flag allows client to force server to broadcast reply instead of sending reply to a specific IP address. If client does not know its IP address yet, it wants a broadcast reply from server. Client IP address: Four byte field of client’s IP address. If unknown is zero. Your IP address: Four byte field server fills in to tell client the clients IP address Server IP address: four byte field. Server responding fills in it’s own IP Gateway IP Address: Four byte field containing IP address of router (filled in by server) Client Hardware Address: In our case 6 byte Ethernet MAC of client sending. Can get this from Ethernet frame source MAC but this makes life easy for lazy server

DHCP Packet Continued Server Name: Optional 64 byte field filled in by server contains the domain name of the server Boot File Name: Optional 128 byte field filled in by server containing full pathname for boot file when legacy BOOTP protocol is being used instead of DHCP. DHCP is backward compatible with BOOTP (Aside: Bootstrap Protocol provides IP address, subnet mask, IP address of a router, IP address of a name server to a diskless computer). Option: Optional 64 byte field. Options consist of three fields: One byte Tag field, One byte length field for just this particular option, a variable length value field. Tag

Length

For example: Tag Length 53 1 53 1 53 1 53 1 53 1 53 1 53 1

Value

Value 1 2 3 4 5 6 7

DHCPDISCOVER DHCPOFFER DHCPREQUEST DHCPDECLINE DHCPACK DHCPNACK DHCPRELEASE

A few more important options values: Tag

Name

Length value

Meaning

0

Pad

0

None

1

Subnet Mask

4

Subnet Mask Value

3

Gateways

N

N/4 Different Gateway addresses

6

Domain Server

N

N/4 Different DNS Server addresses

0

None

255 End

Suggest Documents