路由重釋出
為什麼要采用路由重釋出?
在一個大型的企業網絡中可能會采用不同的路由協定(rip,ospf,static),為了實作多種路由協定的協同工作,路由器可以通過路由的重分發将學到的一種路由協定重分發到另外的一種路由協定中,進而使得整個網絡可以互相連通。
拓撲圖:
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIn5GcuETM4cDM2UTMy8CXwEjMxAjMvwFduVWboNWY0RXYvwVbvNmLvR3YxUjL0M3Lc9CX6MHc0RHaiojIsJye.png)
R1路由重釋出的配置:
r1#show running-config
Building configuration...
Current configuration : 919 bytes
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
hostname r1
interface FastEthernet0/0
ip address 192.168.3.1 255.255.255.0
duplex auto
speed auto
interface FastEthernet0/1
ip address 192.168.1.2 255.255.255.0
!
interface Serial0/0/0
ip address 192.168.4.1 255.255.255.0
clock rate 9600
router ospf 1 ###在ospf路由協定中重新釋出rip, connected,static等路由協定###
log-adjacency-changes
redistribute rip subnets
redistribute static
redistribute connected
network 192.168.3.0 0.0.0.255 area 0
router rip###在rip路由協定中重新釋出ospf, connected,static等路由協定###
redistribute ospf 1 metric 3
redistribute static metric 1
redistribute connected metric 1
network 192.168.1.0
ip classless
ip route 0.0.0.0 0.0.0.0 192.168.4.2
line con 0
line vty 0 4
login
路由未重釋出前:
各路由器的路由表:
R0路由器
r0#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
C 192.168.1.0/24 is directly connected, FastEthernet0/1
C 192.168.2.0/24 is directly connected, Loopback0
r0#
R1路由器
r1#show ip route
Gateway of last resort is 192.168.4.2 to network 0.0.0.0
R 192.168.2.0/24 [120/1] via 192.168.1.1, 00:00:06, FastEthernet0/1rip學到的r0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
C 192.168.4.0/24 is directly connected, Serial0/0/0
192.168.5.0/32 is subnetted, 1 subnets
O 192.168.5.1 [110/2] via 192.168.3.2, 00:23:05, FastEthernet0/0ospf學到的r2
S* 0.0.0.0/0 [1/0] via 192.168.4.2
r1#
R2路由器
r2#show ip rou
r2#show ip route
C 192.168.5.0/24 is directly connected, Loopback0
R3路由器
r3#show ip route
* - candidate default, U - per-user static route, o - ODR
Gateway of last resort is 192.168.4.1 to network 0.0.0.0
C 192.168.6.0/24 is directly connected, Loopback0
S* 0.0.0.0/0 [1/0] via 192.168.4.1
路由重釋出後:
R0路由器(發生變化)
Gateway of last resort is 192.168.1.2 to network 0.0.0.0
R 192.168.3.0/24 [120/3] via 192.168.1.2, 00:06:43, FastEthernet0/1 ospf
R 192.168.4.0/24 [120/1] via 192.168.1.2, 00:10:59, FastEthernet0/1直連
R 192.168.5.0/24 [120/3] via 192.168.1.2, 00:06:43, FastEthernet0/1 ospf
R* 0.0.0.0/0 [120/1] via 192.168.1.2, 00:10:41, FastEthernet0/1 靜态
R1路由器(未發生變化)
R 192.168.2.0/24 [120/1] via 192.168.1.1, 00:00:14, FastEthernet0/1
O 192.168.5.1 [110/2] via 192.168.3.2, 00:43:15, FastEthernet0/0
R2路由器(發生變化)
O E2 192.168.1.0/24 [110/20] via 192.168.3.1, 00:09:45, FastEthernet0/0
O E2 192.168.2.0/24 [110/20] via 192.168.3.1, 00:09:12, FastEthernet0/0
O E2 192.168.4.0/24 [110/20] via 192.168.3.1, 00:09:45, FastEthernet0/0
r2#
r3#
測試連通性
R0---R2
r0#ping 192.168.5.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.5.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 62/62/63 ms
R0---R3
r0#ping 192.168.6.1
Sending 5, 100-byte ICMP Echos to 192.168.6.1, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 47/59/63 ms
R3---R0
r3#ping 192.168.2.1
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/59/63 ms
R3---R2
r3#ping 192.168.5.1
Success rate is 100 percent (5/5), round-trip min/avg/max = 62/65/79 ms
R2---R0
r2#ping 192.168.2.1
Success rate is 100 percent (5/5), round-trip min/avg/max = 46/58/62 ms
R2---R3(沒有ping同不知道為什麼,靜态路由沒有學習到)哪位大蝦請教下
r2#ping 192.168.6.1
.....
Success rate is 0 percent (0/5)
解決辦法:在r2上面配置一條預設路由
ip route 0.0.0.0 0.0.0.0 192.168.3.1
再次測試:
R2---R3(ping同)
後續:在R0路由器中
router ospf 1 ###在ospf路由協定中重新釋出rip, connected,static等路由協定###
default-information originate 增加這一條
然後檢視:
r2#show ip route
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, E - EGP
i - IS-IS, 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 192.168.3.1 to network 0.0.0.0
O E2 192.168.1.0/24 [110/20] via 192.168.3.1, 00:18:28, FastEthernet0/0
O E2 192.168.2.0/24 [110/20] via 192.168.3.1, 00:18:28, FastEthernet0/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
O E2 192.168.4.0/24 [110/20] via 192.168.3.1, 00:18:28, FastEthernet0/0
C 192.168.5.0/24 is directly connected, Loopback0
O*E2 0.0.0.0/0 [110/1] via 192.168.3.1, 00:00:30, FastEthernet0/0
資料下載下傳位址:http://down.51cto.com/data/547622