配置DHCP

2d4ae2963ab247cea2a24f2896de4fdf.jpg

 

要求:

1. DCHP server可以使用0/0/0接口DHCP进行分配ip

2. DCHP server可以使用0/0/1接口DHCP进行分配ip

3.各PC之间可以互通

思路:分别给路由器的接口0/0/0和0/0/1进行全局DHCP配置,在分别将pc用DHCP配置

 

配置

接口0/0/0

<Huawei>system-view 

Enter system view, return user view with Ctrl+Z.

[Huawei]sys    

[Huawei]sysname DHCP Server

[DHCP Server]interface GigabitEthernet 0/0/0  

[DHCP Server-GigabitEthernet0/0/0]ip address 192.168.1.254 24

Mar 12 2023 14:11:21-08:00 DHCP Server %%01IFNET/4/LINK_STATE(l)[2]:The line pro

tocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 

[DHCP Server-GigabitEthernet0/0/0]quit

[DHCP Server]dhcp enable 

Info: The operation may take a few seconds. Please wait for a moment.done.

[DHCP Server]ip policy-based-route

[DHCP Server]ip pool 111

Info: It's successful to create an IP address pool.

[DHCP Server-ip-pool-111]network 192.168.1.0 mask 24

[DHCP Server-ip-pool-111]gateway-list 192.168.1.254

[DHCP Server-ip-pool-111]dns-list 8.8.8.8 114.114.114.114  

[DHCP Server-ip-pool-111]quit 

[DHCP Server]interface GigabitEthernet 0/0/0

[DHCP Server-GigabitEthernet0/0/0]dhcp select global 

 

接口0/0/1:

[DHCP Server]interface GigabitEthernet 0/0/1

[DHCP Server-GigabitEthernet0/0/1]ip address 192.168.2.254 24

Mar 12 2023 14:17:00-08:00 DHCP Server %%01IFNET/4/LINK_STATE(l)[3]:The line pro

tocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. 

[DHCP Server-GigabitEthernet0/0/1]quit

[DHCP Server]dhcp enable    

[DHCP Server]ip policy-based-route

[DHCP Server]ip pool 222

Info: It's successful to create an IP address pool.

[DHCP Server-ip-pool-222]netbios-type

[DHCP Server-ip-pool-222]network 192.168.2.0 mask 24

[DHCP Server-ip-pool-222]gateway-list 192.168.2.254

[DHCP Server-ip-pool-222]dns-list 8.8.8.8 114.114.114.114  

[DHCP Server-ip-pool-222]quit 

[DHCP Server]interface GigabitEthernet 0/0/1

[DHCP Server-GigabitEthernet0/0/1]dhcp select global 

 

pc测试

pc1的IP

pc1        

PC>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fe9a:26c8
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.253
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.1.254
Physical address..................: 54-89-98-9A-26-C8
DNS server........................: 8.8.8.8
                                    114.114.114.114

 

pc1-pc2

PC>ping 192.168.1.252

Ping 192.168.1.252: 32 data bytes, Press Ctrl_C to break

From 192.168.1.252: bytes=32 seq=1 ttl=128 time=47 ms

From 192.168.1.252: bytes=32 seq=2 ttl=128 time=31 ms

From 192.168.1.252: bytes=32 seq=3 ttl=128 time=47 ms

From 192.168.1.252: bytes=32 seq=4 ttl=128 time=31 ms

From 192.168.1.252: bytes=32 seq=5 ttl=128 time=47 ms

--- 192.168.1.252 ping statistics ---

  5 packet(s) transmitted

  5 packet(s) received

  0.00% packet loss

  round-trip min/avg/max = 31/40/47 ms

 

pc1-pc3

PC>ping 192.168.2.2532

host 192.168.2.2532 unreachable

PC>ping 192.168.2.253

Ping 192.168.2.253: 32 data bytes, Press Ctrl_C to break

From 192.168.2.253: bytes=32 seq=1 ttl=127 time=62 ms

From 192.168.2.253: bytes=32 seq=2 ttl=127 time=47 ms

From 192.168.2.253: bytes=32 seq=3 ttl=127 time=63 ms

From 192.168.2.253: bytes=32 seq=4 ttl=127 time=62 ms

From 192.168.2.253: bytes=32 seq=5 ttl=127 time=63 ms

--- 192.168.2.253 ping statistics ---

  5 packet(s) transmitted

  5 packet(s) received

  0.00% packet loss

  round-trip min/avg/max = 47/59/63 ms

 

pc1-pc4

PC>ping 192.168.2.252

Ping 192.168.2.252: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.252: bytes=32 seq=2 ttl=127 time=78 ms
From 192.168.2.252: bytes=32 seq=3 ttl=127 time=62 ms
From 192.168.2.252: bytes=32 seq=4 ttl=127 time=79 ms
From 192.168.2.252: bytes=32 seq=5 ttl=127 time=78 ms

--- 192.168.2.252 ping statistics ---
  5 packet(s) transmitted
  4 packet(s) received
  20.00% packet loss
  round-trip min/avg/max = 0/74/79 ms
 

pc1-路由器接口

pc1-0/0/0

PC>ping 192.168.1.254

Ping 192.168.1.254: 32 data bytes, Press Ctrl_C to break

From 192.168.1.254: bytes=32 seq=1 ttl=255 time=31 ms

From 192.168.1.254: bytes=32 seq=2 ttl=255 time=32 ms

From 192.168.1.254: bytes=32 seq=3 ttl=255 time=46 ms

From 192.168.1.254: bytes=32 seq=4 ttl=255 time=32 ms

From 192.168.1.254: bytes=32 seq=5 ttl=255 time=47 ms

--- 192.168.1.254 ping statistics ---

  5 packet(s) transmitted

  5 packet(s) received

  0.00% packet loss

  round-trip min/avg/max = 31/37/47 ms

pc1·-0/0/1

PC>ping 192.168.2.254

Ping 192.168.2.254: 32 data bytes, Press Ctrl_C to break
From 192.168.2.254: bytes=32 seq=1 ttl=255 time=32 ms
From 192.168.2.254: bytes=32 seq=2 ttl=255 time=31 ms
From 192.168.2.254: bytes=32 seq=3 ttl=255 time=47 ms
From 192.168.2.254: bytes=32 seq=4 ttl=255 time=47 ms
From 192.168.2.254: bytes=32 seq=5 ttl=255 time=31 ms

--- 192.168.2.254 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 31/37/47 ms

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值