R1上:
[H3C]sysname DHCPServer
[DHCPServer]int s1/0
[DHCPServer-Serial1/0]ip address 12.1.1.1 255.255.255.0
[DHCPServer-Serial1/0]undo shu
[DHCPServer-Serial1/0]link-protocol ?
fr Frame Relay protocol
hdlc High-level Data Link Control protocol
ppp Point-to-Point protocol
stlp Synchronization Transparent Transport Link protocol
[DHCPServer-Serial1/0]link-protocol ppp
[DHCPServer-Serial1/0]exit
[DHCPServer]ip route-static 23.2.2.0 255.255.255.0 12.1.1.2
[DHCPServer]dhcp enable
[DHCPServer]dhcp server ip-pool wudi
[DHCPServer-dhcp-pool-wudi]network 23.2.2.0 mask 255.255.255.0
[DHCPServer-dhcp-pool-wudi]gateway-list 23.2.2.2
[DHCPServer-dhcp-pool-wudi]quit
[DHCPServer]save
R2上
<H3C>sys
System View: return to User View with Ctrl+Z.
[H3C]sysname DHCPRelay
[DHCPRelay]dhcp enable
[DHCPRelay]int s1/0
[DHCPRelay-Serial1/0]ip address 12.1.1.2 255.255.255.0
[DHCPRelay-Serial1/0]undo shu
[DHCPRelay-Serial1/0]qui
[DHCPRelay]int g0/0
[DHCPRelay-GigabitEthernet0/0]ip add 23.2.2.2 255.255.255.0
[DHCPRelay-GigabitEthernet0/0]undo shu
[DHCPRelay-GigabitEthernet0/0]dhcp select relay
[DHCPRelay-GigabitEthernet0/0]dhcp relay server-address 12.1.1.1
R3上
[H3C]sysname DHCPClient
[DHCPClient]int g0/0
[DHCPClient-GigabitEthernet0/0]ip add dhcp-alloc
验证:
R3
[DHCPClient]dis ip int b
*down: administratively down
(s): spoofing (l): loopback
Interface Physical Protocol IP Address Description
GE0/0 up up 23.2.2.1 --
GE0/1 down down -- --
GE0/2 down down -- --
GE5/0 down down -- --
GE5/1 down down -- --
GE6/0 down down -- --
GE6/1 down down -- --
Ser1/0 down down -- --
Ser2/0 down down -- --
Ser3/0 down down -- --
Ser4/0 down down -- --
[DHCPClient]dis dhcp client
GigabitEthernet0/0 DHCP client information:
Current state: BOUND
Allocated IP: 23.2.2.1 255.255.255.0
Allocated lease: 86400 seconds, T1: 38293 seconds, T2: 75600 seconds
DHCP server: 12.1.1.1
R1
[DHCPServer]dis dhcp server ip-in-use
IP address Client identifier/ Lease expiration Type
Hardware address
23.2.2.1 0033-3234-302e-3664- Jul 9 15:37:35 2015 Auto(C)
3234-2e30-3330-352d-
4745-302f-30
R1
[DHCPServer]ping 23.2.2.1
Ping 23.2.2.1 (23.2.2.1): 56 data bytes, press CTRL_C to break
56 bytes from 23.2.2.1: icmp_seq=0 ttl=254 time=2.211 ms
56 bytes from 23.2.2.1: icmp_seq=1 ttl=254 time=1.382 ms
56 bytes from 23.2.2.1: icmp_seq=2 ttl=254 time=2.971 ms
56 bytes from 23.2.2.1: icmp_seq=3 ttl=254 time=1.370 ms
56 bytes from 23.2.2.1: icmp_seq=4 ttl=254 time=1.787 ms
--- Ping statistics for 23.2.2.1 ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.370/1.944/2.971/0.599 ms