路由器实现 IP 子网之间的通信
目录
路由器配置静态或默认路由实现 IP 子网之间的通信
地址聚合与最长前缀匹配路由配置
路由器配置静态或默认路由实现 IP 子网之间的通信
按如下拓扑图配置
其中,路由器加入4GEW-T
PC配置如下
LSW1的配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname LSW1
[LSW1]vlan batch 10
Info: This operation may take a few seconds. Please wait for a moment...done.
[LSW1]
Sep 17 2023 19:04:40-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 5, the
change loop count is 0, and the maximum number of records is 4095.
[LSW1]undo info-center enable
Info: Information center is disabled.
[LSW1]port-group pvlan10
[LSW1-port-group-pvlan10]group-member g0/0/1
[LSW1-port-group-pvlan10]group-member g0/0/11 to g0/0/14
[LSW1-port-group-pvlan10]port link-type access
[LSW1-GigabitEthernet0/0/1]port link-type access
[LSW1-GigabitEthernet0/0/11]port link-type access
[LSW1-GigabitEthernet0/0/12]port link-type access
[LSW1-GigabitEthernet0/0/13]port link-type access
[LSW1-GigabitEthernet0/0/14]port link-type access
[LSW1-port-group-pvlan10]port default vlan 10
[LSW1-GigabitEthernet0/0/1]port default vlan 10
[LSW1-GigabitEthernet0/0/11]port default vlan 10
[LSW1-GigabitEthernet0/0/12]port default vlan 10
[LSW1-GigabitEthernet0/0/13]port default vlan 10
[LSW1-GigabitEthernet0/0/14]port default vlan 10
[LSW1-port-group-pvlan10]quit
[LSW1]display vlan
The total number of vlans is : 2
--------------------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------------------VID Type Ports
--------------------------------------------------------------------------------
1 common UT:GE0/0/2(D) GE0/0/3(D) GE0/0/4(D) GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D) GE0/0/9(D) GE0/0/10(D) GE0/0/15(D) GE0/0/16(D) GE0/0/17(D) GE0/0/18(D) GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(D) GE0/0/23(D) GE0/0/24(D) 10 common UT:GE0/0/1(U) GE0/0/11(U) GE0/0/12(U) GE0/0/13(U) GE0/0/14(U) VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------------------1 enable default enable disable VLAN 0001
10 enable default enable disable VLAN 0010
[LSW1]display port vlan
Port Link Type PVID Trunk VLAN List
-------------------------------------------------------------------------------
GigabitEthernet0/0/1 access 10 -
GigabitEthernet0/0/2 hybrid 1 -
GigabitEthernet0/0/3 hybrid 1 -
GigabitEthernet0/0/4 hybrid 1 -
GigabitEthernet0/0/5 hybrid 1 -
GigabitEthernet0/0/6 hybrid 1 -
GigabitEthernet0/0/7 hybrid 1 -
GigabitEthernet0/0/8 hybrid 1 -
GigabitEthernet0/0/9 hybrid 1 -
GigabitEthernet0/0/10 hybrid 1 -
GigabitEthernet0/0/11 access 10 -
GigabitEthernet0/0/12 access 10 -
GigabitEthernet0/0/13 access 10 -
GigabitEthernet0/0/14 access 10 -
GigabitEthernet0/0/15 hybrid 1 -
GigabitEthernet0/0/16 hybrid 1 -
GigabitEthernet0/0/17 hybrid 1 -
GigabitEthernet0/0/18 hybrid 1 -
GigabitEthernet0/0/19 hybrid 1 -
GigabitEthernet0/0/20 hybrid 1 -
GigabitEthernet0/0/21 hybrid 1 -
GigabitEthernet0/0/22 hybrid 1 -
GigabitEthernet0/0/23 hybrid 1 -
GigabitEthernet0/0/24 hybrid 1 -
[LSW1]
配置RTA
<Huawei>SYS
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname RTA
[RTA]int g4/0/0
[RTA-GigabitEthernet4/0/0]ip address 192.168.10.1 24
Sep 17 2023 19:10:17-08:00 RTA %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IPon the interface GigabitEthernet4/0/0 has entered the UP state.
[RTA-GigabitEthernet4/0/0]qu
[RTA]int g0/0/0
[RTA-GigabitEthernet0/0/0]ip address 172.16.101.1 24
Sep 17 2023 19:10:39-08:00 RTA %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IPon the interface GigabitEthernet0/0/0 has entered the UP state.
[RTA-GigabitEthernet0/0/0]qu
[RTA]int g0/0/1
[RTA-GigabitEthernet0/0/1]ip address 172.16.103.1 24
[RTA-GigabitEthernet0/0/1]
Sep 17 2023 19:10:59-08:00 RTA %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IPon the interface GigabitEthernet0/0/1 has entered the UP state.
[RTA-GigabitEthernet0/0/1]qu
[RTA]
配置RTB
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname RTB
[RTB]int g4/0/0
[RTB-GigabitEthernet4/0/0]ip address 192.168.30.1 24
Sep 17 2023 19:12:19-08:00 RTB %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IPon the interface GigabitEthernet4/0/0 has entered the UP state.
[RTB-GigabitEthernet4/0/0]qu
[RTB]int g0/0/0
[RTB-GigabitEthernet0/0/0]ip address 172.16.101.2 24
Sep 17 2023 19:12:43-08:00 RTB %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IPon the interface GigabitEthernet0/0/0 has entered the UP state.
[RTB-GigabitEthernet0/0/0]qu
[RTB]interface g0/0/1
[RTB-GigabitEthernet0/0/1]ip address 172.16.102.2 24
Sep 17 2023 19:13:02-08:00 RTB %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IPon the interface GigabitEthernet0/0/1 has entered the UP state.
[RTB-GigabitEthernet0/0/1]qu
配置RTC
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname RTC
[RTC]int g4/0/0
[RTC-GigabitEthernet4/0/0]ip address 192.168.80.1 24
Sep 17 2023 19:15:08-08:00 RTC %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IPon the interface GigabitEthernet4/0/0 has entered the UP state.
[RTC-GigabitEthernet4/0/0]qu
[RTC]int g4/0/1
[RTC-GigabitEthernet4/0/1]ip address 192.168.81.1 24
Sep 17 2023 19:15:28-08:00 RTC %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IPon the interface GigabitEthernet4/0/1 has entered the UP state.
[RTC-GigabitEthernet4/0/1]qu
[RTC]interface g0/0/0
[RTC-GigabitEthernet0/0/0]ip address 172.16.103.2 24
Sep 17 2023 19:15:50-08:00 RTC %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IPon the interface GigabitEthernet0/0/0 has entered the UP state.
[RTC-GigabitEthernet0/0/0]qu
[RTC]interface g0/0/1
[RTC-GigabitEthernet0/0/1]ip address 172.16.102.1 24
Sep 17 2023 19:16:08-08:00 RTC %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IPon the interface GigabitEthernet0/0/1 has entered the UP state.
[RTC-GigabitEthernet0/0/1]qu
路由规划如下
招生就业部的计算机最多,可以使用默认路由。
同时将路由器RTB到招生就业部网络的路由设置为静态路由,下一跳地址为路由 器RTA的172.16.101.1。
将路由器RTB到学籍管理部和考试中心网络的路由设置为默 认路由,下一跳地址为路由器RTC的172.16.102.1。
配置路由器RTA的路由
<RTA>
<RTA>sys
Enter system view, return user view with Ctrl+Z.
[RTA]ip route-static 0.0.0.0 0.0.0.0 172.16.101.2
[RTA]display IP routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 14 Routes : 14 Destination/Mask Proto Pre Cost Flags NextHop Interface0.0.0.0/0 Static 60 0 RD 172.16.101.2 GigabitEthernet
0/0/0127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0127.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 InLoopBack0172.16.101.0/24 Direct 0 0 D 172.16.101.1 GigabitEthernet
0/0/0172.16.101.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.101.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.103.0/24 Direct 0 0 D 172.16.103.1 GigabitEthernet
0/0/1172.16.103.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1172.16.103.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1192.168.10.0/24 Direct 0 0 D 192.168.10.1 GigabitEthernet
4/0/0192.168.10.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0192.168.10.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
配置路由器RTB的路由
[RTB]ip route-static 192.168.10.0 24 172.16.101.1
[RTB]ip route-static 0.0.0.0 0.0.0.0 172.16.102.1
[RTB]display IP routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 15 Routes : 15 Destination/Mask Proto Pre Cost Flags NextHop Interface0.0.0.0/0 Static 60 0 RD 172.16.102.1 GigabitEthernet
0/0/1127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0127.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 InLoopBack0172.16.101.0/24 Direct 0 0 D 172.16.101.2 GigabitEthernet
0/0/0172.16.101.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.101.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.102.0/24 Direct 0 0 D 172.16.102.2 GigabitEthernet
0/0/1172.16.102.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1172.16.102.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1192.168.10.0/24 Static 60 0 RD 172.16.101.1 GigabitEthernet
0/0/0192.168.30.0/24 Direct 0 0 D 192.168.30.1 GigabitEthernet
4/0/0192.168.30.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0192.168.30.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
配置路由器RTC的路由
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname RTC
[RTC]int g4/0/0
[RTC-GigabitEthernet4/0/0]ip address 192.168.80.1 24
Sep 17 2023 19:15:08-08:00 RTC %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IPon the interface GigabitEthernet4/0/0 has entered the UP state.
[RTC-GigabitEthernet4/0/0]qu
[RTC]int g4/0/1
[RTC-GigabitEthernet4/0/1]ip address 192.168.81.1 24
Sep 17 2023 19:15:28-08:00 RTC %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IPon the interface GigabitEthernet4/0/1 has entered the UP state.
[RTC-GigabitEthernet4/0/1]qu
[RTC]interface g0/0/0
[RTC-GigabitEthernet0/0/0]ip address 172.16.103.2 24
Sep 17 2023 19:15:50-08:00 RTC %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IPon the interface GigabitEthernet0/0/0 has entered the UP state.
[RTC-GigabitEthernet0/0/0]qu
[RTC]interface g0/0/1
[RTC-GigabitEthernet0/0/1]ip address 172.16.102.1 24
Sep 17 2023 19:16:08-08:00 RTC %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IPon the interface GigabitEthernet0/0/1 has entered the UP state.
[RTC-GigabitEthernet0/0/1]qu
[RTC]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<RTC>sys
Enter system view, return user view with Ctrl+Z.
[RTC]ip route-static 0.0.0.0 0.0.0.0 172.16.103.1
[RTC]display IP routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 17 Routes : 17 Destination/Mask Proto Pre Cost Flags NextHop Interface0.0.0.0/0 Static 60 0 RD 172.16.103.1 GigabitEthernet
0/0/0127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0127.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 InLoopBack0172.16.102.0/24 Direct 0 0 D 172.16.102.1 GigabitEthernet
0/0/1172.16.102.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1172.16.102.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1172.16.103.0/24 Direct 0 0 D 172.16.103.2 GigabitEthernet
0/0/0172.16.103.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.103.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0192.168.80.0/24 Direct 0 0 D 192.168.80.1 GigabitEthernet
4/0/0192.168.80.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0192.168.80.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0192.168.81.0/24 Direct 0 0 D 192.168.81.1 GigabitEthernet
4/0/1192.168.81.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/1192.168.81.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
在PC-10-1测试是否能与PC-30-1、PC-80-1和PC-81-1通信:
PC>ping 192.168.30.11Ping 192.168.30.11: 32 data bytes, Press Ctrl_C to break
From 192.168.30.11: bytes=32 seq=1 ttl=126 time=47 ms
From 192.168.30.11: bytes=32 seq=2 ttl=126 time=47 ms
From 192.168.30.11: bytes=32 seq=3 ttl=126 time=31 ms
From 192.168.30.11: bytes=32 seq=4 ttl=126 time=32 ms
From 192.168.30.11: bytes=32 seq=5 ttl=126 time=31 ms--- 192.168.30.11 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 31/37/47 msPC>ping 192.168.80.11Ping 192.168.80.11: 32 data bytes, Press Ctrl_C to break
From 192.168.80.11: bytes=32 seq=1 ttl=126 time=47 ms
From 192.168.80.11: bytes=32 seq=2 ttl=126 time=16 ms
From 192.168.80.11: bytes=32 seq=3 ttl=126 time=47 ms
From 192.168.80.11: bytes=32 seq=4 ttl=126 time=47 ms
From 192.168.80.11: bytes=32 seq=5 ttl=126 time=62 ms--- 192.168.80.11 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 16/43/62 msPC>ping 192.168.81.11Ping 192.168.81.11: 32 data bytes, Press Ctrl_C to break
From 192.168.81.11: bytes=32 seq=1 ttl=126 time=47 ms
From 192.168.81.11: bytes=32 seq=2 ttl=126 time=47 ms
From 192.168.81.11: bytes=32 seq=3 ttl=126 time=31 ms
From 192.168.81.11: bytes=32 seq=4 ttl=126 time=47 ms
From 192.168.81.11: bytes=32 seq=5 ttl=126 time=47 ms--- 192.168.81.11 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 31/43/47 ms
在PC-30-1测试是否能与PC-10-1、PC-80-1和PC-81-1通信:
PC>ping 192.168.10.11Ping 192.168.10.11: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.10.11: bytes=32 seq=2 ttl=126 time=63 ms
From 192.168.10.11: bytes=32 seq=3 ttl=126 time=47 ms
From 192.168.10.11: bytes=32 seq=4 ttl=126 time=47 ms
From 192.168.10.11: bytes=32 seq=5 ttl=126 time=47 ms--- 192.168.10.11 ping statistics ---5 packet(s) transmitted4 packet(s) received20.00% packet lossround-trip min/avg/max = 0/51/63 msPC>ping 192.168.80.11Ping 192.168.80.11: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.80.11: bytes=32 seq=2 ttl=125 time=15 ms
From 192.168.80.11: bytes=32 seq=3 ttl=125 time=32 ms
From 192.168.80.11: bytes=32 seq=4 ttl=125 time=15 ms
From 192.168.80.11: bytes=32 seq=5 ttl=125 time=16 ms--- 192.168.80.11 ping statistics ---5 packet(s) transmitted4 packet(s) received20.00% packet lossround-trip min/avg/max = 0/19/32 msPC>ping 192.168.81.11Ping 192.168.81.11: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.81.11: bytes=32 seq=2 ttl=125 time=16 ms
From 192.168.81.11: bytes=32 seq=3 ttl=125 time=16 ms
From 192.168.81.11: bytes=32 seq=4 ttl=125 time=31 ms
From 192.168.81.11: bytes=32 seq=5 ttl=125 time=16 ms--- 192.168.81.11 ping statistics ---5 packet(s) transmitted4 packet(s) received20.00% packet lossround-trip min/avg/max = 0/19/31 ms
在PC-80-1测试是否能与PC-10-1、PC-30-1和PC-81-1通信:
PC>ping 192.168.10.11Ping 192.168.10.11: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.10.11: bytes=32 seq=2 ttl=125 time=46 ms
From 192.168.10.11: bytes=32 seq=3 ttl=125 time=47 ms
From 192.168.10.11: bytes=32 seq=4 ttl=125 time=63 ms
From 192.168.10.11: bytes=32 seq=5 ttl=125 time=47 ms--- 192.168.10.11 ping statistics ---5 packet(s) transmitted4 packet(s) received20.00% packet lossround-trip min/avg/max = 0/50/63 msPC>ping 192.168.30.11Ping 192.168.30.11: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.30.11: bytes=32 seq=2 ttl=126 time=15 ms
From 192.168.30.11: bytes=32 seq=3 ttl=126 time=32 ms
From 192.168.30.11: bytes=32 seq=4 ttl=126 time=15 ms
From 192.168.30.11: bytes=32 seq=5 ttl=126 time=16 ms--- 192.168.30.11 ping statistics ---5 packet(s) transmitted4 packet(s) received20.00% packet lossround-trip min/avg/max = 0/19/32 msPC>ping 192.168.81.11Ping 192.168.81.11: 32 data bytes, Press Ctrl_C to break
From 192.168.81.11: bytes=32 seq=1 ttl=127 time=16 ms
From 192.168.81.11: bytes=32 seq=2 ttl=127 time=16 ms
From 192.168.81.11: bytes=32 seq=3 ttl=127 time=15 ms
From 192.168.81.11: bytes=32 seq=4 ttl=127 time=16 ms
From 192.168.81.11: bytes=32 seq=5 ttl=127 time=15 ms--- 192.168.81.11 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 15/15/16 ms
在PC-81-1测试是否能与PC-10-1、PC-30-1和PC-80-1通信:
PC>ping 192.168.10.11Ping 192.168.10.11: 32 data bytes, Press Ctrl_C to break
From 192.168.10.11: bytes=32 seq=1 ttl=125 time=47 ms
From 192.168.10.11: bytes=32 seq=2 ttl=125 time=47 ms
From 192.168.10.11: bytes=32 seq=3 ttl=125 time=47 ms
From 192.168.10.11: bytes=32 seq=4 ttl=125 time=62 ms
From 192.168.10.11: bytes=32 seq=5 ttl=125 time=63 ms--- 192.168.10.11 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 47/53/63 msPC>ping 192.168.30.11Ping 192.168.30.11: 32 data bytes, Press Ctrl_C to break
From 192.168.30.11: bytes=32 seq=1 ttl=126 time=31 ms
From 192.168.30.11: bytes=32 seq=2 ttl=126 time=16 ms
From 192.168.30.11: bytes=32 seq=3 ttl=126 time=15 ms
From 192.168.30.11: bytes=32 seq=4 ttl=126 time=31 ms
From 192.168.30.11: bytes=32 seq=5 ttl=126 time=32 ms--- 192.168.30.11 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 15/25/32 msPC>ping 192.168.80.11Ping 192.168.80.11: 32 data bytes, Press Ctrl_C to break
From 192.168.80.11: bytes=32 seq=1 ttl=127 time=15 ms
From 192.168.80.11: bytes=32 seq=2 ttl=127 time=16 ms
From 192.168.80.11: bytes=32 seq=3 ttl=127 time=16 ms
From 192.168.80.11: bytes=32 seq=4 ttl=127 time=15 ms
From 192.168.80.11: bytes=32 seq=5 ttl=127 time=16 ms--- 192.168.80.11 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 15/15/16 ms
至此,我们可以看到,不同vlan间也可以进行相互通信
我们也可以通过tracert,跟踪分析数据包从源主机到目标主机的路径,例如
在PC-10-1中
PC>tracert 192.168.81.11traceroute to 192.168.81.11, 8 hops max
(ICMP), press Ctrl+C to stop1 192.168.10.1 32 ms 46 ms 47 ms //第一跳为网关2 172.16.101.2 32 ms 62 ms 78 ms //经过RTA的0/0/0端口3 172.16.102.1 31 ms 47 ms 63 ms //经过RTC的0/0/1端口4 192.168.81.11 47 ms 47 ms 46 ms //最后到达目标主机
地址聚合与最长前缀匹配路由配置
路由规划
将路由器 RTA 到所有其他用户网络的路由设置为默认路由,下一跳地址为路由器 RTB的172.16.101.2。
将路由器RTB到招生就业部网络 的路由设置为默认路由,下一跳地址为路由器RTA的172.16.101.1;由于学籍管理部和考试中心网络的IP地址是连续的,为减少路由条目,可以将它们聚合为一个地址 192.168.80.0/23,将到学籍管理部和考试中心网络的路由设置为静态路由,目的地址为聚合地址 192.168.80.0, 子网掩码 为 255.255.254.0 , 下一跳地址为路由器RTC 的 172.16.102.1。
在路由器RTC的路由表中,配置一条到所有其他用户网络的默认路由,下一跳地址为路由器RTA的172.16.103.1。再增加一条经过路由器RTC到招生就业部计算机PC-10-4的静态路由,下一跳地址为路由器RTB的172.16.102.2。按最长前缀匹配规则,将其子网掩码设置为255.255.255.255(目标IP地址与指定的地址完全相同)。
对RTA路由器的配置
[RTA]ip route-static 0.0.0.0 0.0.0.0 172.16.101.2
[RTA]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 14 Routes : 14 Destination/Mask Proto Pre Cost Flags NextHop Interface0.0.0.0/0 Static 60 0 RD 172.16.101.2 GigabitEthernet
0/0/0127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0127.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 InLoopBack0172.16.101.0/24 Direct 0 0 D 172.16.101.1 GigabitEthernet
0/0/0172.16.101.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.101.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.103.0/24 Direct 0 0 D 172.16.103.1 GigabitEthernet
0/0/1172.16.103.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1172.16.103.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1192.168.10.0/24 Direct 0 0 D 192.168.10.1 GigabitEthernet
4/0/0192.168.10.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0192.168.10.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0[RTA]
对RTB路由的配置
<RTB>sys
Enter system view, return user view with Ctrl+Z.
[RTB]ip route-static 192.168.80.0 23 172.16.102.1
[RTB]ip route-static 0.0.0.0 0.0.0.0 172.16.101.1
[RTB]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 15 Routes : 15 Destination/Mask Proto Pre Cost Flags NextHop Interface0.0.0.0/0 Static 60 0 RD 172.16.101.1 GigabitEthernet
0/0/0127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0127.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 InLoopBack0172.16.101.0/24 Direct 0 0 D 172.16.101.2 GigabitEthernet
0/0/0172.16.101.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.101.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.102.0/24 Direct 0 0 D 172.16.102.2 GigabitEthernet
0/0/1172.16.102.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1172.16.102.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1192.168.30.0/24 Direct 0 0 D 192.168.30.1 GigabitEthernet
4/0/0192.168.30.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0192.168.30.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0192.168.80.0/23 Static 60 0 RD 172.16.102.1 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
对RTC路由器进行配置
<RTC>sys
Enter system view, return user view with Ctrl+Z.
[RTC]ip route-static 192.168.10.14 32 172.16.102.2
[RTC]ip route-static 0.0.0.0 0.0.0.0 172.16.103.1
[RTC]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 18 Routes : 18 Destination/Mask Proto Pre Cost Flags NextHop Interface0.0.0.0/0 Static 60 0 RD 172.16.103.1 GigabitEthernet
0/0/0127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0127.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 InLoopBack0172.16.102.0/24 Direct 0 0 D 172.16.102.1 GigabitEthernet
0/0/1172.16.102.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1172.16.102.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1172.16.103.0/24 Direct 0 0 D 172.16.103.2 GigabitEthernet
0/0/0172.16.103.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.103.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0192.168.10.14/32 Static 60 0 RD 172.16.102.2 GigabitEthernet
0/0/1192.168.80.0/24 Direct 0 0 D 192.168.80.1 GigabitEthernet
4/0/0192.168.80.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0192.168.80.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0192.168.81.0/24 Direct 0 0 D 192.168.81.1 GigabitEthernet
4/0/1192.168.81.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/1192.168.81.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
配置完成后,结果和第一个相同,不同IP子网间能完成通信
在PC-80-1做以下tracert操作
PC>tracert 192.168.10.11traceroute to 192.168.10.11, 8 hops max
(ICMP), press Ctrl+C to stop1 192.168.80.1 16 ms 16 ms <1 ms2 172.16.103.1 15 ms 32 ms 15 ms3 192.168.10.11 31 ms 47 ms 47 msPC>tracert 192.168.10.14traceroute to 192.168.10.14, 8 hops max
(ICMP), press Ctrl+C to stop1 192.168.80.1 16 ms 16 ms 15 ms2 172.16.102.2 16 ms 31 ms 16 ms3 172.16.101.1 15 ms 32 ms 31 ms4 192.168.10.14 62 ms 79 ms 46 msPC>tracert 192.168.30.11traceroute to 192.168.30.11, 8 hops max
(ICMP), press Ctrl+C to stop1 192.168.80.1 16 ms <1 ms 15 ms2 172.16.103.1 31 ms 16 ms 16 ms3 172.16.101.2 15 ms 32 ms 31 ms4 192.168.30.11 15 ms 32 ms 31 ms
将路由器RTB路由表中路由的目的地址 为 聚 合 地 址 192.168.80.0的子网掩码改为255.255.0.0,下一跳地址不变,仍为路由器RTC的172.16.102.1:
<RTB>sys
Enter system view, return user view with Ctrl+Z.
[RTB]undo ip route-static 192.168.80.0 23 172.16.102.1
[RTB]ip route-static 192.168.80.0 16 172.16.102.1
Info: The destination address and mask of the configured static route mismatched
, and the static route 192.168.0.0/16 was generated.
[RTB]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 15 Routes : 15 Destination/Mask Proto Pre Cost Flags NextHop Interface0.0.0.0/0 Static 60 0 RD 172.16.101.1 GigabitEthernet
0/0/0127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0127.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 InLoopBack0172.16.101.0/24 Direct 0 0 D 172.16.101.2 GigabitEthernet
0/0/0172.16.101.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.101.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.102.0/24 Direct 0 0 D 172.16.102.2 GigabitEthernet
0/0/1172.16.102.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1172.16.102.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1192.168.0.0/16 Static 60 0 RD 172.16.102.1 GigabitEthernet
0/0/1192.168.30.0/24 Direct 0 0 D 192.168.30.1 GigabitEthernet
4/0/0192.168.30.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0192.168.30.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0#与之前的路由表进行对比
[RTB]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 15 Routes : 15 Destination/Mask Proto Pre Cost Flags NextHop Interface0.0.0.0/0 Static 60 0 RD 172.16.101.1 GigabitEthernet
0/0/0127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0127.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 InLoopBack0172.16.101.0/24 Direct 0 0 D 172.16.101.2 GigabitEthernet
0/0/0172.16.101.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.101.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0172.16.102.0/24 Direct 0 0 D 172.16.102.2 GigabitEthernet
0/0/1172.16.102.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1172.16.102.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1192.168.30.0/24 Direct 0 0 D 192.168.30.1 GigabitEthernet
4/0/0192.168.30.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0192.168.30.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0192.168.80.0/23 Static 60 0 RD 172.16.102.1 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
可以看到,目的地址变为了192.168.0.0/16,将较小的子网聚合为一个更大的子网后,减少了IP地址的使用,整个路由表的条目数量减少。
以下为拓扑图的链接
链接:https://pan.baidu.com/s/16xQ6-5hikMziAcKYjCFX0g
提取码:ki07
但是还是提倡多写,多理解,多抓包,佬们一起努力!!💖💖💖💖
相关文章:

