子网重叠的两个网络可以相互通
虽然子网掩码不同,但是 R1 可以 ping R2:
<R1>ping 10.0.12.14
PING 10.0.12.14: 56 data bytes, press CTRL_C to break
Reply from 10.0.12.14: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 10.0.12.14: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 10.0.12.14: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 10.0.12.14: bytes=56 Sequence=4 ttl=255 time=40 ms
Reply from 10.0.12.14: bytes=56 Sequence=5 ttl=255 time=60 ms
--- 10.0.12.14 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/42/60 ms
当配置完接口 IP 后,查看路由表可以发现多了条路由:
比如:
<R1>display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.0.0/16 Direct 0 0 D 10.0.12.13 Ethernet0/0/0
根据 R1 这条 routing table 中的第一个条目,配置 dst IP 是同一个子网。因为是直连的情况,所以 nexthop 直接发送。R2 回包也是同理。
以下是 R2 的相关信息:
[Huawei-Ethernet0/0/0]ping 10.0.12.13
PING 10.0.12.13: 56 data bytes, press CTRL_C to break
Reply from 10.0.12.13: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 10.0.12.13: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 10.0.12.13: bytes=56 Sequence=3 ttl=255 time=50 ms
Reply from 10.0.12.13: bytes=56 Sequence=4 ttl=255 time=40 ms
Reply from 10.0.12.13: bytes=56 Sequence=5 ttl=255 time=30 ms
[Huawei-Ethernet0/0/0]display arp
IP ADDRESS MAC ADDRESS EXPIRE(M) TYPE INTERFACE VPN-INSTANCE
VLAN/CEVLAN PVC
------------------------------------------------------------------------------
10.0.12.14 5489-98e6-4c16 I - Eth0/0/0
10.0.12.13 5489-98d2-47cf 20 D-0 Eth0/0/0
------------------------------------------------------------------------------
Total:2 Dynamic:1 Static:0 Interface:1
[Huawei-Ethernet0/0/0]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.12.12/30 Direct 0 0 D 10.0.12.14 Ethernet0/0/0
10.0.12.14/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0
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