本帖最后由 碧云天 于 2020-3-1 16:46 编辑 一.测试拓扑测试总结:1.重分发路由的时候,作为重分布的路由器本身的路由表并不会发生改变
2.把ISIS重分发进其他路由,只是把从其他路由器学习到的ISIS路由进行重分布
3.除了ISIS,其他的动态路由协议,都是把本身宣告的网段路由和从其他路由器学习到的并打上对应路由标记的路由进行重分布
4.LSA不会反向传递,路由条目传递有水平分割,因此双向单点的路由重分发,不会出现路由反馈的情况
5.OSPF也支持入方向和出方向的distribute-list,但是与DV协议有差别
6.OSPF入方向的distribute-list,只是抑制路由条目加表,对本地有效,不能阻止LSA的传递,而出方向的distribute-list,不能加端口,能控制从外部引入的包含对应路由条目的5类LSA的发送(5类LSA包含的是纯路由信息)。
二.基本配置
1.R1路由器hostname R1
interface Loopback0
ip address 1.1.1.1 255.255.255.0
interface FastEthernet0/0
ip address 12.1.1.1 255.255.255.0
no shutdown
interface FastEthernet1/0
ip address 13.1.1.1 255.255.255.0
no shutdown
interface FastEthernet2/0
ip address 14.1.1.1 255.255.255.0
no shutdown
router eigrp 100
network 12.1.1.1 0.0.0.0
no auto-summary
router ospf 1
router-id 1.1.1.1
network 14.1.1.1 0.0.0.0 area 0
router rip
version 2
passive-interface Loopback0
network 1.0.0.0
network 13.0.0.0
no auto-summary
2.R2路由器hostname R2
interface Loopback0
ip address 2.2.2.2 255.255.255.0
interface FastEthernet0/0
ip address 12.1.1.2 255.255.255.0
no shutdown
router eigrp 100
passive-interface Loopback0
network 2.2.2.2 0.0.0.0
network 12.1.1.2 0.0.0.0
no auto-summary
3.R3路由器hostname R3
interface Loopback0
ip address 3.3.3.3 255.255.255.0
interface FastEthernet1/0
ip address 13.1.1.3 255.255.255.0
no shutdown
router rip
version 2
passive-interface Loopback0
network 3.0.0.0
network 13.0.0.0
no auto-summary
4.R4路由器hostname R4
interface Loopback0
ip address 4.4.4.4 255.255.255.0
interface FastEthernet2/0
ip address 14.1.1.4 255.255.255.0
no shutdown
router ospf 1
router-id 4.4.4.4
passive-interface Loopback0
network 4.4.4.4 0.0.0.0 area 0
network 14.1.1.4 0.0.0.0 area 0
三.配置路由重分发1.重分发之前先查看R1的路由R1#show ip route rip | begin Gate
Gateway of last resort is not set
3.0.0.0/24 is subnetted, 1 subnets
R 3.3.3.0 [120/1] via 13.1.1.3, 00:00:02, FastEthernet1/0
R1#
R1#show ip route ospf | begin Gate
Gateway of last resort is not set
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/2] via 14.1.1.4, 00:01:25, FastEthernet2/0
R1#
R1#show ip route eigrp | begin Gate
Gateway of last resort is not set
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/156160] via 12.1.1.2, 00:01:48, FastEthernet0/0
R1#
2.把RIP重分发进入OSPF①配置重分发R1(config)#router ospf 1
R1(config-router)#redistribute rip subnets
②配置完成后R1的路由没有变化R1#show ip route ospf | begin Gate
Gateway of last resort is not set
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/2] via 14.1.1.4, 00:08:12, FastEthernet2/0
R1#
③配置完成后,R4的OSPF路由增加了3条O E2的路由R4#show ip route ospf | begin Gate
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
O E2 1.1.1.0 [110/20] via 14.1.1.1, 00:02:50, FastEthernet2/0
3.0.0.0/24 is subnetted, 1 subnets
O E2 3.3.3.0 [110/20] via 14.1.1.1, 00:02:50, FastEthernet2/0
13.0.0.0/24 is subnetted, 1 subnets
O E2 13.1.1.0 [110/20] via 14.1.1.1, 00:02:50, FastEthernet2/0
R4#
3.把OSPF路由重分发进入EIGRP
①配置重分发R1(config)#router eigrp 100
R1(config-router)#redistribute ospf 1 metric 10000 100 1 255 1500
②配置完成后R1的路由没有变化R1#show ip route eigrp | begin Gate
Gateway of last resort is not set
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/156160] via 12.1.1.2, 00:11:28, FastEthernet0/0
R1#
③配置完成后,R2的EIGRP了2条D EX的路由R2#show ip route eigrp
4.0.0.0/32 is subnetted, 1 subnets
D EX 4.4.4.4 [170/284160] via 12.1.1.1, 00:01:12, FastEthernet0/0
14.0.0.0/24 is subnetted, 1 subnets
D EX 14.1.1.0 [170/284160] via 12.1.1.1, 00:01:12, FastEthernet0/0
R2#
备注:可以看到把ospf重分发进EIGRP,并没有把RIP路由一同分发进来。4.把EIGRP重分发OSPF
①配置重分发R1(config)#router ospf 1
R1(config-router)#redistribute eigrp 100 subnets
②配置完成后R1的路由没有变化R1#show ip route ospf | begin Gate
Gateway of last resort is not set
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/2] via 14.1.1.4, 00:07:49, FastEthernet2/0
R1#
③配置完成后,R4的OSPF路由增加了2条O E2的路由R4#show ip route ospf | begin Gate
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
O E2 1.1.1.0 [110/20] via 14.1.1.1, 00:05:29, FastEthernet2/0
2.0.0.0/24 is subnetted, 1 subnets
O E2 2.2.2.0 [110/20] via 14.1.1.1, 00:03:07, FastEthernet2/0
3.0.0.0/24 is subnetted, 1 subnets
O E2 3.3.3.0 [110/20] via 14.1.1.1, 00:05:29, FastEthernet2/0
12.0.0.0/24 is subnetted, 1 subnets
O E2 12.1.1.0 [110/20] via 14.1.1.1, 00:03:07, FastEthernet2/0
13.0.0.0/24 is subnetted, 1 subnets
O E2 13.1.1.0 [110/20] via 14.1.1.1, 00:05:29, FastEthernet2/0
R4#
5.把OSPF重分发到RIP
①配置重分发R1(config)#router rip
R1(config-router)#redistribute ospf 1 metric 2
②配置完成后R1的路由没有变化R1#show ip route rip | begin Gate
Gateway of last resort is not set
3.0.0.0/24 is subnetted, 1 subnets
R 3.3.3.0 [120/1] via 13.1.1.3, 00:00:12, FastEthernet1/0
R1#
③配置完成后,R3的RIP路由增加了2条RIP的路由R3#show ip route rip | begin Gate
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 13.1.1.1, 00:00:13, FastEthernet1/0
4.0.0.0/32 is subnetted, 1 subnets
R 4.4.4.4 [120/2] via 13.1.1.1, 00:00:13, FastEthernet1/0
14.0.0.0/24 is subnetted, 1 subnets
R 14.1.1.0 [120/1] via 13.1.1.1, 00:00:13, FastEthernet1/0
R3#
四.配置distribute-list备注:虽然distribute-list支持出方向和入方向,建议在路由始发最近位置部署1.使用distribute-list不让R3学习到4.4.4.4/32这条路由①R1配置出方向的distribute-listaccess-list 10 deny 4.4.4.4
access-list 10 permit any
router rip
distribute-list 10 out fastEthernet 1/0
②或者R3配置入方向的distribute-listaccess-list 10 deny 4.4.4.4
access-list 10 permit any
router rip
distribute-list 10 in fastEthernet 1/0
③验证效果R3#show ip route rip | begin Gate
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 13.1.1.1, 00:00:11, FastEthernet1/0
14.0.0.0/24 is subnetted, 1 subnets
R 14.1.1.0 [120/1] via 13.1.1.1, 00:00:11, FastEthernet1/0
R3#
2.使用distribute-list不让R4学习到3.3.3.0/24这条路由①执行前先查看R4的LSDBR4#show ip ospf database
OSPF Router with ID (4.4.4.4) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 4 0x80000003 0x00A157 1
4.4.4.4 4.4.4.4 2 0x80000004 0x003786 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
14.1.1.4 4.4.4.4 10 0x80000001 0x00EB16
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
1.1.1.0 1.1.1.1 51 0x80000001 0x00A5F3 0
2.2.2.0 1.1.1.1 46 0x80000001 0x008115 0
3.3.3.0 1.1.1.1 49 0x80000001 0x005D36 012.1.1.0 1.1.1.1 51 0x80000001 0x001678 0
13.1.1.0 1.1.1.1 52 0x80000001 0x000984 0
备注:可以看到链路状态数据库里面有3.3.3.0网段的5类LSA②R1配置出方向的distribute-listaccess-list 11 deny 3.3.3.0
access-list 11 permit any
router ospf 1
distribute-list 11 out
备注:OSPF的distribute-list的out方向不能配置接口③配置完成之后,在R1上能够看到,并且R4已经没有前面的5类LSAR1#show ip protocols | section ospf
Redistributing: ospf 1
Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is 11
Incoming update filter list for all interfaces is not set
Router ID 1.1.1.1
It is an autonomous system boundary router
Redistributing External Routes from,
eigrp 100, includes subnets in redistribution
rip, includes subnets in redistribution
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
14.1.1.1 0.0.0.0 area 0
Routing Information Sources:
Gateway Distance Last Update
4.4.4.4 110 00:16:47
Distance: (default is 110)
Redistributing: ospf 1 (internal, external 1 & 2, nssa-external 1 & 2)
R1#
R4#clear ip route *
R4#show ip ospf database
OSPF Router with ID (4.4.4.4) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 21 0x80000004 0x009F58 1
4.4.4.4 4.4.4.4 85 0x80000004 0x003786 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
14.1.1.4 4.4.4.4 93 0x80000001 0x00EB16
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
1.1.1.0 1.1.1.1 134 0x80000001 0x00A5F3 0
2.2.2.0 1.1.1.1 129 0x80000001 0x008115 0
12.1.1.0 1.1.1.1 134 0x80000001 0x001678 0
13.1.1.0 1.1.1.1 135 0x80000001 0x000984 0
R4#
④或者R4配置入方向的distribute-listaccess-list 11 deny 3.3.3.0
access-list 11 permit any
router ospf 1
distribute-list 11 in fastEthernet 2/0
备注:执行前后,R4的LSDB没有变化R4#show ip ospf database
OSPF Router with ID (4.4.4.4) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 73 0x80000005 0x009D59 1
4.4.4.4 4.4.4.4 527 0x80000004 0x003786 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
14.1.1.4 4.4.4.4 535 0x80000001 0x00EB16
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
1.1.1.0 1.1.1.1 576 0x80000001 0x00A5F3 0
2.2.2.0 1.1.1.1 571 0x80000001 0x008115 0
3.3.3.0 1.1.1.1 72 0x80000001 0x005D36 0
12.1.1.0 1.1.1.1 576 0x80000001 0x001678 0
13.1.1.0 1.1.1.1 577 0x80000001 0x000984 0
R4#
⑤验证效果R4#show ip route ospf | begin Gate
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
O E2 1.1.1.0 [110/20] via 14.1.1.1, 00:00:27, FastEthernet2/0
2.0.0.0/24 is subnetted, 1 subnets
O E2 2.2.2.0 [110/20] via 14.1.1.1, 00:00:27, FastEthernet2/0
12.0.0.0/24 is subnetted, 1 subnets
O E2 12.1.1.0 [110/20] via 14.1.1.1, 00:00:27, FastEthernet2/0
13.0.0.0/24 is subnetted, 1 subnets
O E2 13.1.1.0 [110/20] via 14.1.1.1, 00:00:27, FastEthernet2/0
R4#
3.使用distribute-list不让R1学习到2.2.2.0/24这条路由①R2配置出方向的distribute-listaccess-list 13 deny 2.2.2.0
access-list 13 permit any
router eigrp 100
distribute-list 13 out fastEthernet 0/0
②或者R1配置入方向的distribute-listaccess-list 13 deny 2.2.2.0
access-list 13 permit any
router eigrp 100
distribute-list 13 in fastEthernet 0/0
③验证效果R1#show ip route eigrp | begin Gate
Gateway of last resort is not set
R1#