路由器实现 IP 子网之间的通信
目录 路由器配置静态或默认路由实现 IP 子网之间的通信 地址聚合与最长前缀匹配路由配置 路由器配置静态或默认路由实现 IP 子网之间的通信 按如下拓扑图配置 其中,路由器加入4GEW-T PC配置如下 LSW1的配置 <Huawei>sys Enter system view, return user…...

解决kali beef启动失败问题及实战
文章目录 一、解决方法二、靶场实战应用1.首先打开dvwa这个靶场,设置难度为low2.打开xss-stored3.准备payload4.提交payload5.利用 一、解决方法 首先需卸载 ruby apt remove ruby 卸载 beef apt remove beef-xss 重新安装ruby apt-get install ruby apt-get insta…...
【NetEq】NackTracker 走读
重传列表的最大限制是500个包,大约10秒钟 // A limit for the size of the NACK list.static const size_t kNackListSizeLimit = 500; // 10 seconds for 20 ms frame// packets.允许设置一个小于max_nack_list_size的值 // Set a maximum for the size of the NACK list. I…...
条例18~23(设计与声明)
目录 条例18 让接口被正确使用,不易被误用 总结 条例19 设计class犹如设计type 条例20 宁以const的引用传参替代传值传参 总结 条例21 必须返回对象时,别妄想返回他的引用 总结 条例22 将成员变量声明为private 总结 条例23 宁以非友元非…...

