路由重发发布

路由重发布概念

· 将不同的自治系统他们之间的路由信息尽心交换
· 从一种协议到两外一种协议
· 同一种协议的不同实例
· 路由重发是针对外部的,自身的路由器不会有变化

拓扑

image-20210205130950362

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
R2#sh ip route     
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 192.168.12.1, 00:00:15, Ethernet0/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, Loopback0
L 2.2.2.2/32 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/11] via 192.168.23.3, 00:02:40, Ethernet0/1
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Ethernet0/0
L 192.168.12.2/32 is directly connected, Ethernet0/0
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Ethernet0/1
L 192.168.23.2/32 is directly connected, Ethernet0/1

R1#sh ip route
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback0
L 1.1.1.1/32 is directly connected, Loopback0
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Ethernet0/0
L 192.168.12.1/32 is directly connected, Ethernet0/0

R3#sh ip route
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/11] via 192.168.23.2, 00:00:12, Ethernet0/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Loopback0
L 3.3.3.3/32 is directly connected, Loopback0
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Ethernet0/0
L 192.168.23.3/32 is directly connected, Ethernet0/0

做双向重发布
R2(config-if-range)#router rip
R2(config-router)#ver 2
R2(config-router)#redistribute ospf 1 metric 5
R2(config-router)#router ospf 1
R2(config-router)#redistribute rip subnets

再次检查路由表
R1#sh ip route
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback0
L 1.1.1.1/32 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0 [120/5] via 192.168.12.2, 00:00:28, Ethernet0/0
3.0.0.0/32 is subnetted, 1 subnets
R 3.3.3.3 [120/5] via 192.168.12.2, 00:00:28, Ethernet0/0
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Ethernet0/0
L 192.168.12.1/32 is directly connected, Ethernet0/0
R 192.168.23.0/24 [120/5] via 192.168.12.2, 00:00:28, Ethernet0/0

R2#sh ip route
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 192.168.12.1, 00:00:24, Ethernet0/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, Loopback0
L 2.2.2.2/32 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/11] via 192.168.23.3, 00:07:58, Ethernet0/1
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Ethernet0/0
L 192.168.12.2/32 is directly connected, Ethernet0/0
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Ethernet0/1
L 192.168.23.2/32 is directly connected, Ethernet0/1

R3# sh ip route
1.0.0.0/24 is subnetted, 1 subnets
O E2 1.1.1.0 [110/20] via 192.168.23.2, 00:02:30, Ethernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/11] via 192.168.23.2, 00:04:10, Ethernet0/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Loopback0
L 3.3.3.3/32 is directly connected, Loopback0
O E2 192.168.12.0/24 [110/20] via 192.168.23.2, 00:02:30, Ethernet0/0
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Ethernet0/0
L 192.168.23.3/32 is directly connected, Ethernet0/0

重发布时需要注意的问题

度量值

不同的协议度量值的计算方式不一样
· rip:跳数
· eigrp:带宽、延迟、可靠性、负载、最大传输单元
· ospf:参考带宽/接口带宽
· isis:默认度量值
重发步之后度量值会改成新的计算方式
发布到距离矢量协议种必须指定度量值,负责不可同
如果没有指定度量值的会自动指定一个度量值,这个度量值叫做种子度量值

种子度量值

image-20210205131256145

管理距离

同一个路由器从不同协议里学习相同的路由的条目时优先比较管理距离,优先选择管理距离小的
如果管理距离相同代表同一个协议则继续比较度量值
不同厂商的管理距离是相同的

拓扑

image-20210205131319085

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
第一步,配置IP地址

第二步,配置各个协议
R2(config-if)#router rip
R2(config-router)#ver 2
R2(config-router)#no au
R2(config-router)#network 2.0.0.0
R2(config-router)#network 192.168.25.0

R1(config-if)#router eigrp 100
R1(config-router)#network 1.0.0.0

R3(config-router)#int range lo0,e0/0
R3(config-if-range)#ip ospf 1 area 0

R4(config-if)#router isis
R4(config-router)#net 49.0001.0000.0000.0004.00
R5(config-router)#is-type level-2-only
R4(config-router)#log-adjacency-changes
R4(config-router)#int range e0/0,lo0
R4(config-if-range)#ip router isis

R5(config)#router rip
R5(config-router)#ver
R5(config-router)#router rip
R5(config-router)#ver 2
R5(config-router)#no au
R5(config-router)#network 192.168.25.0
R5(config-router)#router eig
R5(config-router)#router eigrp 100
R5(config-router)#network 192.168.15.0
R5(config-router)#int e0/2
R5(config-if)#ip ospf 1 area 0
R5(config-if)#router isis
R5(config-router)#net 49.0001.0000.0000.0005.00
R5(config-router)#is-type level-2-only
R5(config-router)#log-adjacency-changes
R5(config-router)#int e0/3
R5(config-if)#ip router isis

