静态路由(Static routes)
版权声明:原创作品,谢绝转载!否则将追究法律责任。 |
一、在下列情况下,可使用静态路由:
1、链路的带宽较低(如拨号链路),不希望它们传输动态路由选择更新。
2、管理员想完全控制路由器使用的路由。
3、需要为动态路由提供一条备用路由。
4、前往只有一条路径可以到达的网络(末节网络)时。
5、路由器不够强大,没有足够的CPU或内存资源来运行动态路由选择协议。
6、需要让路由器看来,路由是一个直连网络。
二、配置静态路由:
1、网络拓扑:
![]() 2、RA的配置如下:
Router(config)#hostname RA
RA(config)#interface ethernet 0/0 RA(config-if)#ip address 192.168.20.1 255.255.255.0 RA(config-if)#no shutdown %LINK-3-UPDOWN: Interface Ethernet0, changed state to up RA(config-if)#exit RA(config)#interface serial 0
RA(config-if)#ip address 10.10.10.1 255.255.255.252 RA(config-if)#clock rate 64000 RA(config-if)#no shutdown %LINK-3-UPDOWN: Interface Serial0, changed state to up RA(config-if)#exit RA(config)#ip route 192.168.10.0 255.255.255.0 10.10.10.2
RA(config)#exit RA#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK] ===================================================================
3、RB的配置如下:
Router(config)#hostname RB
RB(config)#interface ethernet 0/0 RB(config-if)#ip address 192.168.10.1 255.255.255.0 RB(config-if)#no shutdown %LINK-3-UPDOWN: Interface Ethernet0, changed state to up RB(config-if)#exit RB(config)#interface serial 0
RB(config-if)#ip address 10.10.10.2 255.255.255.252 RB(config-if)#no shutdown %LINK-3-UPDOWN: Interface Serial0, changed state to up RB(config-if)#exit RB(config)#ip route 192.168.20.0 255.255.255.0 10.10.10.1
RB(config)#exit
RB#copy run start Destination filename [startup-config]? Building configuration... [OK] ===================================================================
4、验证以上配置:
RA:
RA#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default U - per-user static route Gateway of last resort is not set
C 192.168.20.0 is directly connected, Ethernet0
10.0.0.0/30 is subnetted, 1 subnets C 10.10.10.0 is directly connected, Serial0 S 192.168.10.0 [1/0] via 10.10.10.2 RA#ping 192.168.10.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms RA#ping 192.168.20.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms RA#ping 10.10.10.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms RA#ping 10.10.10.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
RB:
RB#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default U - per-user static route Gateway of last resort is not set
C 192.168.10.0 is directly connected, Ethernet0
10.0.0.0/30 is subnetted, 1 subnets C 10.10.10.0 is directly connected, Serial0 S 192.168.20.0 [1/0] via 10.10.10.1 RB#ping 192.168.20.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms RB#ping 192.168.10.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms RB#ping 10.10.10.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms RB#ping 10.10.10.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms 本文出自 “Uione” 博客,谢绝转载! 本文出自 51CTO.COM技术博客 |



weiqijun
博客统计信息
热门文章
最新评论
友情链接