STM32 UART通信协议 基础知识
通用异步收发器(Universal Asynchronous Receiver/Transmitter),通常称作UART,是一种串行、异步、全双工的通信协议。 在通信领域中,有两种数据通信方式:并行通信和串行通信。串口的数据传输是以串行方式进行的。串口在…...
nginx部署vue前端项目,访问报错500 Internal Server Error
前言 描述:当我配置好全部之后,通过 服务器 ip 地址访问,遇到报错信息:500 Internal Server Error。 情况说明 前提:我是通过Docker启动nginx容器,通过-v 绑定数据卷,将html文件和nginx.conf…...
@Excel注解
在 Java 开发中,Excel 注解通常用于标记实体类的字段,以指示与 Excel 文件的导入和导出相关的配置信息。 Excel 注解通常是自定义的注解,它可以包含多个属性,用于定义与 Excel 相关的配置,如字段的标题、顺序、数据格…...
解释器模式简介
概念: 解释器模式(Interpreter Pattern)是一种行为型设计模式,它用于定义语言的文法,并解析和执行给定语言中的表达式。该模式将每个表达式表示为一个类,并提供了一种方式来组合这些表达式以实现复杂的语句…...
图像识别技术在不同场景下有哪些应用?
图像识别技术在不同场景下的应用包括: 遥感图像识别:航空遥感和卫星遥感图像通常用图像识别技术进行加工以便提取有用的信息。该技术目前主要用于地形地质探查,森林、水利、海洋、农业等资源调查,灾害预测,环境污染监…...

