在R1上配置两条达到192.168.1.0 24 的路由条目:
[R1]ip route-static 192.168.1.0 24 12.1.1.2
[R1]ip route-static 192.168.1.0 24 12.1.1.2
得到如下路由表
[R1]dis ip routing-table
Destinations : 19 Routes : 20
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
12.1.1.0/30 Direct 0 0 12.1.1.1 Ser1/0
12.1.1.0/32 Direct 0 0 12.1.1.1 Ser1/0
12.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
12.1.1.2/32 Direct 0 0 12.1.1.2 Ser1/0
12.1.1.3/32 Direct 0 0 12.1.1.1 Ser1/0
23.1.1.0/30 Direct 0 0 23.1.1.1 Ser2/0
23.1.1.0/32 Direct 0 0 23.1.1.1 Ser2/0
23.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
23.1.1.2/32 Direct 0 0 23.1.1.2 Ser2/0
23.1.1.3/32 Direct 0 0 23.1.1.1 Ser2/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.0/24 Static 60 0 12.1.1.2 Ser1/0
23.1.1.2 Ser2/0
224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0
224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0
255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0
此时ping 通192.168.1.1,ping 不通192.168.1.2
dis ip routing-table 192.168.1.2 //显示到192.168.1.2的路由条目
由图可知,R1发往192.168.1.0/24网段的数据默认全部发给R2,在R1上ping 不通192.168.1.2,此时需要给R3配置到12.1.1.0/30网段的路由信息。
[R3]ip route-static 12.1.1.1 24 192.168.1.1