要求
1.全网IP地址为192.168.1.0 24
2.所有IP通过DCHP获取地址
3.全网可达
分析
1.子网划分
2.DCHP配置
3.ping全网可达
1.路由器接口IP配置,dchp建立,接口dchp启用。
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.1 25
[Huawei-GigabitEthernet0/0/0]dhcp enable
[Huawei]ip pool 1
[Huawei-ip-pool-1]network 192.168.1.0 mask 25
[Huawei-ip-pool-1]gateway-list 192.168.1.1
[Huawei-ip-pool-1]dns-list 8.8.8.8
[Huawei-ip-pool-1]q
[Huawei]display ip pool name 1
Pool-name : 1
Pool-No : 0
Lease : 1 Days 0 Hours 0 Minutes
Domain-name : -
DNS-server0 : 8.8.8.8
NBNS-server0 : -
Netbios-type : -
Position : Local Status : Unlocked
Gateway-0 : 192.168.1.1
Mask : 255.255.255.128
VPN instance : --
-----------------------------------------------------------------------------
Start End Total Used Idle(Expired) Conflict Disable
-----------------------------------------------------------------------------
192.168.1.1 192.168.1.126 125 0 125(0) 0 0
-----------------------------------------------------------------------------
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]dhcp select global
[Huawei-GigabitEthernet0/0/0]q
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.128.1 25
[Huawei-GigabitEthernet0/0/1]q
[Huawei]ip pool 2
[Huawei-ip-pool-2]gateway-list 192.168.128.1
[Huawei-ip-pool-2]dns-list 8.8.8.8
[Huawei-ip-pool-2]q
[Huawei]display ip pool
-----------------------------------------------------------------------
Pool-name : 1
Pool-No : 0
Position : Local Status : Unlocked
Gateway-0 : 192.168.1.1
Mask : 255.255.255.128
VPN instance : --
-----------------------------------------------------------------------
Pool-name : 2
Pool-No : 1
Position : Local Status : Unlocked
Gateway-0 : 192.168.128.1
Mask : 255.255.255.128
VPN instance : --
IP address Statistic
Total :250
Used :0 Idle :250
Expired :0 Conflict :0 Disable :0
[Huawei]inter
[Huawei]interface g
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]dhcp select global
[Huawei-GigabitEthernet0/0/1]q
<Huawei>dis i poo
-----------------------------------------------------------------------
Pool-name : 1
Pool-No : 0
Position : Local Status : Unlocked
Gateway-0 : 192.168.1.1
Mask : 255.255.255.128
VPN instance : --
-----------------------------------------------------------------------
Pool-name : 2
Pool-No : 1
Position : Local Status : Unlocked
Gateway-0 : 192.168.128.1
Mask : 255.255.255.128
VPN instance : --
IP address Statistic
Total :250
Used :4 Idle :246
Expired :0 Conflict :0 Disable :0
3.结果全网可达:四个电脑ping网关
pc1
```bash
ping 192.168.1.1
Ping 192.168.1.1: 32 data bytes, Press Ctrl_C to break
From 192.168.1.1: bytes=32 seq=1 ttl=255 time=31 ms
From 192.168.1.1: bytes=32 seq=2 ttl=255 time=47 ms
From 192.168.1.1: bytes=32 seq=3 ttl=255 time=31 ms
From 192.168.1.1: bytes=32 seq=4 ttl=255 time=31 ms
From 192.168.1.1: bytes=32 seq=5 ttl=255 time=32 ms
--- 192.168.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/34/47 ms
pc2
ping 192.168.1.1
Ping 192.168.1.1: 32 data bytes, Press Ctrl_C to break
From 192.168.1.1: bytes=32 seq=1 ttl=255 time=31 ms
From 192.168.1.1: bytes=32 seq=2 ttl=255 time=32 ms
From 192.168.1.1: bytes=32 seq=3 ttl=255 time=31 ms
From 192.168.1.1: bytes=32 seq=4 ttl=255 time=47 ms
From 192.168.1.1: bytes=32 seq=5 ttl=255 time=31 ms
--- 192.168.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/34/47 ms
pc3在这里插入代码片
ping 192.168.128.1
Ping 192.168.128.1: 32 data bytes, Press Ctrl_C to break
From 192.168.128.1: bytes=32 seq=1 ttl=255 time=31 ms
From 192.168.128.1: bytes=32 seq=2 ttl=255 time=32 ms
From 192.168.128.1: bytes=32 seq=3 ttl=255 time=47 ms
From 192.168.128.1: bytes=32 seq=4 ttl=255 time=31 ms
From 192.168.128.1: bytes=32 seq=5 ttl=255 time=15 ms
--- 192.168.128.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/31/47 ms
pc4
ping 192.168.128.1
Ping 192.168.128.1: 32 data bytes, Press Ctrl_C to break
From 192.168.128.1: bytes=32 seq=1 ttl=255 time=31 ms
From 192.168.128.1: bytes=32 seq=2 ttl=255 time=32 ms
From 192.168.128.1: bytes=32 seq=3 ttl=255 time=47 ms
From 192.168.128.1: bytes=32 seq=4 ttl=255 time=31 ms
From 192.168.128.1: bytes=32 seq=5 ttl=255 time=15 ms
--- 192.168.128.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/31/47 ms