您好,登錄后才能下訂單哦!
Redistribute
Dynamips模擬器
Cisco IOS Software, 3700 Software (C3745-ADVIPSERVICESK9-M), Version 12.4(4)T, RELEASE SOFTWARE (fc1)
拓撲結構
如下圖所示,R1與R2之間使用靜態路由(默認路由),R1與R3之間使用RIP,R1與R4之間使用EIGRP,R1與R5之間使用OSPF。
操作過程如下
一、基本配置
按網絡拓撲圖設置端口IP,確保相鄰端口之間能夠相互ping通。
配置略。
二、路由配置
為方便測試,在配置動態路由時,使用no auto-summary命令關閉自動匯總(OSPF默認是不匯總的,也沒有no auto-summary命令)。
R1,各端口分別按要求配置不同的路由
R1(config)#ip route 2.2.2.0 255.255.255.0 192.168.2.2
R1(config)#router rip
R1(config-router)#net 192.168.3.0
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#exit
R1(config)#router eigrp 100
R1(config-router)#net 192.168.4.0
R1(config-router)#no auto-summary
R1(config-router)#exit
R1(config)#router ospf 1
R1(config-router)#net 192.168.5.0 0.0.0.255 area 0
R1(config-router)#exit
------------------------------------
R2,配置默認路由
R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.1
------------------------------------
R3,配置RIP
R3(config)#router rip
R3(config-router)#net 192.168.3.0
R3(config-router)#net 3.3.3.0
R3(config-router)#version 2
R3(config-router)#no auto-summary
R3(config-router)#exit
------------------------------------
R4,配置EIGRP
R4(config)#router eigrp 100
R4(config-router)#net 192.168.4.0
*Mar 1 00:17:48.019: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 192.168.4.1 (FastEthernet1/4) is up: new adjacency
R4(config-router)#net 4.4.4.0
R4(config-router)#no auto-summary
*Mar 1 01:08:34.239: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 192.168.4.1 (FastEthernet1/4) is resync: summary configured
R4(config-router)#exit
------------------------------------
R5,配置OSPF
R5(config)#router ospf 1
R5(config-router)#net 192.168.5.0 0.0.0.255 area 0
*Mar 1 00:19:05.547: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.5.1 on FastEthernet1/5 from LOADING to FULL, Loading Done
R5(config-router)#net 5.5.5.0 0.0.0.255 area 0
R5(config-router)#exit
------------------------------------
配置好路由后,因為R1處于網絡邊界,且同時運行了不同的路由協議,所在R1可以學習到整個網絡的完整路由。show ip route命令查看R1路由,如下:
R1#sh 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
2.0.0.0/24 is subnetted, 1 subnets
S 2.2.2.0 [1/0] via 192.168.2.2
3.0.0.0/24 is subnetted, 1 subnets
R 3.3.3.0 [120/1] via 192.168.3.3, 00:00:28, FastEthernet1/3
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/156160] via 192.168.4.4, 00:02:16, FastEthernet1/4
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/2] via 192.168.5.5, 01:09:20, FastEthernet1/5
C 192.168.4.0/24 is directly connected, FastEthernet1/4
C 192.168.5.0/24 is directly connected, FastEthernet1/5
C 192.168.2.0/24 is directly connected, FastEthernet1/2
C 192.168.3.0/24 is directly connected, FastEthernet1/3
------------------------------------
R2、R3、R4、R5之間,由于路由協議的不相同,當前情況下是相互看不到的。需要在R1上進行重分發。
三、配置重分發
重分發的配置是在邊界路由器,即R1上設置的。
1、靜態路由與RIP的重分發
R1(config)#router rip
R1(config-router)#redistribute connected !把直連路由分布到路由協議中
R1(config-router)#redistribute static !將靜態路由重分發到RIP中
------------------------------------
配置結束后,在R2仍然只能看默認路由,但R3上已經可以看到到達R2的路由了,并且R2 ping 3.3.3.3,R3 ping 2.2.2.2都是通的。
另外,配置結束后,在R3上也可以看到到達192.168.4.0、192.168.5.0網段的路由,但此時的R3并不能ping通R4、R5,是因為R1沒有對ospf、eigrp進行重分發。
查看此時R2和R3的路由表及ping測試:
R2#sh ip route
……
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
C 192.168.2.0/24 is directly connected, FastEthernet1/2
S* 0.0.0.0/0 [1/0] via 192.168.2.1
------------------------------------
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 = 16/34/64 ms
------------------------------------
R3#sh ip route
……
R 2.0.0.0/8 [120/1] via 192.168.3.1, 00:00:08, FastEthernet1/3
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
R 192.168.4.0/24 [120/1] via 192.168.3.1, 00:00:08, FastEthernet1/3
R 192.168.5.0/24 [120/1] via 192.168.3.1, 00:00:08, FastEthernet1/3
R 192.168.2.0/24 [120/1] via 192.168.3.1, 00:00:08, FastEthernet1/3
C 192.168.3.0/24 is directly connected, FastEthernet1/3
------------------------------------
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 = 16/39/64 ms
------------------------------------
2、靜態路由與EIGRP的重分發
R1(config)#router eigrp 100
R1(config-router)#redistribute connected
R1(config-router)#redistribute static !將靜態路由重分發到eigrp中
------------------------------------
配置結束后,在R2上仍然只能看默認路由,但R4上已經可以看見到達R2的路由了,并且R2 ping 4.4.4.4,R4 ping 2.2.2.2都是通的。
查看此時R4的路由表:
R4#sh ip route
……
2.0.0.0/24 is subnetted, 1 subnets
D EX 2.2.2.0 [170/30720] via 192.168.4.1, 01:14:10, FastEthernet1/4
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
C 192.168.4.0/24 is directly connected, FastEthernet1/4
D EX 192.168.5.0/24 [170/30720] via 192.168.4.1, 01:14:10, FastEthernet1/4
D EX 192.168.2.0/24 [170/30720] via 192.168.4.1, 01:14:10, FastEthernet1/4
D EX 192.168.3.0/24 [170/30720] via 192.168.4.1, 01:14:10, FastEthernet1/4
------------------------------------
3、靜態路由與OSPF的重分發
R1(config)#router ospf 1
R1(config-router)#redistribute connected
% Only classful networks will be redistributed
R1(config-router)#redistribute static subnets !將靜態路由重分發到ospf中
% Only classful networks will be redistributed
------------------------------------
注意,把路由重分發到OSPF中,后面要寫subnets選項,否則除主類以外的子網不能被重新分發進路由表。以上命令中,如果不加subnets字段,R2可ping 通5.5.5.5,但R5 ping 不通2.2.2.2(R5可以ping通R2)。
配置結束后,在R2上仍然只能看靜態路由(默認路由),但R5上已經可以看見到達R2的路由了,并且R2 ping 5.5.5.5,R5 ping 2.2.2.2都是通的。
查看此時R5的路由表:
R5#sh ip route
……
5.0.0.0/24 is subnetted, 1 subnets
C 5.5.5.0 is directly connected, Loopback0
O E2 192.168.4.0/24 [110/20] via 192.168.5.1, 01:14:13, FastEthernet1/5
C 192.168.5.0/24 is directly connected, FastEthernet1/5
O E2 192.168.2.0/24 [110/20] via 192.168.5.1, 01:14:13, FastEthernet1/5
O E2 192.168.3.0/24 [110/20] via 192.168.5.1, 01:14:13, FastEthernet1/5
------------------------------------
4、RIP與EIGRP重分發
R1(config)#router rip
R1(config-router)#redistribute eigrp 100 metric 10 !將eigrp重分發到rip
R1(config-router)#exit
R1(config)#router eigrp 100
R1(config-router)#redistribute rip metric 10000 100 255 1 1500 !將rip重分發到eigrp
------------------------------------
注意,將eigrp重分發到rip時,必須指明度量,即命令redistribute eigrp 100 metric 10,如果沒有“metric 10”,則R3看不到R4的路由。
重分發路由協議到eigrp時,也必須指度量,并且要指明帶寬等,命令“metric 10000 100 255 1 1500”中的五個參數一定要正確,否則會報錯“% Incomplete command”。這五個參數中,唯一可以修改的是帶寬值,可根據實際情況設置,其他4個參數不能改。五個參數如下:
Bandwidth in kilobytes=10000
Delay in 10s of microseconds=100
Reliability=255(maximum)
Loading=1(minimum)
Maximum Transmission Unit=1500
配置完成后,在R3、R4上可以看到彼此之間的路由了。
查看此時R3及R4的路由表:
R3#sh ip route
……
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0 [120/1] via 192.168.3.1, 00:00:23, FastEthernet1/3
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
4.0.0.0/24 is subnetted, 1 subnets
R 4.4.4.0 [120/10] via 192.168.3.1, 00:00:23, FastEthernet1/3
R 192.168.4.0/24 [120/1] via 192.168.3.1, 00:00:23, FastEthernet1/3
R 192.168.5.0/24 [120/1] via 192.168.3.1, 00:00:23, FastEthernet1/3
R 192.168.2.0/24 [120/1] via 192.168.3.1, 00:00:23, FastEthernet1/3
C 192.168.3.0/24 is directly connected, FastEthernet1/3
------------------------------------
R4#sh ip route
……
2.0.0.0/24 is subnetted, 1 subnets
D EX 2.2.2.0 [170/30720] via 192.168.4.1, 01:32:39, FastEthernet1/4
3.0.0.0/24 is subnetted, 1 subnets
D EX 3.3.3.0 [170/284160] via 192.168.4.1, 00:02:12, FastEthernet1/4
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
C 192.168.4.0/24 is directly connected, FastEthernet1/4
D EX 192.168.5.0/24 [170/30720] via 192.168.4.1, 01:32:39, FastEthernet1/4
D EX 192.168.2.0/24 [170/30720] via 192.168.4.1, 01:32:39, FastEthernet1/4
D EX 192.168.3.0/24 [170/30720] via 192.168.4.1, 01:32:39, FastEthernet1/4
------------------------------------
5、RIP與OSPF重分發
R1(config)#router rip
R1(config-router)#redistribute ospf 1 metric 10
R1(config-router)#exit
R1(config)#router ospf 1
R1(config-router)#redistribute rip metric 200 subnets
------------------------------------
注意,將ospf重分發到rip時,必須指明度量,即命令redistribute ospf 1 metric 10。
將rip重分發到ospf時,也必須指度量,并且使用subnets選項,否則R5看不到R3的路由。subnets選項可以確保RIP網絡中的無類子網路由能夠正確的被發布。
配置完成后,在R3、R5上可以看到彼此之間的路由了。
R3#sh ip route
……
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0 [120/1] via 192.168.3.1, 00:00:08, FastEthernet1/3
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
4.0.0.0/24 is subnetted, 1 subnets
R 4.4.4.0 [120/10] via 192.168.3.1, 00:00:08, FastEthernet1/3
5.0.0.0/32 is subnetted, 1 subnets
R 5.5.5.5 [120/10] via 192.168.3.1, 00:00:08, FastEthernet1/3
R 192.168.4.0/24 [120/1] via 192.168.3.1, 00:00:08, FastEthernet1/3
R 192.168.5.0/24 [120/1] via 192.168.3.1, 00:00:08, FastEthernet1/3
R 192.168.2.0/24 [120/1] via 192.168.3.1, 00:00:08, FastEthernet1/3
C 192.168.3.0/24 is directly connected, FastEthernet1/3
------------------------------------
R5#sh ip route
……
3.0.0.0/24 is subnetted, 1 subnets
O E2 3.3.3.0 [110/200] via 192.168.5.1, 00:00:43, FastEthernet1/5
5.0.0.0/24 is subnetted, 1 subnets
C 5.5.5.0 is directly connected, Loopback0
O E2 192.168.4.0/24 [110/20] via 192.168.5.1, 01:38:10, FastEthernet1/5
C 192.168.5.0/24 is directly connected, FastEthernet1/5
O E2 192.168.2.0/24 [110/20] via 192.168.5.1, 01:38:10, FastEthernet1/5
O E2 192.168.3.0/24 [110/20] via 192.168.5.1, 01:38:10, FastEthernet1/5
------------------------------------
6、EIGRP與OSPF重分發
R1(config)#router eigrp 100
R1(config-router)#redistribute ospf 1 metric 10000 100 255 1 1500
R1(config-router)#exit
R1(config)#router ospf 1
R1(config-router)#redistribute eigrp 100 metric 200 subnets
------------------------------------
注意,如前面所說,將路由向eigrp重分發時,帶寬、延遲等五個參數一定要正確。將路由向ospf重分發時,后面要寫subnets選項。
配置完成后,在R4、R5上可以看到彼此之間的路由了。
R4#sh ip route
……
2.0.0.0/24 is subnetted, 1 subnets
D EX 2.2.2.0 [170/30720] via 192.168.4.1, 01:51:06, FastEthernet1/4
3.0.0.0/24 is subnetted, 1 subnets
D EX 3.3.3.0 [170/284160] via 192.168.4.1, 00:20:39, FastEthernet1/4
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
5.0.0.0/32 is subnetted, 1 subnets
D EX 5.5.5.5 [170/284160] via 192.168.4.1, 00:03:03, FastEthernet1/4
C 192.168.4.0/24 is directly connected, FastEthernet1/4
D EX 192.168.5.0/24 [170/30720] via 192.168.4.1, 01:51:06, FastEthernet1/4
D EX 192.168.2.0/24 [170/30720] via 192.168.4.1, 01:51:06, FastEthernet1/4
D EX 192.168.3.0/24 [170/30720] via 192.168.4.1, 01:51:06, FastEthernet1/4
------------------------------------
R5#sh ip route
……
3.0.0.0/24 is subnetted, 1 subnets
O E2 3.3.3.0 [110/200] via 192.168.5.1, 00:07:21, FastEthernet1/5
4.0.0.0/24 is subnetted, 1 subnets
O E2 4.4.4.0 [110/200] via 192.168.5.1, 00:02:27, FastEthernet1/5
5.0.0.0/24 is subnetted, 1 subnets
C 5.5.5.0 is directly connected, Loopback0
O E2 192.168.4.0/24 [110/20] via 192.168.5.1, 01:50:19, FastEthernet1/5
C 192.168.5.0/24 is directly connected, FastEthernet1/5
O E2 192.168.2.0/24 [110/20] via 192.168.5.1, 01:50:19, FastEthernet1/5
O E2 192.168.3.0/24 [110/20] via 192.168.5.1, 01:50:19, FastEthernet1/5
------------------------------------
至此,整個網絡實現互通。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。