IP Technology Basics · Topic 2 of 5

ICMP and DHCP

Learn ICMP types, ping and tracert, the four-step DHCP exchange, leases and renewal, and DHCP global and interface pools on Huawei VRP for HCIA-Datacom.

  • 6 min
  • Includes a diagram
In a nutshell
  • ICMP types: 0 Echo Reply, 3 Destination Unreachable, 5 Redirect, 8 Echo Request, 11 Time Exceeded.
  • tracert works by raising the TTL one hop at a time and reading Time Exceeded replies.
  • DHCP order is Discover, Offer, Request, ACK, and the server uses UDP 67, the client UDP 68.

What it is

ICMP (Internet Control Message Protocol) carries error reports and test messages for IP. It sits inside an IP packet with Protocol value 1, and it is what the ping and tracert tools use.

DHCP (Dynamic Host Configuration Protocol) gives hosts an IP address, mask, gateway and DNS server automatically. It runs over UDP, with the server on port 67 and the client on port 68.

Clientno addressDiscoverbroadcastOfferfrom serverRequestbroadcastACKaddress leased

How it works

ICMP message types

TypeNameWhen it is sent
0Echo ReplyAnswer to a ping
3Destination UnreachableNetwork, host, protocol or port cannot be reached
5RedirectA better next hop exists on the same segment
8Echo RequestSent by ping
11Time ExceededTTL reached 0, or fragment reassembly timed out

A type is refined by a code. For example, type 3 code 3 means port unreachable.

Ping and tracert

ping sends Echo Requests and waits for Echo Replies. A reply proves two way reachability at the IP layer.

<Huawei> ping 10.0.12.2
  PING 10.0.12.2: 56  data bytes, press CTRL_C to break
    Reply from 10.0.12.2: bytes=56 Sequence=1 ttl=255 time=30 ms

Useful options are -c (number of packets, default 5), -s (packet size) and -a (source address). For example, ping -a 1.1.1.1 -c 10 10.0.12.2.

tracert finds the path. It sends probes with TTL 1, then 2, then 3, and so on. Each router that drops a probe with TTL 0 returns an ICMP Time Exceeded, which reveals that hop. The destination returns ICMP Port Unreachable, because the UDP probes use high ports that nothing listens on.

Probe TTL 1Router 1Time ExceededProbe TTL 2Router 2Time ExceededProbe reaches hostPort Unreachable

The DHCP exchange

DHCP exchange: the client broadcasts a Discover, the server sends an Offer, the client broadcasts a Request, and the server confirms the lease with an ACK.

MessageSenderSent asPurpose
DHCP DiscoverClientBroadcastFind any server
DHCP OfferServerUnicast or broadcastOffer an address and options
DHCP RequestClientBroadcastAccept one offer, so other servers withdraw theirs
DHCP ACKServerUnicast or broadcastConfirm the lease

Other messages: DHCP NAK (server refuses the request), DHCP Decline (client found the address already in use), DHCP Release (client gives the address back) and DHCP Inform (client has an address and wants only options).

Lease and renewal

Every address is leased for a time. The Huawei default lease is 1 day.

Point in the leaseClient action
50% (T1)Unicast DHCP Request to the server that gave the lease
87.5% (T2)Broadcast DHCP Request to any server, if T1 renewal failed
100%Stops using the address and starts again with Discover

DHCP relay

Discover is a broadcast, so it does not cross a router. A DHCP relay on the gateway receives the broadcast and forwards it as unicast to a server in another network.

[Huawei] dhcp enable
[Huawei] interface GigabitEthernet0/0/1
[Huawei-GigabitEthernet0/0/1] dhcp select relay
[Huawei-GigabitEthernet0/0/1] dhcp relay server-ip 10.1.1.100

Configuring a DHCP server

DHCP is off by default, so first run dhcp enable. VRP offers two kinds of pool.

Global address pool. Created in system view and used by any interface with dhcp select global.

[Huawei] dhcp enable
[Huawei] ip pool pool1
[Huawei-ip-pool-pool1] network 192.168.1.0 mask 255.255.255.0
[Huawei-ip-pool-pool1] gateway-list 192.168.1.254
[Huawei-ip-pool-pool1] dns-list 8.8.8.8
[Huawei-ip-pool-pool1] excluded-ip-address 192.168.1.250 192.168.1.253
[Huawei-ip-pool-pool1] lease day 2
[Huawei-ip-pool-pool1] quit
[Huawei] interface GigabitEthernet0/0/1
[Huawei-GigabitEthernet0/0/1] dhcp select global

Interface address pool. The pool is the subnet of the interface address, and the interface address becomes the gateway.

[Huawei] interface GigabitEthernet0/0/2
[Huawei-GigabitEthernet0/0/2] ip address 192.168.2.254 24
[Huawei-GigabitEthernet0/0/2] dhcp select interface
[Huawei-GigabitEthernet0/0/2] dhcp server dns-list 8.8.8.8

Check pools and allocations with display ip pool. A VRP interface can also be a DHCP client with ip address dhcp-alloc.

A worked example

PCs on GigabitEthernet0/0/1 get no address. The pool pool1 exists and is correct, but the interface has no dhcp select global, so the router ignores the Discover messages.

After adding the command, a PC sends Discover, gets an Offer, broadcasts Request and gets ACK. display ip pool name pool1 now shows one address in use.

How the exam asks about this

  • "Which DHCP message does a client broadcast to accept an offer?" → DHCP Request.
  • "At what point in the lease does a DHCP client first try to renew?" → At 50% (T1), with a unicast Request to its server.
  • "Which ICMP type does a router return when a packet's TTL reaches 0?" → Type 11, Time Exceeded.

What to remember for the exam

  • ICMP types: 0 Echo Reply, 3 Destination Unreachable, 5 Redirect, 8 Echo Request, 11 Time Exceeded.
  • tracert works by raising the TTL one hop at a time and reading Time Exceeded replies.
  • DHCP order is Discover, Offer, Request, ACK, and the server uses UDP 67, the client UDP 68.
  • Renewal is at 50% (unicast) and 87.5% (broadcast), and the Huawei default lease is 1 day.
  • dhcp enable first, then dhcp select global for a global pool or dhcp select interface for an interface pool.
Watch out

The DHCP Request in the first exchange is a broadcast, not a unicast. It tells every server which offer the client accepted.

Common mistakes

Forgetting dhcp enable. A pool can be fully configured and still do nothing. The DHCP function must be enabled globally first.

Assuming DHCP crosses routers. Discover is a broadcast and stays in its broadcast domain. A server in another network needs a DHCP relay on the gateway.

Mixing up ping replies and tracert replies. Ping relies on Echo Request and Echo Reply. Tracert reveals intermediate hops from Time Exceeded messages.

Check yourself

  • Which DHCP message does a client send when it finds the offered address is already used?

    DHCP Decline. The client then starts again by sending a new Discover.

  • What does the -a option of the VRP ping command set?

    The source IP address of the Echo Request, for example a loopback address.

  • Which command makes an interface hand out addresses from its own subnet?

    dhcp select interface, entered in the interface view after dhcp enable.

Topic 2 of 5 in IP Technology Basics

Test yourself on IP Technology Basics

The full Huawei HCIA-Datacom H12-811 question bank has 600 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Huawei. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.