路由重發布redis
爲何要採用路由重發布?網絡
在一個大型的企業網絡中可能會採用不一樣的路由協議(rip,ospf,static),爲了實現多種路由協議的協同工做,路由器能夠經過路由的重分發將學到的一種路由協議重分發到另外的一種路由協議中,從而使得整個網絡能夠互相連通。less
拓撲圖:ide
R1路由重發布的配置:oop
r1#show running-config學習
Building configuration...測試
Current configuration : 919 bytesui
version 12.4spa
no service timestamps log datetime msecdebug
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
duplex auto
speed auto
!
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
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 192.168.4.2 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, FastEthernet0/1
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
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.3.0/24 is directly connected, FastEthernet0/0
C 192.168.5.0/24 is directly connected, Loopback0
R3路由器
r3#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 192.168.4.1 to network 0.0.0.0
C 192.168.4.0/24 is directly connected, Serial0/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路由器(發生變化)
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 192.168.1.2 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, FastEthernet0/1
C 192.168.2.0/24 is directly connected, Loopback0
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 靜態
r0#
R1路由器(未發生變化)
r1#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 192.168.4.2 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, FastEthernet0/1
R 192.168.2.0/24 [120/1] via 192.168.1.1, 00:00:14, FastEthernet0/1
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:43:15, FastEthernet0/0
S* 0.0.0.0/0 [1/0] via 192.168.4.2
R2路由器(發生變化)
r2#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
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
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:09:45, FastEthernet0/0
C 192.168.5.0/24 is directly connected, Loopback0
r2#
R3路由器
r3#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 192.168.4.1 to network 0.0.0.0
C 192.168.4.0/24 is directly connected, Serial0/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
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
Type escape sequence to abort.
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
r0#
R3---R0
r3#ping 192.168.2.1
Type escape sequence to abort.
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#
R3---R2
r3#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/65/79 ms
R2---R0
r2#ping 192.168.2.1
Type escape sequence to abort.
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 = 46/58/62 ms
R2---R3(沒有ping同不知道爲何,靜態路由沒有學習到)哪位大蝦請教下
r2#ping 192.168.6.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.6.1, timeout is 2 seconds:
.....
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同)
r2#ping 192.168.6.1
Type escape sequence to abort.
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
後續:在R0路由器中
router ospf 1 ###在ospf路由協議中從新發布rip, connected,static等路由協議###
log-adjacency-changes
redistribute rip subnets
redistribute static
default-information originate 增長這一條
redistribute connected
network 192.168.3.0 0.0.0.255 area 0
!
而後查看:
r2#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 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
R2---R3(ping同)
r2#ping 192.168.6.1
Type escape sequence to abort.
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
資料下載地址:http://down.51cto.com/data/547622