R5#sh ip route
S* 0.0.0.0/0 is directly connected, Null0
1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/409600] via 192.168.15.1, 00:00:19, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0 [120/1] via 192.168.25.2, 00:00:05, Ethernet0/1
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/11] via 192.168.35.3, 00:03:28, Ethernet0/2
4.0.0.0/24 is subnetted, 1 subnets
i L1 4.4.4.0 [115/20] via 192.168.45.4, 00:02:48, Ethernet0/3
5.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 5.5.5.0/24 is directly connected, Loopback0
L 5.5.5.5/32 is directly connected, Loopback0
192.168.15.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.15.0/24 is directly connected, Ethernet0/0
L 192.168.15.5/32 is directly connected, Ethernet0/0
192.168.25.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.25.0/24 is directly connected, Ethernet0/1
L 192.168.25.5/32 is directly connected, Ethernet0/1
192.168.35.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.35.0/24 is directly connected, Ethernet0/2
L 192.168.35.5/32 is directly connected, Ethernet0/2
192.168.45.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.45.0/24 is directly connected, Ethernet0/3
L 192.168.45.5/32 is directly connected, Ethernet0/3

第三步依次将各种协议重发步到单个协议种
各种协议重发步到rip中
R5(config)#router rip
R5(config-router)#redistribute eigrp 100 metric 5
R5(config-router)#redistribute ospf 1 metric 5
R5(config-router)#redistribute isis metric 5
R5(config-router)#redistribute static metric 5
R5(config-router)#redistribute connected metric 5

各种协议重发步到eigrp中
R5(config-router)#router eigrp 100
R5(config-router)#redistribute rip metric 10000 100 255 1 1500
R5(config-router)#redistribute ospf 1 metric 10000 100 255 1 1500
R5(config-router)#redistribute isis metric 10000 100 255 1 1500
R5(config-router)#redistribute static metric 10000 100 255 1 1500
R5(config-router)#redistribute connected metric 10000 100 255 1 1500

各种协议重发步到ospf中
R5(config-router)#router ospf 1
R5(config-router)#redistribute rip subnets
R5(config-router)#redistribute eigrp 100 subnets
R5(config-router)#redistribute isis subnets
R5(config-router)#redistribute connected subnets
R5(config-router)#redistribute static subnets

各种协议重发步到isis中
R5(config-router)#router isis
R5(config-router)#redistribute rip
R5(config-router)#redistribute eigrp
R5(config-router)#redistribute eigrp 100
R5(config-router)#redistribute ospf 1
R5(config-router)#redistribute static
R5(config-router)#redistribute connected

第四步,检查路由表,任意一台路由器上应该具有所有路由
R1#sh ip route
D*EX 0.0.0.0/0 [170/307200] via 192.168.15.5, 00:12:05, Ethernet0/0
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback0
L 1.1.1.1/32 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
D EX 2.2.2.0 [170/307200] via 192.168.15.5, 00:01:37, Ethernet0/0
3.0.0.0/32 is subnetted, 1 subnets
D EX 3.3.3.3 [170/307200] via 192.168.15.5, 00:01:37, Ethernet0/0
4.0.0.0/24 is subnetted, 1 subnets
D EX 4.4.4.0 [170/307200] via 192.168.15.5, 00:01:37, Ethernet0/0
5.0.0.0/24 is subnetted, 1 subnets
D EX 5.5.5.0 [170/307200] via 192.168.15.5, 00:11:53, Ethernet0/0
192.168.15.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.15.0/24 is directly connected, Ethernet0/0
L 192.168.15.1/32 is directly connected, Ethernet0/0
D EX 192.168.25.0/24 [170/307200] via 192.168.15.5, 00:12:41, Ethernet0/0
D EX 192.168.35.0/24 [170/307200] via 192.168.15.5, 00:12:21, Ethernet0/0
D EX 192.168.45.0/24 [170/307200] via 192.168.15.5, 00:11:53, Ethernet0/0

拓扑

image-20210205131332421

次优路径

当出现多点做双向重发步的时候,后做的点会同时收来自不同区域的相同路由,它会选择管理距离小的写入路由表,所以管理距离小的那一边会产生次优路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
第一步,配置IP地址
第二步,配置路由协议
第三步,做双向重发步
R2
router rip
version 2
redistribute ospf 1 metric 5
router ospf 1
redistribute rip subnets

