实验拓扑
R1配置
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/0]
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.2.1 24
[R1-GigabitEthernet0/0/1]q
[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.2.3
R2配置
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.2.3 24
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.3.1 24
[R1-GigabitEthernet0/0/1]q
[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.2.1
交换机不用配置,交换机只是将这两个路由连起来,没什么卵用。
检测结果
PC1 ping
PC3
PC>ping 192.168.3.2
Ping 192.168.3.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
From 192.168.3.2: bytes=32 seq=3 ttl=126 time=94 ms
From 192.168.3.2: bytes=32 seq=4 ttl=126 time=94 ms
From 192.168.3.2: bytes=32 seq=5 ttl=126 time=109 ms
--- 192.168.3.2 ping statistics ---
5 packet(s) transmitted
3 packet(s) received
40.00% packet loss
round-trip min/avg/max = 0/99/109 ms