IP/Network

 

 

 

 

DHCP IPv4

 

DHCP stands for Dynamic Host Configuration Protocol. For almost every data communication we commonly do with PC or Smartphone, they are all based on IP (Internet Protocol). For all IP communication, the first requirement is every device should get a specific IP address. Even until several years ago, most of these IP allocation was done manually. It means they put a specific IP (we call it static IP) into a configuration window. However, you see this process done automatically in the background. How this IP can automatically assigned ? For this automatic IP allocation, the industry came up with special protocol designed for automatic IP allocation. One of this specific IP allocation protocol is DHCP. Since we have two different types of IP, IPv4 and IPv6. We have two different type of DHCP. When we say just 'DHCP', it usually mean 'DHCP for IPv4'. In case of IPv6, we call it DHCPv6. This page is only for DHCP for IPv4. I will write separate page for IPv6.

 

 

Direction

Message

1

Device --> DHCP Server

DHCP Discover

2

Device <-- DHCP Server

DHCP Offer

3

Device --> DHCP Server

DHCP Request

4

Device <-- DHCP Server

DHCP Ack

 

 

(1) DHCP Discover

    Bootstrap Protocol (Discover)

        Message type: Boot Request (1)

        Hardware type: Ethernet (0x01)

        Hardware address length: 6

        Hops: 0

        Transaction ID: 0xff18ecc3

        Seconds elapsed: 1

        Bootp flags: 0x0000 (Unicast)

            0... .... .... .... = Broadcast flag: Unicast

            .000 0000 0000 0000 = Reserved flags: 0x0000

        Client IP address: 0.0.0.0 (0.0.0.0)

        Your (client) IP address: 0.0.0.0 (0.0.0.0)

        Next server IP address: 0.0.0.0 (0.0.0.0)

        Relay agent IP address: 0.0.0.0 (0.0.0.0)

        Client MAC address: aa:bb:cc:dd:ee:ff

        Client hardware address padding: 00000000000000000000

        Server host name not given

        Boot file name not given

        Magic cookie: DHCP

        Option: (53) DHCP Message Type (Discover)

            Length: 1

            DHCP: Discover (1)

        Option: (61) Client identifier

            Length: 7

            Hardware type: Ethernet (0x01)

            Client MAC address: aa:bb:cc:dd:ee:ff

        Option: (57) Maximum DHCP Message Size

            Length: 2

            Maximum DHCP Message Size: 1500

        Option: (60) Vendor class identifier

            Length: 12

            Vendor class identifier: dhcpcd-5.5.6

        Option: (12) Host Name

            Length: 24

            Host Name: android-21b08ec0480ae8b6

        Option: (55) Parameter Request List

            Length: 10

            Parameter Request List Item: (1) Subnet Mask

            Parameter Request List Item: (33) Static Route

            Parameter Request List Item: (3) Router

            Parameter Request List Item: (6) Domain Name Server

            Parameter Request List Item: (15) Domain Name

            Parameter Request List Item: (26) Interface MTU

            Parameter Request List Item: (28) Broadcast Address

            Parameter Request List Item: (51) IP Address Lease Time

            Parameter Request List Item: (58) Renewal Time Value

            Parameter Request List Item: (59) Rebinding Time Value

        Option: (255) End

            Option End: 255

 

 

(2) DHCP Offer

    Bootstrap Protocol (Offer)

        Message type: Boot Reply (2)

        Hardware type: Ethernet (0x01)

        Hardware address length: 6

        Hops: 0

        Transaction ID: 0xff18ecc3

        Seconds elapsed: 1

        Bootp flags: 0x0000 (Unicast)

            0... .... .... .... = Broadcast flag: Unicast

            .000 0000 0000 0000 = Reserved flags: 0x0000

        Client IP address: 0.0.0.0 (0.0.0.0)

        Your (client) IP address: 192.168.0.1 (192.168.0.1)

        Next server IP address: 192.168.0.254 (192.168.0.254)

        Relay agent IP address: 0.0.0.0 (0.0.0.0)

        Client MAC address: aa:bb:cc:dd:ee:ff

        Client hardware address padding: 00000000000000000000

        Server host name not given

        Boot file name not given

        Magic cookie: DHCP

        Option: (53) DHCP Message Type (Offer)

            Length: 1

            DHCP: Offer (2)

        Option: (54) DHCP Server Identifier

            Length: 4

            DHCP Server Identifier: 192.168.0.254 (192.168.0.254)

        Option: (51) IP Address Lease Time

            Length: 4

            IP Address Lease Time: (3600s) 1 hour

        Option: (58) Renewal Time Value

            Length: 4

            Renewal Time Value: (1800s) 30 minutes

        Option: (59) Rebinding Time Value

            Length: 4

            Rebinding Time Value: (3200s) 53 minutes, 20 seconds

        Option: (1) Subnet Mask

            Length: 4

            Subnet Mask: 255.255.255.0 (255.255.255.0)

        Option: (28) Broadcast Address

            Length: 4

            Broadcast Address: 192.168.0.255 (192.168.0.255)

        Option: (6) Domain Name Server

            Length: 4

            Domain Name Server: 192.168.0.254 (192.168.0.254)

        Option: (255) End

            Option End: 255

        Padding

 

 