R3
router rip
version 2
redistribute ospf 1 metric 5
router ospf 1
redistribute rip subnets
做完双向重发步之后在R2、R3中去观察5.0.0.0的路由条目,会产生次优路径
第四步,修改来自对端路由的管理距离
R2
router ospf 1
distance 121 3.3.3.3 0.0.0.0
#注意!此处的意思是收到Router-ID为3.3.3.3发来的路由,管理距离改为121
R3
router ospf 1
distance 121 2.2.2.2 0.0.0.0
由于直接修改对端路由的管理距离可能会造成修改了ospf区域内部的距离,所以可以采用针对外部路由修改管理距离

第五步,修改外部路由管理距离
R2
router ospf 1
distance ospf external 121
#修改ospf默认的OE或者ON路由的管理距离

R3
router ospf 1
distance ospf external 121

第六步,检查路由表
R2#sh ip route
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.0.0.0/8 [120/6] via 192.168.24.4, 00:00:19, Ethernet0/1
O 1.1.1.1/32 [110/11] via 192.168.12.1, 00:10:11, Ethernet0/0
2.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
R 2.0.0.0/8 [120/6] via 192.168.24.4, 00:00:19, Ethernet0/1
C 2.2.2.0/24 is directly connected, Loopback0
L 2.2.2.2/32 is directly connected, Loopback0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 3.0.0.0/8 [120/6] via 192.168.24.4, 00:00:19, Ethernet0/1
O 3.3.3.3/32 [110/21] via 192.168.12.1, 00:10:11, Ethernet0/0
R 4.0.0.0/8 [120/1] via 192.168.24.4, 00:00:19, Ethernet0/1
R 5.0.0.0/8 [120/2] via 192.168.24.4, 00:00:19, Ethernet0/1
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Ethernet0/0
L 192.168.12.2/32 is directly connected, Ethernet0/0
O 192.168.13.0/24 [110/20] via 192.168.12.1, 00:10:11, Ethernet0/0
192.168.24.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.24.0/24 is directly connected, Ethernet0/1
L 192.168.24.2/32 is directly connected, Ethernet0/1
R 192.168.34.0/24 [120/1] via 192.168.24.4, 00:00:19, Ethernet0/1
R 192.168.45.0/24 [120/1] via 192.168.24.4, 00:00:19, Ethernet0/1

R3#sh ip route
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O E2 1.0.0.0/8 [121/20] via 192.168.13.1, 00:10:17, Ethernet0/0
O 1.1.1.1/32 [110/11] via 192.168.13.1, 00:10:17, Ethernet0/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O E2 2.0.0.0/8 [121/20] via 192.168.13.1, 00:10:17, Ethernet0/0
O 2.2.2.2/32 [110/21] via 192.168.13.1, 00:10:17, Ethernet0/0
3.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
O E2 3.0.0.0/8 [121/20] via 192.168.13.1, 00:10:17, Ethernet0/0
C 3.3.3.0/24 is directly connected, Loopback0
L 3.3.3.3/32 is directly connected, Loopback0
R 4.0.0.0/8 [120/1] via 192.168.34.4, 00:00:16, Ethernet0/1
R 5.0.0.0/8 [120/2] via 192.168.34.4, 00:00:16, Ethernet0/1
O 192.168.12.0/24 [110/20] via 192.168.13.1, 00:10:17, Ethernet0/0
192.168.13.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.13.0/24 is directly connected, Ethernet0/0
L 192.168.13.3/32 is directly connected, Ethernet0/0
R 192.168.24.0/24 [120/1] via 192.168.34.4, 00:00:16, Ethernet0/1
192.168.34.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.34.0/24 is directly connected, Ethernet0/1
L 192.168.34.3/32 is directly connected, Ethernet0/1
R 192.168.45.0/24 [120/1] via 192.168.34.4, 00:00:16, Ethernet0/1
R3#

Route-map

当我们进行重发步的时候可能会将整个A协议的路由条目重发步到B协议中
如果我们想要针对某些路由条目做一些操作,那么可以使用route-map
使用场景
· 重分发期间进行路由过滤或执行策略
· PBR(策略路由)
· NAT(网络地址转换)
· BGP中的策略部署
· 其他用途

1
2
3
4
5
route-map <名字> permit/deny <序号>
match <条件1> <条件2>
match <条件3> <条件4>
set <动作1>
set <动作2>

