路由器实现 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…...

简易版抽奖活动的设计技术方案
1.前言 本技术方案旨在设计一套完整且可靠的抽奖活动逻辑,确保抽奖活动能够公平、公正、公开地进行,同时满足高并发访问、数据安全存储与高效处理等需求,为用户提供流畅的抽奖体验,助力业务顺利开展。本方案将涵盖抽奖活动的整体架构设计、核心流程逻辑、关键功能实现以及…...

使用分级同态加密防御梯度泄漏
抽象 联邦学习 (FL) 支持跨分布式客户端进行协作模型训练,而无需共享原始数据,这使其成为在互联和自动驾驶汽车 (CAV) 等领域保护隐私的机器学习的一种很有前途的方法。然而,最近的研究表明&…...

【Redis技术进阶之路】「原理分析系列开篇」分析客户端和服务端网络诵信交互实现(服务端执行命令请求的过程 - 初始化服务器)
服务端执行命令请求的过程 【专栏简介】【技术大纲】【专栏目标】【目标人群】1. Redis爱好者与社区成员2. 后端开发和系统架构师3. 计算机专业的本科生及研究生 初始化服务器1. 初始化服务器状态结构初始化RedisServer变量 2. 加载相关系统配置和用户配置参数定制化配置参数案…...

如何在看板中有效管理突发紧急任务
在看板中有效管理突发紧急任务需要:设立专门的紧急任务通道、重新调整任务优先级、保持适度的WIP(Work-in-Progress)弹性、优化任务处理流程、提高团队应对突发情况的敏捷性。其中,设立专门的紧急任务通道尤为重要,这能…...

ServerTrust 并非唯一
NSURLAuthenticationMethodServerTrust 只是 authenticationMethod 的冰山一角 要理解 NSURLAuthenticationMethodServerTrust, 首先要明白它只是 authenticationMethod 的选项之一, 并非唯一 1 先厘清概念 点说明authenticationMethodURLAuthenticationChallenge.protectionS…...
unix/linux,sudo,其发展历程详细时间线、由来、历史背景
sudo 的诞生和演化,本身就是一部 Unix/Linux 系统管理哲学变迁的微缩史。来,让我们拨开时间的迷雾,一同探寻 sudo 那波澜壮阔(也颇为实用主义)的发展历程。 历史背景:su的时代与困境 ( 20 世纪 70 年代 - 80 年代初) 在 sudo 出现之前,Unix 系统管理员和需要特权操作的…...
Spring Boot+Neo4j知识图谱实战:3步搭建智能关系网络!
一、引言 在数据驱动的背景下,知识图谱凭借其高效的信息组织能力,正逐步成为各行业应用的关键技术。本文聚焦 Spring Boot与Neo4j图数据库的技术结合,探讨知识图谱开发的实现细节,帮助读者掌握该技术栈在实际项目中的落地方法。 …...
【HarmonyOS 5 开发速记】如何获取用户信息(头像/昵称/手机号)
1.获取 authorizationCode: 2.利用 authorizationCode 获取 accessToken:文档中心 3.获取手机:文档中心 4.获取昵称头像:文档中心 首先创建 request 若要获取手机号,scope必填 phone,permissions 必填 …...

如何在网页里填写 PDF 表格?
有时候,你可能希望用户能在你的网站上填写 PDF 表单。然而,这件事并不简单,因为 PDF 并不是一种原生的网页格式。虽然浏览器可以显示 PDF 文件,但原生并不支持编辑或填写它们。更糟的是,如果你想收集表单数据ÿ…...

通过 Ansible 在 Windows 2022 上安装 IIS Web 服务器
拓扑结构 这是一个用于通过 Ansible 部署 IIS Web 服务器的实验室拓扑。 前提条件: 在被管理的节点上安装WinRm 准备一张自签名的证书 开放防火墙入站tcp 5985 5986端口 准备自签名证书 PS C:\Users\azureuser> $cert New-SelfSignedCertificate -DnsName &…...