阿里巴巴OceanBase介绍
前言 官网地址:https://www.oceanbase.com/ OceanBase是由蚂蚁集团完全自主研发的国产原生分布式数据库,始创于2010年。是全球唯一在 TPC-C 和 TPC-H 测试上都刷新了世界纪录的国产原生分布式数据库。 2010年,创始人阳振坤加入阿里巴巴&…...
leetcode 2560. 打家劫舍 IV
2560. 打家劫舍 IV 沿街有一排连续的房屋。每间房屋内都藏有一定的现金。现在有一位小偷计划从这些房屋中窃取现金。 由于相邻的房屋装有相互连通的防盗系统,所以小偷 不会窃取相邻的房屋 。 小偷的 窃取能力 定义为他在窃取过程中能从单间房屋中窃取的 最大金额 。…...
正点原子lwIP学习笔记——Socket接口TCP实验
1. Socket接口TCP Client配置连接 配置步骤如下所示: sin_family设置为AF_INET表示IPv4网络协议;sin_port为设置端口号;sin_addr. s_addr设置远程IP地址;调用函数Socket创建Socket连接, 注意该函数的第二个参数SOCK_…...

【Flink】
事件驱动型应用 核心目标:数据流上的有状态计算 Apache Flink是一个框架和分布式处理引擎,用于对无界或有界数据流进行有状态计算。 运行逻辑 状态 把流处理需要的额外数据保存成一个“状态”,然后针对这条数据进行处理,并且更新状态。这就是所谓的“…...