特点
· 使用match命令匹配特定的分组或路由,set修改该分组或路由相关属性。
· Route-map中的每个序列号语句相当于于访问控制列表中的各行。
· Route-map默认为permit,默认序列号为10,序列号不会自动递增,需要指定序列号
· 末尾隐含deny any
· 单条match语句包括多个条件时,使用逻辑or运算;多条match语句时,使用逻辑and运算。
match条件
· match ip address 匹配访问列表或前缀列表
· match length 根据分组的第三层长度进行匹配
· match interface 匹配下一跳出接口为指定接口之一的路由
· match ip next-hop 匹配下一跳地址为特定访问列表中被允许的那些路由
· match metric 匹配具有指定度量值的路由
· match route-type 匹配指定类型的路由
· match community 匹配BGP共同体
· match tag 根据路由的标记进行匹配
set动作
· set metric 设置路由协议的度量值
· set metric-type 设置目标路由协议的度量值类型
· set default interface 指定如何发送这样的分组
· set interface 指定如何发送这样的分组
· set ip default next-hop指定转发的下一跳
· set ip next-hop 指定转发的下一跳
· set next-hop 指定下一跳的地址,指定BGP的下一跳
· set as-path
· set community
· set local-preference
· set weight
· set origin
· set tag
default 关键字优先级低于明细路由

拓扑

image-20210205131350204

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
第一步,在R1 上过滤掉172.16.4.0/24
R1(config)#access-list 1 permit 172.16.4.0
R1(config)#route-map c-r deny
R1(config-route-map)#match ip address 1
R1(config)#route-map c-r permit 20
R1(config-route-map)#route rip
R1(config-router)#redistribute connected route-map c-r metric 5
第二步过滤掉172.16.3.0/4路由条目
R2(config)#access-list 1 permit 172.16.3.0
R2(config)#route-map r-e deny
R2(config-route-map)#match ip address 1
R2(config)#route-map r-e permit 20
R2(config-route-map)#set tag 666
R2(config)#router eigrp 100
R2(config-router)#redistribute rip metric 10000 100 255 1 1500 route-map r-e
第三步通过匹配之前的666标签,将rip的路由条目的类型设置成OE1
R3(config)#route-map e-o permit 10
R3(config-route-map)#match tag 666
R3(config-route-map)#set metric-type type-1
R3(config)#route-map e-o permit 20
R3(config)#router ospf 1
R3(config-router)#redistribute eigrp 100 metric 50 route-map e-o subnets
第四步配置末梢区域,使得ospf的区域1不学习任何外部路由
R4(config)#router ospf 1
R4(config-router)#area 1 stub
R5(config)#router ospf 1
R5(config-router)#area 1 stub

分发列表distribute-list

对于距离矢量路由协议

可以应用在路由更新的入口和出口方向
如果运用在路由更新入口,会对自己和下游产生影响
如果运行在路由更新的出口,会对下游产生影响
image-20210205131403878

对于链路状态协议

应用在ospf的时候只能应用在路由更新的出口上,是针对本地始发的5类LSA
如果是使用在了入口方向,则只会对自己产生影响
image-20210205131419885

拓扑

image-20210205131432941

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
access-list 1 deny   172.16.1.0
access-list 1 permit any
router rip
distribute-list 1 in Ethernet0/0

R3#sh ip route
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/2] via 192.168.23.2, 00:00:04, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0 [120/1] via 192.168.23.2, 00:00:04, Ethernet0/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Loopback0
L 3.3.3.3/32 is directly connected, Loopback0
R 192.168.12.0/24 [120/1] via 192.168.23.2, 00:00:04, Ethernet0/0
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Ethernet0/0
L 192.168.23.3/32 is directly connected, Ethernet0/0

前缀列表prefix-list

前缀列表的可控性比访问列表高得多,支持增量修改,更为灵活
可匹配路由前缀中的网络号及前缀长度,增强了匹配的精确度
前缀列表包含序列号,从最小的开始匹配
如果前缀不与前缀列表中的任何条目匹配,将被拒绝

1
2
3
4
5
6
7
8
匹配某条特定路由:192.168.1.0/24
ip prefix-list pxlist 192.168.1.0/24
匹配默认路由
ip prefix-list pxlist permit 0.0.0.0/0
匹配所有主机路由
ip prefix-list pxlist permit 0.0.0.0/0 ge 32
匹配所有路由(any)
ip prefix-list list1 permit 0.0.0.0/0 le 32

实列

image-20210205131505165

偏移列表offset-list

针对距离矢量协议,用于增加度量值

1
2
3
access-list 1 permit 1.1.1.0
router rip
offset-list 1 out 10

PBR策略路由

拓扑

image-20210205131521694

