天天看點

實驗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 選項