大数据Flink(九十一):Array Expansion(数组列转行)和Table Function(自定义列转行)
文章目录 Array Expansion(数组列转行)和Table Function(自定义列转行)...

华为云云耀云服务器L实例评测|华为云云耀云服务器L实例CentOS的存储和备份策略
1 华为云云耀云服务器L实例介绍 华为云云耀云服务器L实例是华为云计算服务中的一种虚拟云服务器,它提供了强大的计算资源,可以在云端运行各种应用程序和服务。 华为云服务器提供了多种实例类型,包括通用型、计算优化型、内存优化型等&#…...

Web自动化测试 —— 如何进行Selenium页面数据及元素交互?啊哈
前言: Web自动化测试是一种常用的测试方式,通过在浏览器中模拟用户操作以及与页面元素的交互,可以有效地检验页面的功能性以及稳定性。Selenium是一款流行的Web自动化测试工具,在本篇文章中,我们将介绍如何使用Seleni…...
点云从入门到精通技术详解100篇-基于全景图的室内场景点云补全方法(续)
目录 3.3 模型训练及实验评估 3.3.1 模型训练 3.3.2实验评估 4 基于自...
Debezium系列之:采集数据库数据实现对表指定的字段进行加密,下游实现对表加密后的字段进行解密
Debezium系列之:采集数据库数据实现对表指定的字段进行加密,下游实现对表加密后的字段进行解密 一、需求背景二、创建表三、深入理解加密算法的实现原理四、实现对表的指定字段加密五、插入数据六、消费Topic七、实现对加密的字段进行解密八、查看数据库一、需求背景 实际应用…...