1
2
3
4
5
6
7
8
9
10
11
12
13
R4#sh run | sec acc
access-list 1 permit 192.168.56.0 0.0.0.255
access-list 2 permit 192.168.57.0 0.0.0.255
R4#sh run | sec route-map
ip policy route-map pbr
route-map pbr permit 10
match ip address 1
set ip next-hop 192.168.24.2 192.168.34.3
route-map pbr permit 20
match ip address 2
set ip next-hop 192.168.34.3
route-map pbr permit 30
set ip next-hop 192.168.24.2 192.168.34.3

综合实验

拓扑

image-20210205131534715

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
需求
1. 所有路由器全部启环回接口0 ,地址为X.X.X.X/32 X=路由器编号,接口地址使用192.168.X.Y X=相连路由器标号组合,例如R1和R2就使用X=12 Y=路由器编号
2. R1和R2起RIPv2协议,R1建立3个环回接口,地址为172.16.X.1/24 X=1-3 只允许R1和R2之间存在更新,并且R2要只看到一条172.16网段的路由,并且这条路由不允许通告到其它网络
3. R2、R3和R4的E0/0接口启EIGRP 100 R2、R3和R4的环回接口通告到EIGRP中
4. R3、R4和R5启用OSPF
5. 在R6只要看到直连路由和关于OSPF的一条默认路由
6. R6上重分布直连环回接口,只重分布一个环回接口,需过滤其它端口
7. R2上双向的重分发,R3和R4都做OSPF和EIGRP的双向重分发,并使OSPF路由器优先选择R3为主路由,当R3 down掉,使用路由器R4为可用下一跳
8. 实验完成后需要全网通信,使用traceroute验证路由下一跳是否正确,重点观察R2 R3 R4的路由下一跳


R1
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Loopback1
ip address 172.16.1.1 255.255.255.0
!
interface Loopback2
ip address 172.16.2.1 255.255.255.0
!
interface Loopback3
ip address 172.16.3.1 255.255.255.0
!
interface Ethernet0/0
ip address 192.168.12.1 255.255.255.0
ip summary-address rip 172.16.0.0 255.255.0.0
!
router rip
version 2
passive-interface default
neighbor 192.168.12.2
network 1.0.0.0
network 172.16.0.0
network 192.168.12.0
no auto-summary

R2
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface Ethernet0/0
ip address 192.168.12.2 255.255.255.0
!
interface Ethernet0/1
ip address 192.168.234.2 255.255.255.0
!
router eigrp 100
network 192.168.234.0
redistribute rip metric 10000 100 255 1 1500 route-map r-e
!
router rip
version 2
redistribute eigrp 100 metric 5
passive-interface default
network 192.168.12.0
neighbor 192.168.12.1
no auto-summary
!
route-map r-e deny 10
match ip address 1
route-map r-e permit 20
set tag 888
!
access-list 1 permit 172.16.0.0

R3
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface Ethernet0/0
ip address 192.168.234.3 255.255.255.0
!
interface Ethernet0/1
ip address 192.168.35.3 255.255.255.0
ip ospf 1 area 0
!
router eigrp 100
network 3.0.0.0
network 192.168.234.0
redistribute ospf 1 metric 10000 100 255 1 1500
!
router ospf 1
redistribute eigrp 100 metric 10 subnets
distribute-list route-map d-o in
!
route-map d-o deny 10
match tag 888
!
route-map d-o permit 20

R4
interface Loopback0
ip address 4.4.4.4 255.255.255.0
!
interface Ethernet0/0
ip address 192.168.234.4 255.255.255.0
!
interface Ethernet0/1
ip address 192.168.45.4 255.255.255.0
ip ospf 1 area 0
!
router eigrp 100
network 4.0.0.0
network 192.168.234.0
redistribute ospf 1 metric 10000 100 255 1 1500
!
router ospf 1
redistribute eigrp 100 subnets
distribute-list route-map d-o in
!
route-map d-o deny 10
match tag 888
!
route-map d-o permit 20

R5
interface Loopback0
ip address 5.5.5.5 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/0
ip address 192.168.35.5 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/1
ip address 192.168.45.5 255.255.255.0
ip ospf 1 area 0
!
interface Ethernet0/2
ip address 192.168.56.5 255.255.255.0
ip ospf 1 area 1
!
router ospf 1
area 1 nssa no-summary

R6
interface Loopback0
ip address 6.6.6.6 255.255.255.0
!
interface Ethernet0/0
ip address 192.168.56.6 255.255.255.0
ip ospf 1 area 1
!
router ospf 1
area 1 nssa
redistribute connected subnets route-map c-o
!
route-map c-o permit 10
match ip address 1
!
access-list 1 permit 6.6.6.0
  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!

请我喝杯咖啡吧~

支付宝
微信