CCNA静态路由
?
1.帶下一跳的靜態路由:
-----------------------R1---------------------------- R1(config)#ip route 2.2.2.0 255.255.255.0 12.1.1.2 R1(config)#ip route 23.1.1.0 255.255.255.0 12.1.1.2 ? R1(config)#ip route 3.3.3.0 255.255.255.0 12.1.1.2? ----------------------R2----------------------------- R2(config)#ip route 1.1.1.0 255.255.255.0 12.1.1.1? R2(config)#ip route 3.3.3.0 255.255.255.0 23.1.1.3 ----------------------R3----------------------------- R3(config)#ip route 1.1.1.0 255.255.255.0 23.1.1.2 R3(config)#ip route 12.1.1.0 255.255.255.0 23.1.1.2 R3(config)#ip route 2.2.2.0 255.255.255.0 23.1.1.2? 驗證實驗結果: R1#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 56/60/64 ms R2#ping 1.1.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 ms R2#ping 3.3.3.3? Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 ms R3#ping 1.1.1.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 60/61/68 ms R3#ping 2.2.2.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 m ======================================================================== 2. 匯總的實現: R2(config)#int looPback 0 R2(config-if)#ip add 2.2.1.2 255.255.255.0 secondary? R1(config)#no ?ip route 2.2.2.0 255.255.255.0 12.1.1.2 R1(config)#ip route 2.2.0.0 255.255.252.0 12.1.1.2//手動配置匯總 驗證: R1#ping 2.2.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.1.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 ms R1#ping 2.2.2.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 32/34/36 ms ======================================================================== 3.浮動靜態路由的配置: R1(config)#ip route 2.2.0.0 255.255.252.0 10.1.1.2//還沒有修改管理距離值。 R1#show ip route static 2.0.0.0/22 is subnetted, 1 subnets S ? ? ? 2.2.0.0 [1/0] via 12.1.1.2 [1/0] via 10.1.1.2 3.0.0.0/24 is subnetted, 1 subnets S ? ? ? 3.3.3.0 [1/0] via 12.1.1.2 23.0.0.0/24 is subnetted, 1 subnets S ? ? ? 23.1.1.0 [1/0] via 12.1.1.2 R1(config)#ip route 2.2.0.0 255.255.252.0 10.1.1.2 100//把管理距離值改位100,默認情況下為1. R1#show ip route static? 2.0.0.0/22 is subnetted, 1 subnets S ? ? ? 2.2.0.0 [1/0] via 12.1.1.2 3.0.0.0/24 is subnetted, 1 subnets S ? ? ? 3.3.3.0 [1/0] via 12.1.1.2 23.0.0.0/24 is subnetted, 1 subnets S ? ? ? 23.1.1.0 [1/0] via 12.1.1.2 *沒有顯示10.1.1.0網段的信息。 當把串口網段關閉以后,我們再來看看: R1#show ip route static? 2.0.0.0/22 is subnetted, 1 subnets S ? ? ? 2.2.0.0 [100/0] via 10.1.1.2 *這時以太網網段浮了起來,實現浮動靜態路由。 ======================================================================== 4.帶送出接口的靜態路由: R1(config)#ip route 2.2.0.0 255.255.252.0 e0 R1(config)#ip route 23.1.1.0 255.255.255.0 e0 R1(config)#ip route 3.3.3.0 255.255.255.0 e0? R2(config)#ip route 1.1.1.0 255.255.255.0 e0 R2(config)#ip route 3.3.3.0 255.255.255.0 s1 R3(config)#ip route 1.1.1.0 255.255.255.0 s0 R3(config)#ip route 10.1.1.0 255.255.255.0 s0 R3(config)#ip route 2.2.0.0 255.255.252.0 s0? 1)驗證: R1#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 32/33/36 ms R1#ping 2.2.2.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 4/5/8 ms 2)以太網的帶送出接口需要代理arp的協助,不然無法實現: R1#debug arp ARP packet debugging is on R1#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: *Mar ?1 01:08:48.175: IP ARP: creating incomplete entry for IP address: 3.3.3.3 interface Ethernet0 *Mar ?1 01:08:48.179: IP ARP: sent req src 10.1.1.1 0000.0c91.7df5, dst 3.3.3.3 0000.0000.0000 Ethernet0 *Mar ?1 01:08:48.191: IP ARP: rcvd rep src 3.3.3.3 00e0.1e68.1b5b, dst 10.1.1.1 Ethernet0.!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 32/40/48 ms R1#show arp Protocol ?Address ? ? ? ? ?Age (min) ?Hardware Addr ? Type ? Interface Internet ?3.3.3.3 ? ? ? ? ? ? ? ? 1 ? 00e0.1e68.1b5b ?ARPA ? Ethernet0 Internet ?10.1.1.1 ? ? ? ? ? ? ? ?- ? 0000.0c91.7df5 ?ARPA ? Ethernet0 R2#show int e0 Ethernet0 is up, line protocol is up? Hardware is Lance, address is 00e0.1e68.1b5b (bia 00e0.1e68.1b5b) *R2代理轉發3.3.3.3的數據。 當關閉代理arp的功能以后,將無法轉發數據: R2(config)#int e0 R2(config-if)#no ip proxy-arp //關閉代理arp的功能。 R1#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: *Mar ?1 01:12:54.479: IP ARP: creating incomplete entry for IP address: 3.3.3.3 interface Ethernet0 *Mar ?1 01:12:54.483: IP ARP: sent req src 10.1.1.1 0000.0c91.7df5, dst 3.3.3.3 0000.0000.0000 Ethernet0. *Mar ?1 01:12:56.479: IP ARP: sent req src 10.1.1.1 0000.0c91.7df5, dst 3.3.3.3 0000.0000.0000 Ethernet0. *Mar ?1 01:12:58.479: IP ARP: sent req src 10.1.1.1 0000.0c91.7df5, dst 3.3.3.3 0000.0000.0000 Ethernet0. *Mar ?1 01:13:00.479: IP ARP: sent req src 10.1.1.1 0000.0c91.7df5, dst 3.3.3.3 0000.0000.0000 Ethernet0. *Mar ?1 01:13:02.479: IP ARP: sent req src 10.1.1.1 0000.0c91.7df5, dst 3.3.3.3 0000.0000.0000 Ethernet0. Success rate is 0 percent (0/5) *無法學習到mac地址,和無法轉發數據。 3)下面我們來看看串口的帶送出接口的靜態路由: R1(config)#ip route 2.2.0.0 255.255.252.0 s0 R1(config)#ip route 3.3.3.0 255.255.255.0 s0 R1(config)#ip route 23.1.1.0 255.255.255.0 s0 R2(config)#ip route 1.1.1.0 255.255.255.0 s0 R3(config)#ip route 12.1.1.0 255.255.255.0 s0 我們把R2的代理arp功能關閉,并且把e0口shutdown以后再來驗證一下: R2(config)#int s0 R2(config-if)#no ip PROxy-arp R1#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 60/60/60 ms *串口是不需要代理arp的協助的,因為串口是點對點的鏈路,而且串口是沒有mac地址的。 ========================================================================5.實現負載均衡: R1#show ip route static? 2.0.0.0/22 is subnetted, 1 subnets S ? ? ? 2.2.0.0 is directly connected, Serial0 is directly connected, Ethernet0 3.0.0.0/24 is subnetted, 1 subnets S ? ? ? 3.3.3.0 is directly connected, Serial0 is directly connected, Ethernet0 23.0.0.0/24 is subnetted, 1 subnets S ? ? ? 23.1.1.0 is directly connected, Serial0 is directly connected, Ethernet0 每個網段都有兩條路徑,要走哪條路徑,關鍵是看路由器的轉發的功能。 R1#traceroute 3.3.3.3 ?//跟蹤路由轉發的路徑。 Type escape sequence to abort. Tracing the route to 3.3.3.3 1 ?*? 12.1.1.2 16 msec *? 2 23.1.1.3 40 msec * ?28 msec =========================================================================================================== 6.默認路由的配置: R1(config)#ip ?route 0.0.0.0 0.0.0.0 s0 //無路可走的時候才會使用到的路由。 R1#debug ip packet? IP packet debugging is on R1#ping 3.3.3.8 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.8, timeout is 2 seconds: *Mar ?1 01:43:22.979: IP: tableid=0, s=12.1.1.1 (local), d=3.3.3.8 (Serial0), routed via RIB *Mar ?1 01:43:22.983: IP: s=12.1.1.1 (local), d=3.3.3.8 (Serial0), len 100, sending. *Mar ?1 01:43:24.979: IP: tableid=0, s=12.1.1.1 (local), d=3.3.3.8 (Serial0), routed via RIB *Mar ?1 01:43:24.983: IP: s=12.1.1.1 (local), d=3.3.3.8 (Serial0), len 100, sending. *Mar ?1 01:43:26.979: IP: tableid=0, s=12.1.1.1 (local), d=3.3.3.8 (Serial0), routed via RIB *Mar ?1 01:43:26.983: IP: s=12.1.1.1 (local), d=3.3.3.8 (Serial0), len 100, sending. *Mar ?1 01:43:28.979: IP: tableid=0, s=12.1.1.1 (local), d=3.3.3.8 (Serial0), routed via RIB *Mar ?1 01:43:28.983: IP: s=12.1.1.1 (local), d=3.3.3.8 (Serial0), len 100, sending. *Mar ?1 01:43:30.979: IP: tableid=0, s=12.1.1.1 (local), d=3.3.3.8 (Serial0), routed via RIB *Mar ?1 01:43:30.983: IP: s=12.1.1.1 (local), d=3.3.3.8 (Serial0), len 100, sending. R1#show ip route static 2.0.0.0/22 is subnetted, 1 subnets S ? ? ? 2.2.0.0 is directly connected, Serial0 3.0.0.0/24 is subnetted, 1 subnets S ? ? ? 3.3.3.0 is directly connected, Serial0 23.0.0.0/24 is subnetted, 1 subnets S ? ? ? 23.1.1.0 is directly connected, Serial0 S* ? 0.0.0.0/0 is directly connected, Serial0//缺省路由 =========================================================================================================== 7.各種靜態路由的優先級別的比較: 5、各種靜態路由的優先級別: 1)正常的靜態路由 ? 2)帶送出接口的 3)主機路由 4)缺省路由 5)匯總路由 R1(config)#ip route 2.2.0.0 255.255.252.0 12.1.1.2 //匯總的路由 R1(config)#ip route 2.2.2.2 255.255.255.255 12.1.1.2 //主機路由 R1(config)#ip route 2.2.0.0 255.255.252.0 s0 ?//帶送出接口的路由 R1(config)#ip ?route 0.0.0.0 0.0.0.0 s0 //缺省的路由 R1(config)#ip route 2.2.2.0 255.255.255.0 12.1.1.2//正常的帶下一跳的路由 拿R1和R2來做比較優先級: R1#show ip route static? S* ? 0.0.0.0/0 is directly connected, Serial0 R1#traceroute 2.2.2.2 Type escape sequence to abort. Tracing the route to 2.2.2.2 1 12.1.1.2 20 msec * ?16 msec R1(config)#ip route 2.2.2.0 255.255.255.0 10.1.1.2 //配置正常的帶下一跳的路由 R1#traceroute 2.2.2.2 Type escape sequence to abort. Tracing the route to 2.2.2.2 1 10.1.1.2 4 msec * ?4 msec *帶一下跳的路由優于缺省路由。 R1(config)#ip route 2.2.0.0 255.255.255.0 12.1.1.2//配置匯總路由 R1#traceroute 2.2.2.2 Type escape sequence to abort. Tracing the route to 2.2.2.2 1 10.1.1.2 8 msec * ?4 msec *帶下一跳的路由優于匯總路由 R1(config)#ip route 2.2.2.2 255.255.255.255 12.1.1.2 //配置主機路由 R1#traceroute 2.2.2.2 Type escape sequence to abort. Tracing the route to 2.2.2.2 1 12.1.1.2 20 msec * ?16 msec *主機路由優于帶下一跳的路由 R1(config)#ip route 2.2.2.0 255.255.255.0 e0// R1#traceroute 2.2.2.2 Type escape sequence to abort. Tracing the route to 2.2.2.2 1 12.1.1.2 16 msec * ?16 msec *主機路由優于帶送出接口的路由。轉載于:https://blog.51cto.com/yb2010/552253
總結
- 上一篇: “好的软件人员一生必看的六十本书”
- 下一篇: COM学习笔记01