動態路由的配置記錄基於cisco模擬器 Packet Tracer Student 6.2 ,一下是實踐以及具體內容
拓撲結構基本如圖所示:
RIP協議
RIP協議現有兩個版本,v1和v2 ,
命令 | 功能 | 命令 | 功能 |
router rip | 指定使用RIP協議 | show ip route | 查看路由表信息 |
version {1|2} | 指定RIP版本 | show ip route rip | 查看RIP協議的路由信息 |
network network | 指定改路由器相連的網絡 | show ip protocol | 查看路由協議的配置信息 |
兩個版本的區別在於:
v1 不支持變長的子網掩碼, 同時會將IP地址自動匯總
v2 支持變長的子網掩碼,同時能夠關閉自動匯總
RIPv1
1 Router(config)#router rip 2 Router(config-router)#version 1 //選擇rip的版本,默認為 1 版本 3 Router(config-router)#do show ip route //查看直連網絡 4 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 5 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 6 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 7 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 8 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 9 * - candidate default, U - per-user static route, o - ODR 10 P - periodic downloaded static route 11 12 Gateway of last resort is not set 13 14 1.0.0.0/24 is subnetted, 1 subnets 15 C 1.1.1.0 is directly connected, FastEthernet0/0 16 192.168.1.0/30 is subnetted, 1 subnets 17 C 192.168.1.0 is directly connected, Serial0/0/0 18 19 Router(config-router)#network 1.1.1.0 ? //從此處能夠發現ripv1 的宣告規則 20 <cr> 21 Router(config-router)#network 1.1.1.0 22 Router(config-router)#network 192.168.1.0
通過ripv1來宣告路由方法如上
RIPv2
1 Router(config)#router rip 2 Router(config-router)#version 2 //選擇rip 2版本 3 Router(config-router)#no auto-summary //關閉自動匯總 4 Router(config-router)#network 1.1.1.0 ? 5 <cr> 6 Router(config-router)#network 1.1.1.0 7 Router(config-router)#network 192.168.1.0
RIPv2 與RIPv1 配置方法均較為簡單,但要注意最多支持15個路由器
除此之外有些共通的命令
1 Router(config)#int loopback 0 //采用回環接口,相當於建立虛擬主機 2 3 Router(config-if)# 4 %LINK-5-CHANGED: Interface Loopback0, changed state to up 5 6 %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up 7 8 Router(config-if)#ip address 15.15.15.15 255.255.255.255 9 Router(config-if)#do show ip route 10 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 11 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 12 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 13 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 14 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 15 * - candidate default, U - per-user static route, o - ODR 16 P - periodic downloaded static route 17 18 Gateway of last resort is not set 19 20 1.0.0.0/24 is subnetted, 1 subnets 21 C 1.1.1.0 is directly connected, FastEthernet0/0 22 15.0.0.0/32 is subnetted, 1 subnets 23 C 15.15.15.15 is directly connected, Loopback0 //在這里可以看到創建的回環地址 24 192.168.1.0/30 is subnetted, 1 subnets 25 C 192.168.1.0 is directly connected, Serial0/0/0
debug ip rip 顯示更新過程
1 Router(config-if)#do debug ip rip 2 RIP protocol debugging is on
no debug ip rip 關閉顯示更新過程
1 Router(config-if)#do no debug ip rip 2 RIP protocol debugging is off
passive-interface 禁止端口路由信息更新
Router(config-router)#passive-interface fastEthernet 0/0
rip中的路由重分發
Router(config-router)#default-information originate
rip中的動態路由注入
1 Router(config-router)#redistribute ? 2 connected Connected 3 eigrp Enhanced Interior Gateway Routing Protocol (EIGRP) //EIGRP協議 4 metric Metric for redistributed routes //重新分配路由的度量 5 ospf Open Shortest Path First (OSPF) //OSPF協議 6 rip Routing Information Protocol (RIP) //RIP協議 7 static Static routes //靜態路由
在rip中注入ospf
1 Router(config-router)#redistribute ospf ? 2 <1-65535> Process ID 3 Router(config-router)#redistribute ospf 1
在rip中注入EIGRP
1 Router(config-router)#redistribute eigrp ? 2 <1-65535> Autonomous system number 3 Router(config-router)#redistribute eigrp 1
ospf協議
命令 | 功能 |
router ospf process-id | 指定使用OSPF協議 |
network address wildcard-mask area area-id | 指定與該路由器相連的網段 |
show ip route | 查看路由表信息 |
show ip route ospf | 查看OSPF協議的路由信息 |
1 Router(config)#router ospf ? 2 <1-65535> Process ID 3 Router(config)#router ospf 1 //使用OSPF協議,並且創建進程 ID=1 4 Router(config-router)#do show ip route 5 6 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 7 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 8 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 9 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 10 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 11 * - candidate default, U - per-user static route, o - ODR 12 P - periodic downloaded static route 13 14 Gateway of last resort is not set 15 16 1.0.0.0/24 is subnetted, 1 subnets 17 C 1.1.1.0 is directly connected, FastEthernet0/0 18 192.168.1.0/30 is subnetted, 1 subnets 19 C 192.168.1.0 is directly connected, Serial0/0/0 20 21 Router(config-router)#network 1.1.1.0 255.255.255.0 area 0 //在OSPF 中區分區域 0區域稱為主干區域 使用並配置多個區域可減小鏈路狀態數據
22 Router(config-router)#network 192.168.1.0 255.255.255.252 area 0
OSPF中注入RIP
1 Router(config-router)#router ospf 1 2 Router(config-router)#redistribute r 3 Router(config-router)#redistribute rip ? 4 metric Metric for redistributed routes 5 metric-type OSPF/IS-IS exterior metric type for redistributed routes // 6 subnets Consider subnets for redistribution into OSPF //考慮將子網重新分配到OSPF中 7 tag Set tag for routes redistributed into OSPF //為路由重新分配到OSPF的路由設置標記 8 <cr> 9 Router(config-router)#redistribute rip subnets
OSPF注入EIGRP
1 Router(config-router)#REdistribute Eigrp ? 2 <1-65535> Autonomous system number 3 Router(config-router)#REdistribute Eigrp 1 ? 4 metric Metric for redistributed routes 5 metric-type OSPF/IS-IS exterior metric type for redistributed routes 6 subnets Consider subnets for redistribution into OSPF 7 tag Set tag for routes redistributed into OSPF 8 <cr> 9 Router(config-router)#REdistribute Eigrp 1 Subnets
端口下OSPF的控制
1 Router(config-if)#bandwidth ? //修改開銷值 2 <1-10000000> Bandwidth in kilobits 3 Router(config-if)#ip ospf hello-interval ? //修改hello包間隔時間 4 <1-65535> Seconds 5 Router(config-if)#ip ospf cost ? //指定接口開銷 6 <1-65535> Cost
EIGRP協議
命令 | 功能 |
router eigrp autonomous-system | 指定使用IGRP協議 |
network network | 指定與該路由器相連的網絡 |
show ip route | 查看路由表信息 |
show ip route eigrp | 查看IGRP協議的路由信息 |
1 Router(config)#router eigrp ? 2 <1-65535> Autonomous system number 3 Router(config)#router eigrp 1 4 Router(config-router)#no auto-summary 5 Router(config-router)#network 1.1.1.0 6 Router(config-router)#network 192.168.1.0
端口下EIGRP控制
1 Router(config-if)#ip summary-address ? 2 eigrp Enhanced Interior Gateway Routing Protocol (EIGRP) 3 Router(config-if)#ip summary-address eigrp ? 4 <1-65535> Autonomous system number 5 Router(config-if)#ip summary-address eigrp 1 ? 6 A.B.C.D IP address 7 //手動總結 8 Router(config-if)#ip hello-interval ? 9 eigrp Enhanced Interior Gateway Routing Protocol (EIGRP) 10 Router(config-if)#ip hello-interval e 11 Router(config-if)#ip hello-interval eigrp ? 12 <1-65535> Autonomous system number 13 Router(config-if)#ip hello-interval eigrp 1 ? 14 <1-65535> Seconds between hello transmissions
//設置hello 間隔和保留時間
EIGRP中的動態路由注入(以OSPF為例)
1 Router(config-router)#redistribute ospf 1 ? 2 match Redistribution of OSPF routes //OSPF路由重分布 3 metric Metric for redistributed routes //重新分配路由度量 4 <cr> 5 Router(config-router)#redistribute ospf 1 metric ? 6 <1-4294967295> Bandwidth metric in Kbits per second //帶寬度量 7 Router(config-router)#redistribute ospf 1 metric 64 ? 8 <0-4294967295> EIGRP delay metric, in 10 microsecond units //延遲 9 Router(config-router)#redistribute ospf 1 metric 64 10 ? 10 <0-255> EIGRP reliability metric where 255 is 100% reliable //可靠性 11 Router(config-router)#redistribute ospf 1 metric 64 10 255 ? 12 <1-255> EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded //有效帶寬加載 13 Router(config-router)#redistribute ospf 1 metric 64 10 255 1 ? 14 <1-65535> EIGRP MTU of the path //MTU路徑 15 Router(config-router)#redistribute ospf 1 metric 64 10 255 1 1