练习图:
要求:
1.全网用192.168.1.0/24进行IP地址分配、
2.R11作为DHCP服务器为PC分配IP地址
3.路由上均具备2个环回地址
4.R10和R11之间正常走1000M,备份走100M
5.全网尽量负载均衡
6.减少路由表数量,并避免环路产生
7.全网可达
1.全网用192.168.1.0/24进行IP地址分配:
由图可知划分16个网段
分别为:
192.168.1.0/28----HDCP到交换机
192.168.1.16/28----1000M
192.168.1.32/28----100M
192.168.1.48/28----R7-R10
192.168.1.64/28----R9-R10
192.168.1.80/28----R8-R7
192.168.1.96/28----R8-R9
192.168.1.112/28
192.168.1.128/28
192.168.1.144/28
192.168.1.160/28
192.168.1.176/28
192.168.1.192/28
192.168.1.208/28
192.168.1.224/28
192.168.1.240/28
2.R11作为DHCP服务器为PC分配IP地址
[Huawei]sys DHCP
[DHCP]inter
[DHCP]interface Giga
[DHCP]interface GigabitEthernet 0/0/2
[DHCP-GigabitEthernet0/0/2]ip addre
[DHCP-GigabitEthernet0/0/2]ip address 192.168.1.0 28
Error: The specified IP address is invalid.
[DHCP-GigabitEthernet0/0/2]192.168.1.1 28
^
Error: Unrecognized command found at '^' position.
[DHCP-GigabitEthernet0/0/2]ip address 192.168.1.1 28
Oct 21 2023 16:34:05-08:00 DHCP %%01IFNET/4/LINK_STATE(l)[3]:The line protocol I
P on the interface GigabitEthernet0/0/2 has entered the UP state.
[DHCP-GigabitEthernet0/0/2]quit
[DHCP]dhc
[DHCP]dhcp ena
[DHCP]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[DHCP]ip pool aa
Info: It's successful to create an IP address pool.
[DHCP-ip-pool-aa]netw
[DHCP-ip-pool-aa]network 192.168.1.0 mask 28
[DHCP-ip-pool-aa]gate
[DHCP-ip-pool-aa]gateway-list 192.168.1.1
[DHCP-ip-pool-aa]dns
[DHCP-ip-pool-aa]dns-list 8.8.8.8
[DHCP-ip-pool-aa]quit
[DHCP]int
[DHCP]interface Giga
[DHCP]interface GigabitEthernet 0/0/2
[DHCP-GigabitEthernet0/0/2]dhcp sel
[DHCP-GigabitEthernet0/0/2]dhcp select hlo
[DHCP-GigabitEthernet0/0/2]dhcp select glo
[DHCP-GigabitEthernet0/0/2]dhcp select global
[DHCP-GigabitEthernet0/0/2]quit
然后两个PC用ip config进行验证得出
PC3:
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fe67:4fb4
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.13
Subnet mask.......................: 255.255.255.240
Gateway...........................: 192.168.1.1
Physical address..................: 54-89-98-67-4F-B4
DNS server........................: 8.8.8.8
PC4:
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fe5b:3b20
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.14
Subnet mask.......................: 255.255.255.240
Gateway...........................: 192.168.1.1
Physical address..................: 54-89-98-5B-3B-20
DNS server........................: 8.8.8.8
3.路由上均具备2个环回地址
先将各个路由器的端口IP配好,然后进行环回地址配置
R7
[r7]int
[r7]interface loo
[r7]interface LoopBack 2
[r7-LoopBack2]ip add
[r7-LoopBack2]ip address 192.168.1.145 28
[r7-LoopBack2]q
[r7-LoopBack2]quit
[r7]int
[r7]interface loo
[r7]interface LoopBack 3
[r7-LoopBack3]ip add
[r7-LoopBack3]ip address 192.168.1.161 28
[r7-LoopBack3]quit
R8
[R8]interface LoopBack 0
[R8-LoopBack0]ip add
[R8-LoopBack0]ip address 192.168.1.113 28
[R8-LoopBack0]ip add
[R8-LoopBack0]q
[R8-LoopBack0]quit
[R8]in
[R8]inte
[R8]interface loo
[R8]interface LoopBack 1
[R8-LoopBack1]ip add
[R8-LoopBack1]ip address 192.168.1.129 28
[R8-LoopBack1]qui
[R8-LoopBack1]quit
[R8]
R9
[R9]int
[R9]interface loo
[R9]interface LoopBack 4
[R9-LoopBack4]ip add
[R9-LoopBack4]ip address 192.168.1.177 28
[R9-LoopBack4]quit
[R9]int
[R9]interface loop
[R9]interface LoopBack 5
[R9-LoopBack5]1ip add
[R9-LoopBack5]1p add
[R9-LoopBack5]i
[R9-LoopBack5]ip add
[R9-LoopBack5]ip address 192.168.1.193 28
[R9-LoopBack5]quit
R10
[R10]int
[R10]interface Giga
[R10]interface loo
[R10]interface LoopBack 6
[R10-LoopBack6]ip add
[R10-LoopBack6]ip address 192.168.1.209 28
[R10-LoopBack6]quit
[R10]inter
[R10]interface loo
[R10]interface LoopBack 7
[R10-LoopBack7]ip add
[R10-LoopBack7]ip address 192.168.1.225 28
[R10-LoopBack7]quit
4.R10和R11之间正常走1000M,备份走100M:
[DHCP]ip rout
[DHCP]ip route-st
[DHCP]ip route-static 192.168.1.64 28 192.168.1.33
[DHCP]ip ro
[DHCP]ip route-st
[DHCP]ip route-static 192.168.1.48 28 192.168.1.17
[DHCP]ip rou
[DHCP]ip route-sta
[DHCP]ip route-static 192.168.1.64 28 192.168.1.17 pre
[DHCP]ip route-static 192.168.1.64 28 192.168.1.17 preference 70
[DHCP]dis
[DHCP]display ip rou
[DHCP]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/28 Direct 0 0 D 192.168.1.1 GigabitEthernet
0/0/2
192.168.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
192.168.1.15/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
192.168.1.16/28 Direct 0 0 D 192.168.1.18 GigabitEthernet
0/0/0
192.168.1.18/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.1.31/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.1.32/28 Direct 0 0 D 192.168.1.34 GigabitEthernet
0/0/1
192.168.1.34/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.1.47/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.1.48/28 Static 60 0 RD 192.168.1.17 GigabitEthernet
0/0/0
192.168.1.64/28 Static 60 0 RD 192.168.1.33 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
5.全网尽量负载均衡
<DHCP>sys
Enter system view, return user view with Ctrl+Z.
[DHCP]ping 192.168.1.65
PING 192.168.1.65: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.65: bytes=56 Sequence=1 ttl=255 time=70 ms
Reply from 192.168.1.65: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.1.65: bytes=56 Sequence=3 ttl=255 time=10 ms
Reply from 192.168.1.65: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 192.168.1.65: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.65 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/28/70 ms
6.减少路由表数量,并避免环路产生
为了防止汇总子网中的网段发生意外丢失了而形成黑洞与缺省路由产生环路,在每个汇总路由器上配置空接口防环。
在产生路由黑洞的路由器上配置空接口,利用最长匹配原则实现对访问不存在的地址的数据包的筛选。
[R8]ip rout
[R8]ip route-sta
[R8]ip route-static 192.168.1.112 22 nu
[R8]ip route-static 192.168.1.112 22 NULL 0
Info: The destination address and mask of the configured static route mismatched
, and the static route 192.168.0.0/22 was generated.
[R8]ip
[R8]ip rout
[R8]ip route-static 192.168.1.128 22 nu
[R8]ip route-static 192.168.1.128 22 NULL 0
Error: The route already exists.
[R8]disp
[R8]display rou
[R8]display route-ta
[R8]display ip route-table
^
Error: Unrecognized command found at '^' position.
[R8]display ip route-tab
[R8]display ip rout
[R8]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 21 Routes : 21
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.0.0/22 Static 60 0 D 0.0.0.0 NULL0
7.全网可达
[R9]ping 192.168.1.33
PING 192.168.1.33: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.33: bytes=56 Sequence=1 ttl=255 time=70 ms
Reply from 192.168.1.33: bytes=56 Sequence=2 ttl=255 time=10 ms
Reply from 192.168.1.33: bytes=56 Sequence=3 ttl=255 time=10 ms
Reply from 192.168.1.33: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 192.168.1.33: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.33 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/26/70 ms