三层通信过程解析
拓扑图
实验步骤
前半部分的步骤和三层交换机实验一致,就是多了一台路由器。
1.在LSW1上创建vlan30
[Huawei]vlan batch 10 20 30
[Huawei-Vlanif20]int vlan 30
[Huawei-Vlanif30]ip add 192.168.30.2 24
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 30
2.在LSW1上ping192.168.30.1
[Huawei]ping 192.168.30.1
PING 192.168.30.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.30.1: bytes=56 Sequence=1 ttl=255 time=60 ms
Reply from 192.168.30.1: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 192.168.30.1: bytes=56 Sequence=3 ttl=255 time=10 ms
Reply from 192.168.30.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.30.1: bytes=56 Sequence=5 ttl=255 time=40 ms
3.PC1上Ping 192.168.30.2
PC>ping 192.168.30.2
Ping 192.168.30.2: 32 data bytes, Press Ctrl_C to break
From 192.168.30.2: bytes=32 seq=1 ttl=255 time=31 ms
From 192.168.30.2: bytes=32 seq=2 ttl=255 time=47 ms
From 192.168.30.2: bytes=32 seq=3 ttl=255 time=31 ms
From 192.168.30.2: bytes=32 seq=4 ttl=255 time=16 ms
From 192.168.30.2: bytes=32 seq=5 ttl=255 time=31 ms
--- 192.168.30.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 16/31/47 ms
4.但是现在PC1和路由器AR1之间是无法Ping通的,还需要配置静态路由,告诉路由器192.168.10.0 和192.168.20.0需要从哪个接口发出去
[Huawei]ip route-static 192.168.10.0 24 192.168.30.2
[Huawei]ip route-static 192.168.20.0 24 192.168.30.2
5.PC去ping 路由器,成功
PC>ping 192.168.30.1
Ping 192.168.30.1: 32 data bytes, Press Ctrl_C to break
From 192.168.30.1: bytes=32 seq=1 ttl=254 time=62 ms
From 192.168.30.1: bytes=32 seq=2 ttl=254 time=63 ms
From 192.168.30.1: bytes=32 seq=3 ttl=254 time=62 ms
From 192.168.30.1: bytes=32 seq=4 ttl=254 time=63 ms
From 192.168.30.1: bytes=32 seq=5 ttl=254 time=62 ms
--- 192.168.30.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 62/62/63 ms