Win10 cmd如何试用tar命令压缩和解压文件夹
环境: Win10 专业版 Microsoft Windows [版本 10.0.19041.208] 问题描述: Win10 cmd如何试用tar命令压缩和解压文件夹 C:\Users\Administrator>tar --help tar(bsdtar): manipulate archive files First option must be a mode specifier:-c Cre…...

最新AI写作系统ChatGPT源码/支持GPT4.0+GPT联网提问/支持ai绘画Midjourney+Prompt+MJ以图生图+思维导图生成
一、AI创作系统 SparkAi系统是基于很火的GPT提问进行开发的Ai智能问答系统。本期针对源码系统整体测试下来非常完美,可以说SparkAi是目前国内一款的ChatGPT对接OpenAI软件系统。那么如何搭建部署AI创作ChatGPT系统?小编这里写一个详细图文教程吧&#x…...

MPNet:旋转机械轻量化故障诊断模型详解python代码复现
目录 一、问题背景与挑战 二、MPNet核心架构 2.1 多分支特征融合模块(MBFM) 2.2 残差注意力金字塔模块(RAPM) 2.2.1 空间金字塔注意力(SPA) 2.2.2 金字塔残差块(PRBlock) 2.3 分类器设计 三、关键技术突破 3.1 多尺度特征融合 3.2 轻量化设计策略 3.3 抗噪声…...

