天天看点

实验4 IP路由研究――静态路由

作者:zieckey([email protected])

All Rights Reserved  

1.   实验目的 1)        掌握静态路由的配置方法 2)        掌握路由总结的实现原理 3)        比较 ip default-network 命令和 ip route 0.0.0.0 0.0.0.0 命令设置路由的实现方法和实现特点 2.   实验原理 静态路由是在路由器中设置的固定的路由表。除非网络管理员干预,否则静态路由不会发生变化。由于静态路由不能对网络的改变作出反映,一般用于网络规模不大、拓扑结构固定的网络中。静态路由的优点是简单、高效、可靠。在所有的路由中,静态路由优先级最高。当动态路由与静态路由发生冲突时,以静态路由为准。 3.   实验过程 3.1.配置路由器各个接口IP地址 London(config)#interface s0/0/1 London(config-if)#ip address 10.3.3.1 255.255.255.0 London(config-if)#no shutdown London(config)#interface loopback 0 London(config-if)#ip address 10.1.1.1 255.255.255.0 London(config-if)#no shutdown London(config-if)#exit London(config)#interface loopback 1 London(config-if)#ip address 10.2.2.1 255.255.255.0 London(config-if)#no shutdown London(config-if)#exit London(config)#exit London#show CDP neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge                   S - Switch, H - Host, I - IGMP, r - Repeater   Device ID        Local Intrfce     Holdtme    Capability Platform Port ID Denver           Ser 0/0/0          174        R S I      2811      Ser 0/0/1 sw5              Fas 0/1            130         S I       WS-C3560- Fas 0/3 Florence         Ser 0/0/1          175        R S I      2811      Ser 0/0/0 3.2.配置静态路由 Enter configuration commands, one per line. End with CNTL/Z. London(config)#ip route 172.16.3.0 255.255.255.0 10.3.3.2 London(config)#ip route 172.16.1.0 255.255.255.0 10.3.3.2 London(config)#ip route 192.168.1.0 255.255.255.0 10.3.3.2 London(config)#ip route 172.16.2.0 255.255.255.22410.3.3.2     London#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2        E1 - OSPF external type 1, E2 - OSPF external type 2        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2        ia - IS-IS inter area, * - candidate default, U - per-user static route        o - ODR, P - periodic downloaded static route   Gateway of last resort is not set    *   172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks S       172.16.1.0/24 [1/0] via 10.3.3.2 S       172.16.2.0/31 [1/0] via 10.3.3.2 S       172.16.3.0/24 [1/0] via 10.3.3.2      10.0.0.0/24 is subnetted, 3 subnets C       10.3.3.0 is directly connected, Serial0/0/1 C      10.2.2.0 is directly connected, Loopback1 C       10.1.1.0 is directly connected, Loopback0 S    192.168.1.0/24 [1/0] via 10.3.3.2 C    192.168.100.0/24 is directly connected, FastEthernet0/1   3.3.进行路由总结 London(config)#no ip route 172.16.1.0 255.255.255.0 10.3.3.2 London(config)#no ip route 172.16.2.0 255.255.255.224 10.3.3.2 London(config)#no ip route 172.16.3.0 255.255.255.0 10.3.3.2 London#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2        E1 - OSPF external type 1, E2 - OSPF external type 2        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2        ia - IS-IS inter area, * - candidate default, U - per-user static route        o - ODR, P - periodic downloaded static route   Gateway of last resort is not set        10.0.0.0/24 is subnetted, 3 subnets C       10.3.3.0 is directly connected, Serial0/0/1 C       10.2.2.0 is directly connected, Loopback1 C       10.1.1.0 is directly connected, Loopback0 S    192.168.1.0/24 [1/0] via 10.3.3.2 C    192.168.100.0/24 is directly connected, FastEthernet0/1   London(config)#ip route 172.16.0.0 255.255.0.0 10.3.3.2 London(config)#ip route 172.16.0.0 255.255.252.0 10.3.3.2 London(config)# London#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2        E1 - OSPF external type 1, E2 - OSPF external type 2        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2        ia - IS-IS inter area, * - candidate default, U - per-user static route        o - ODR, P - periodic downloaded static route   Gateway of last resort is 10.3.3.2 to network 172.16.0.0    *   172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks S       172.16.0.0/22 [1/0] via 10.3.3.2 S*      172.16.0.0/16 [1/0] via 10.3.3.2      10.0.0.0/24 is subnetted, 3 subnets C       10.3.3.0 is directly connected, Serial0/0/1 C       10.2.2.0 is directly connected, Loopback1 C       10.1.1.0 is directly connected, Loopback0 S    192.168.1.0/24 [1/0] via 10.3.3.2 C    192.168.100.0/24 is directly connected, FastEthernet0/1   3.4.去掉上一步中所配置的路由,使用默认路由 London(config)#no ip route 172.16.0.0 255.255.252.0 10.3.3.2 London(config)#ip route 0.0.0.0 0.0.0.0 10.3.3.2 London(config)# London#ping 172.16.1.1   Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 40/43/44 ms London#ping 172.16.3.1   Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.3.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 44/44/44 ms London#ping 172.16.2.1   Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 40/43/44 ms London#   4.   实验分析与总结 通过这次实验让我们更深刻的了解了路由表中静态路由的用法和好处。同时我们又多接触了一些 Cisco IOS 命令。 下面对静态路由总结一下: 当一个局域网内存在 2 台以上的路由器时,由于其下主机互访的需求,往往需要设置路由。由于网络规模较小且不经常变动,所以静态路由是最合适的选择。   随着宽带接入的普及,很多家庭和小企业都组建了局域网来共享宽带接入。而且随着局域网规模的扩大,很多地方都涉及到 2 台或以上路由器的应用。当一个局域网内存在 2 台以上的路由器时,由于其下主机互访的需求,往往需要设置路由。由于网络规模较小且不经常变动,所以静态路由是最合适的选择。   配置静态路由的语法 , 在全局配置模式下使用 : ip route prefix mask {next-hop address|inte***ce} [distance] [permanent]

看下各个参数的含义 :

prefix mask: 要加进路由表中去的远程网络及其子网掩码

next-hop address: 下一跳地址

inte***ce: 到达目标网络的本地路由器的出口

distance: 管理距离 (AD), 可选

permanent: 路由条目永久保存在路由表中 , 即使路由器的接口 down 掉了

注意 , 一般只在点对点的连接中使用 inte***ce 选项 , 否则应该使用 next-hop address 选项