静态路由配置
Configureterminal
interfacefastEthernet 0/0
Ipaddress 192.168.12.1 255.255.255.0
No shut
Exit
Ip route 192.168.23.0 255.255.255.0 192.168.12.2 注:这里可以跟出站的接口
Iproute 192.168.34.0 255.255.255.0 192.168.23.3
Configuration :
R1:interfaceFastEthernet0/0ip address 192.168.12.1 255.255.255.0duplex autospeed autoip route192.168.23.0 255.255.255.0 192.168.12.2ip route192.168.34.0 255.255.255.0 192.168.23.3
R1#show ip route
Gateway of lastresort is not set
C 192.168.12.0/24 is directly connected,FastEthernet0/0S 192.168.23.0/24 via 192.168.12.2S 192.168.34.0/24 via 192.168.23.3
R2:interfaceFastEthernet0/0ip address 192.168.12.2 255.255.255.0duplex autospeed auto!interfaceFastEthernet0/1ip address 192.168.23.2 255.255.255.0duplex autospeed autoip route192.168.34.0 255.255.255.0 192.168.23.3
R2#show ip route
Gateway of lastresort is not set
C 192.168.12.0/24 is directly connected,FastEthernet0/0C 192.168.23.0/24 is directly connected,FastEthernet0/1S 192.168.34.0/24 via 192.168.23.3
R3:interfaceFastEthernet0/0ip address 192.168.23.3 255.255.255.0duplex autospeed auto!interfaceFastEthernet0/1ip address 192.168.34.3 255.255.255.0duplex autospeed auto!ip route192.168.12.0 255.255.255.0 192.168.23.2
R3#showip route
Gateway of lastresort is not set
S 192.168.12.0/24 via 192.168.23.2C 192.168.23.0/24 is directly connected,FastEthernet0/0C 192.168.34.0/24 is directly connected,FastEthernet0/1R4:interfaceFastEthernet0/0ip address 192.168.34.4 255.255.255.0duplex autospeed autoip route192.168.12.0 255.255.255.0 192.168.23.2ip route192.168.23.0 255.255.255.0 192.168.34.3
R4#show ip route
Gateway of lastresort is not set
S 192.168.12.0/24 via 192.168.23.2S 192.168.23.0/24 via 192.168.34.3C 192.168.34.0/24 is directly connected,FastEthernet0/0
注:静态路由在路由表中是以“S”开头的
测试:
R1#ping192.168.23.3 source 192.168.12.1 repeat 10
Type escapesequence to abort.Sending 10,100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:Packet sent with asource address of 192.168.12.1!!!!!!!!!!(能够正常回包)Success rate is100 percent (10/10), round-trip min/avg/max = 40/78/164 ms
R4#ping192.168.12.1 source 192.168.34.4 repeat 10
Type escapesequence to abort.Sending 10,100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:Packet sent with asource address of 192.168.34.4!!!!!!!!!!Success rate is100 percent (10/10), round-trip min/avg/max = 40/103/148 ms
第三种配置(出站接口跟下一跳IP地址)之后路由表出现的路由
23.0.0.0/24 is subnetted, 1 subnetsS 23.0.0.0 via 12.12.12.2, FastEthernet0/0我们可以看出这个是用出站接口跟NEXT-HOP address 所表示出来的路由表的不同
沙发!沙发! 走过了年少,脚起了水泡 禽兽尚且有半点怜悯之心,而我一点也没有,所以我不是禽兽。 生我之前谁是我,生我之后我是谁? 商女不知亡国恨、妓女不懂婚外情。 走自己的路,让别人打车去吧。
页:
[1]