超短脉冲激光自聚焦效应
前言与目录 强激光引起自聚焦效应机理 超短脉冲激光在脆性材料内部加工时引起的自聚焦效应,这是一种非线性光学现象,主要涉及光学克尔效应和材料的非线性光学特性。 自聚焦效应可以产生局部的强光场,对材料产生非线性响应,可能…...
<6>-MySQL表的增删查改
目录 一,create(创建表) 二,retrieve(查询表) 1,select列 2,where条件 三,update(更新表) 四,delete(删除表…...

练习(含atoi的模拟实现,自定义类型等练习)
一、结构体大小的计算及位段 (结构体大小计算及位段 详解请看:自定义类型:结构体进阶-CSDN博客) 1.在32位系统环境,编译选项为4字节对齐,那么sizeof(A)和sizeof(B)是多少? #pragma pack(4)st…...
在rocky linux 9.5上在线安装 docker
前面是指南,后面是日志 sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo dnf install docker-ce docker-ce-cli containerd.io -y docker version sudo systemctl start docker sudo systemctl status docker …...
【SpringBoot】100、SpringBoot中使用自定义注解+AOP实现参数自动解密
在实际项目中,用户注册、登录、修改密码等操作,都涉及到参数传输安全问题。所以我们需要在前端对账户、密码等敏感信息加密传输,在后端接收到数据后能自动解密。 1、引入依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId...

Java-41 深入浅出 Spring - 声明式事务的支持 事务配置 XML模式 XML+注解模式
点一下关注吧!!!非常感谢!!持续更新!!! 🚀 AI篇持续更新中!(长期更新) 目前2025年06月05日更新到: AI炼丹日志-28 - Aud…...

PL0语法,分析器实现!
简介 PL/0 是一种简单的编程语言,通常用于教学编译原理。它的语法结构清晰,功能包括常量定义、变量声明、过程(子程序)定义以及基本的控制结构(如条件语句和循环语句)。 PL/0 语法规范 PL/0 是一种教学用的小型编程语言,由 Niklaus Wirth 设计,用于展示编译原理的核…...
三体问题详解
从物理学角度,三体问题之所以不稳定,是因为三个天体在万有引力作用下相互作用,形成一个非线性耦合系统。我们可以从牛顿经典力学出发,列出具体的运动方程,并说明为何这个系统本质上是混沌的,无法得到一般解…...
大学生职业发展与就业创业指导教学评价
这里是引用 作为软工2203/2204班的学生,我们非常感谢您在《大学生职业发展与就业创业指导》课程中的悉心教导。这门课程对我们即将面临实习和就业的工科学生来说至关重要,而您认真负责的教学态度,让课程的每一部分都充满了实用价值。 尤其让我…...