Professional Documents
Culture Documents
Huawei CLI
When PCs are in a different subnet than a DHCP server installed, DHCP Relay Agent can be
used to forward DHCP requests from PCs to DHCP server. How to configure DHCP Relay
Agent using Huawei CLI?
We want our PC to acquire its IP address from the DHCP server configured on the labnarioR1
router. To do so, labnarioR2 should be configured as a DHCP Relay Agent to forward DHCP
Requests and Offers between server and clients.
First, DHCP server should be configured. LabnarioR1 router will be configured to offer
DHCP service for PC.
<labnarioR1>system-view
Enter system view, return user view with Ctrl+Z.
[labnarioR1] dhcp enable
[labnarioR1] ip pool 1
[labnarioR1-ip-pool-1] gateway-list 172.16.1.1
[labnarioR1-ip-pool-1] network 172.16.1.0 mask 255.255.255.0
[labnarioR1-ip-pool-1] dns-list 150.100.15.1 150.100.15.2
[labnarioR1-ip-pool-1] domain-name labnario.com
[labnarioR1-ip-pool-1] quit
[labnarioR1]interface Ethernet0/0/0
[labnarioR1-Ethernet0/0/0]dhcp select global
If we want our labnarioR1 router to be able to forward DHCP packets to the PC, static route
pointing labnarioR2 should be added:
Now labnarioR2 router can be configured to act as a DHCP Relay Agent for 172.16.1.0/24
subnet. Do not forget to enable DHCP service! This step is required on both DHCP Server
and Relay.
[labnarioR2]dhcp enable
[labnarioR2-dhcp-server-group-1]quit
[labnarioR2]interface Ethernet0/0/1
[labnarioR2-Ethernet0/0/1] dhcp select relay
[labnarioR2-Ethernet0/0/1] dhcp relay server-ip 150.100.12.1
Lets check if our PC can acquire IP address:
PC>ipconfig -r
Discover...
Request...
IP: 172.16.1.254
Subnet Mask: 255.255.255.0
Gateway: 172.16.1.1
PC>ipconfig
As you see above, there are DHCP Request and Offer counters, which can be helpful during
DHCP troubleshooting.
Look at the debugging output. It shows packet exchange between DHCP client and server.
Great commands when troubleshooting DHCP Relay Agent.
<labnarioR2>
Jan 24 2013 15:45:52.710.1-08:00 labnarioR2 DHCP/7/DEBUG:[dhcpr-
pkt]:Receives DH
CP DISCOVER message from interface Ethernet0/0/1.(sip:0.0.0.0,
dip:255.255.255.2
55, vpn:0)
Jan 24 2013 15:45:52.710.2-08:00 labnarioR2 DHCP/7/DEBUG:[dhcpr-pkt]:Relay
packe
t to server 150.100.12.1.
Jan 24 2013 15:45:52.740.2-08:00 labnarioR2 DHCP/7/DEBUG:[dhcpr-
pkt]:Receives DH
CP OFFER message from interface Ethernet0/0/0.(sip:150.100.12.1,
dip:172.16.1.1,
vpn:0)
Jan 24 2013 15:45:52.740.3-08:00 labnarioR2 DHCP/7/DEBUG:[dhcpr-
pkt]:Unicast DHC
P OFFER to client. (Chaddr=000b-09cf-eb58, Ciaddr=172.16.1.254)
Jan 24 2013 15:45:55.200.1-08:00 labnarioR2 DHCP/7/DEBUG:[dhcpr-
pkt]:Receives DH
CP REQUEST message from interface Ethernet0/0/1.(sip:0.0.0.0,
dip:255.255.255.25
5, vpn:0)
Jan 24 2013 15:45:55.200.2-08:00 labnarioR2 DHCP/7/DEBUG:[dhcpr-pkt]:Relay
packe
t to server 150.100.12.1.
Jan 24 2013 15:45:55.210.3-08:00 labnarioR2 DHCP/7/DEBUG:[dhcpr-
pkt]:Receives DH
CP ACK message from interface Ethernet0/0/0.(sip:150.100.12.1,
dip:172.16.1.1, v
pn:0)
Jan 24 2013 15:45:55.210.4-08:00 labnarioR2 DHCP/7/DEBUG:[dhcpr-
pkt]:Unicast DHC
P ACK to client. (Chaddr=000b-09cf-eb58, Ciaddr=172.16.1.254)
Some time ago I wrote about DHCP configuration. Just go to Huawei AR19/29/49 router
DHCP configuration to read more.
Final configuration:
sysname labnarioR1
#
dhcp enable
#
ip pool 1
gateway-list 172.16.1.1
network 172.16.1.0 mask 255.255.255.0
dns-list 150.100.15.1 150.100.15.2
domain-name labnario.com
#
interface Ethernet0/0/0
ip address 150.100.12.1 255.255.255.0
dhcp select global
#
ip route-static 172.16.1.0 255.255.255.0 150.100.12.2
#
return
sysname labnarioR2
#
dhcp enable
#
interface Ethernet0/0/1
ip address 172.16.1.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 150.100.12.1
#
return