(3) DHCP Request

    Bootstrap Protocol (Request)

        Message type: Boot Request (1)

        Hardware type: Ethernet (0x01)

        Hardware address length: 6

        Hops: 0

        Transaction ID: 0xff18ecc3

        Seconds elapsed: 1

        Bootp flags: 0x0000 (Unicast)

            0... .... .... .... = Broadcast flag: Unicast

            .000 0000 0000 0000 = Reserved flags: 0x0000

        Client IP address: 0.0.0.0 (0.0.0.0)

        Your (client) IP address: 0.0.0.0 (0.0.0.0)

        Next server IP address: 0.0.0.0 (0.0.0.0)

        Relay agent IP address: 0.0.0.0 (0.0.0.0)

        Client MAC address: aa:bb:cc:dd:ee:ff

        Client hardware address padding: 00000000000000000000

        Server host name not given

        Boot file name not given

        Magic cookie: DHCP

        Option: (53) DHCP Message Type (Request)

            Length: 1

            DHCP: Request (3)

        Option: (61) Client identifier

            Length: 7

            Hardware type: Ethernet (0x01)

            Client MAC address: aa:bb:cc:dd:ee:ff

        Option: (50) Requested IP Address

            Length: 4

            Requested IP Address: 192.168.0.1 (192.168.0.1)

        Option: (54) DHCP Server Identifier

            Length: 4

            DHCP Server Identifier: 192.168.0.254 (192.168.0.254)

        Option: (57) Maximum DHCP Message Size

            Length: 2

            Maximum DHCP Message Size: 1500

        Option: (60) Vendor class identifier

            Length: 12

            Vendor class identifier: dhcpcd-5.5.6

        Option: (12) Host Name

            Length: 24

            Host Name: android-21b08ec0480ae8b6

        Option: (55) Parameter Request List

            Length: 10

            Parameter Request List Item: (1) Subnet Mask

            Parameter Request List Item: (33) Static Route

            Parameter Request List Item: (3) Router

            Parameter Request List Item: (6) Domain Name Server

            Parameter Request List Item: (15) Domain Name

            Parameter Request List Item: (26) Interface MTU

            Parameter Request List Item: (28) Broadcast Address

            Parameter Request List Item: (51) IP Address Lease Time

            Parameter Request List Item: (58) Renewal Time Value

            Parameter Request List Item: (59) Rebinding Time Value

        Option: (255) End

            Option End: 255

 

 

(4) DHCP Ack

    Bootstrap Protocol (ACK)

        Message type: Boot Reply (2)

        Hardware type: Ethernet (0x01)

        Hardware address length: 6

        Hops: 0

        Transaction ID: 0xff18ecc3

        Seconds elapsed: 1

        Bootp flags: 0x0000 (Unicast)

            0... .... .... .... = Broadcast flag: Unicast

            .000 0000 0000 0000 = Reserved flags: 0x0000

        Client IP address: 0.0.0.0 (0.0.0.0)

        Your (client) IP address: 192.168.0.1 (192.168.0.1)

        Next server IP address: 192.168.0.254 (192.168.0.254)

        Relay agent IP address: 0.0.0.0 (0.0.0.0)

        Client MAC address: aa:bb:cc:dd:ee:ff

        Client hardware address padding: 00000000000000000000

        Server host name not given

        Boot file name not given

        Magic cookie: DHCP

        Option: (53) DHCP Message Type (ACK)

            Length: 1

            DHCP: ACK (5)

        Option: (54) DHCP Server Identifier

            Length: 4

            DHCP Server Identifier: 192.168.0.254 (192.168.0.254)

        Option: (51) IP Address Lease Time

            Length: 4

            IP Address Lease Time: (3600s) 1 hour

        Option: (58) Renewal Time Value

            Length: 4

            Renewal Time Value: (1800s) 30 minutes

        Option: (59) Rebinding Time Value

            Length: 4

            Rebinding Time Value: (3200s) 53 minutes, 20 seconds

        Option: (1) Subnet Mask

            Length: 4

            Subnet Mask: 255.255.255.0 (255.255.255.0)

        Option: (28) Broadcast Address

            Length: 4

            Broadcast Address: 192.168.0.255 (192.168.0.255)

        Option: (6) Domain Name Server

            Length: 4

            Domain Name Server: 192.168.0.254 (192.168.0.254)

        Option: (255) End

            Option End: 255

        Padding