OSPF重发布
作者:互联网
要求:
1.如图搭建网络拓扑,所有路由器各自创建一个环回接口,合理规划IP地址
2.R1-R2-R3-R4-R6之间使用OSPF协议,R4- R5-R6之间使用RIP协议
3.R1环回重发布方式引入OSPF网络
4.R4/R6上进行双点双向重发布
5.分析网络中出现路由环路的原因
6.路由优化,全网可达
R1环回重发布方式引入OSPF网络
在R1上写route-policy列表重发布R1UBRL0空的环回
[r1-route-policy]if-ma
[r1-route-policy]if-match int lo0
[r1-route-policy]q
[r1]ospf
[r1-ospf-1]imp
[r1-ospf-1]import-route dir rou
[r1-ospf-1]import-route dir route-policy ccie
[r1-ospf-1]dis this
[V200R003C00]
#
ospf 1 router-id 91.1.1.1
import-route direct route-policy ccie
area 0.0.0.0
network 10.1.1.1 0.0.0.0
area 0.0.0.1
#
return
[r1]dis ospf lsdb
OSPF Process 1 with Router ID 91.1.1.1
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 94.4.4.4 94.4.4.4 1349 48 80000004 0
Router 92.2.2.2 92.2.2.2 1471 60 8000000B 0
Router 96.6.6.6 96.6.6.6 1283 48 80000004 0
Router 91.1.1.1 91.1.1.1 50 36 80000004 1
Router 93.3.3.3 93.3.3.3 1280 72 8000000E 0
Network 10.1.5.1 93.3.3.3 1280 32 80000002 0
Network 10.1.3.1 93.3.3.3 1353 32 80000002 0
Network 10.1.2.1 92.2.2.2 1618 32 80000002 0
Network 10.1.1.2 92.2.2.2 1471 32 80000002 0
Area: 0.0.0.1
AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 1.1.1.0 91.1.1.1 50 36 80000001 1
R4/R6上进行双点双向重发布
[r4]rip
[r4-rip-1]im
[r4-rip-1]import-route ospf 1
[r4-rip-1]ospf 1
[r4-ospf-1]om
[r4-ospf-1]im
[r4-ospf-1]import-route rip 1
[r6]ospf
[r6-ospf-1]im
[r6-ospf-1]import-route rip 1
[r6-ospf-1]
[r6-ospf-1]rip
[r6-rip-1]im
[r6-rip-1]import-route ospf 1
[r6-rip-1]
在R3上学习到了R5R6的路由信息
R3的路由表
[r3]dis ospf lsdb
OSPF Process 1 with Router ID 93.3.3.3
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 94.4.4.4 94.4.4.4 737 48 80000008 0
Router 92.2.2.2 92.2.2.2 1387 60 8000000E 0
Router 96.6.6.6 96.6.6.6 493 48 80000008 0
Router 91.1.1.1 91.1.1.1 1767 36 80000006 1
Router 93.3.3.3 93.3.3.3 1194 72 80000011 0
Network 10.1.5.1 93.3.3.3 1194 32 80000005 0
Network 10.1.3.1 93.3.3.3 1266 32 80000005 0
Network 10.1.2.1 92.2.2.2 1534 32 80000005 0
Network 10.1.1.2 92.2.2.2 1387 32 80000005 0
AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 6.6.6.0 96.6.6.6 493 36 80000003 1
External 4.4.4.0 94.4.4.4 737 36 80000003 1
External 5.0.0.0 94.4.4.4 737 36 80000003 1
External 5.0.0.0 96.6.6.6 493 36 80000003 1
External 10.1.6.0 94.4.4.4 737 36 80000003 1
External 10.1.6.0 96.6.6.6 493 36 80000003 1
External 10.1.4.0 94.4.4.4 737 36 80000003 1
External 10.1.4.0 96.6.6.6 493 36 80000003 1
External 10.1.5.0 96.6.6.6 493 36 80000003 1
External 10.1.3.0 94.4.4.4 737 36 80000003 1
External 1.1.1.0 91.1.1.1 1767 36 80000003 1
这样做双点双向重发布一定会出环,这是R3的路由表1.1.1.0/24的下一跳本应该是10.1.1.1但是在R3的路由表上却是10.1.2.1的下一跳。1.1.1.0/24作为在R1重发布的路由优先级本应该是150在R4上通过重发布进入了rip但是在R6通过RIP学习到的R1环回比150小所以在R6上吧原有的ospf路由信息删除了又通过R6上的重发布把R1的环回以外部路由重新发布到ospf当中所以优先级又变为150但此时R3和R6的cost的值是1所以产生了环路这里的cost值本应该是R1-R3的也就是COST=2所以因为路由回馈出现了环路。
再就是出现本不应该有的负载均衡
在 R6上
[r6]route-policy hcip permit node 10
Info: New Sequence of this List.
[r6-route-policy]if-
[r6-route-policy]if-match ip
[r6-route-policy]if-match ip-
[r6-route-policy]if-match ip-prefix hcip
[r6-route-policy]app
[r6-route-policy]apply cost 100
[r6-route-policy]rou
[r6-route-policy]q
[r6]rou
[r6]route-
[r6]route-policy hcip per
[r6]route-policy hcip permit node 20
Info: New Sequence of this List.
[r6-route-policy]q
[r6]rip
[r6-rip-1]im
[r6-rip-1]import-route ospf 1 ro
[r6-rip-1]import-route ospf 1 route-policy hcip
在R5上查看10.1.4.0是否还存在负载均衡
原来
4.0.0.0/8 RIP 100 1 D 10.1.4.1 GigabitEthernet
0/0/1
RIP 100 1 D 10.1.6.1 GigabitEthernet
现在
10.1.4.0/24 Direct 0 0 D 10.1.4.2 GigabitEthernet
0/0/1
在R4上增加metric值
rror: Wrong parameter found at '^' position.
[r4]acl 2000
[r4-acl-basic-2000]ru
[r4-acl-basic-2000]rule pe
[r4-acl-basic-2000]rule permit so
[r4-acl-basic-2000]rule permit source 10.1.5.0 0
[r4-acl-basic-2000]int g0/0/0
[r4-GigabitEthernet0/0/0]rip me
[r4-GigabitEthernet0/0/0]rip metric
[r4-GigabitEthernet0/0/0]rip metricout 2000 100
^
Error: Wrong parameter found at '^' position.
[r4-GigabitEthernet0/0/0]rip metricout 2000 3
原来
10.1.5.0/24 RIP 100 1 D 10.1.6.1 GigabitEthernet
0/0/0
RIP 100 1 D 10.1.4.1 GigabitEthernet
现在
10.1.5.0/24 RIP 100 1 D 10.1.6.1 GigabitEthernet
0/0/0
R3的负载均衡
R3上用route-policy
[r4]ip ip-
[r4]ip ip-prefix aa pe
[r4]ip ip-prefix aa permit 5.0.0.0 8
[r4]ip ip-prefix aa permit 10.1.6.0 24
[r4]rou
[r4]route-
[r4]route-policy aa pe
[r4]route-policy aa permit node 10
Info: New Sequence of this List.
[r4-route-policy]if-
[r4-route-policy]if-match ip-
[r4-route-policy]if-match ip-prefix aa
[r4-route-policy]app
[r4-route-policy]apply co
[r4-route-policy]q
[r4] undo ip ip-prefix aa permit 10.1.6.0 24
^
Error:Too many parameters found at '^' position.
[r4]undo ip ip-prefix aa
[r4]ip ip
[r4]ip ip-
[r4]ip ip-prefix c1 pe
[r4]ip ip-prefix c1 permit 5.0.0.0 8
[r4]ip ip-prefix c2 permit 10.1.6.0 24
[r4]rou
[r4]route-
[r4]route-policy c pe
[r4]route-policy c permit node 10
Info: New Sequence of this List.
[r4-route-policy]if-
[r4-route-policy]if-match ip-
[r4-route-policy]if-match ip-prefix c1
[r4-route-policy]ap
[r4-route-policy]apply c
[r4-route-policy]apply cos
[r4-route-policy]apply cost-type t
[r4-route-policy]apply cost-type type-1
[r4-route-policy]q
[r4]ro
[r4]route-policy c pe
[r4]route-policy c permit node 20
Info: New Sequence of this List.
[r4-route-policy]if-
[r4-route-policy]if-match ip -p
[r4-route-policy]if-match ip-
[r4-route-policy]if-match ip-prefix c2
[r4-route-policy]a
[r4-route-policy]applycos
[r4-route-policy]apply cos
[r4-route-policy]apply cost-type t
[r4-route-policy]apply cost 3
[r4-route-policy]q
[r4]ro
[r4]route-policy c pe
[r4]route-policy c permit node 30
Info: New Sequence of this List.
[r4-route-policy]q
[r4]ospf
[r4-ospf-1]im
[r4-ospf-1]import-route rip 1 ro
[r4-ospf-1]import-route rip 1 route-policy c
[r4-ospf-1]q
[r4]dis ip r
[r4]dis ip rd-filter
[r4]dis ip rou
[r4]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 23 Routes : 23
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 O_ASE 150 1 D 10.1.3.1 GigabitEthernet
0/0/1
2.2.2.2/32 OSPF 10 2 D 10.1.3.1 GigabitEthernet
0/0/1
3.3.3.3/32 OSPF 10 1 D 10.1.3.1 GigabitEthernet
0/0/1
4.4.4.0/24 Direct 0 0 D 4.4.4.4 LoopBack0
4.4.4.4/32 Direct 0 0 D 127.0.0.1 LoopBack0
4.4.4.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
5.0.0.0/8 RIP 100 1 D 10.1.4.2 GigabitEthernet
0/0/0
6.6.6.0/24 O_ASE 150 1 D 10.1.3.1 GigabitEthernet
0/0/1
6.6.6.6/32 OSPF 10 2 D 10.1.3.1 GigabitEthernet
0/0/1
10.1.1.0/24 OSPF 10 3 D 10.1.3.1 GigabitEthernet
0/0/1
10.1.2.0/24 OSPF 10 2 D 10.1.3.1 GigabitEthernet
0/0/1
10.1.3.0/24 Direct 0 0 D 10.1.3.2 GigabitEthernet
0/0/1
10.1.3.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.3.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.4.0/24 Direct 0 0 D 10.1.4.1 GigabitEthernet
0/0/0
10.1.4.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.4.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.5.0/24 OSPF 10 2 D 10.1.3.1 GigabitEthernet
0/0/1
10.1.6.0/24 RIP 100 1 D 10.1.4.2 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[r4]ip ip-
[r4]ip ip-prefix c3 pe
[r4]ip ip-prefix c3 permit 10.1.4.0 24
[r4]rou
[r4]route-
[r4]route-policy c per
[r4]route-policy c permit node 30
Info: You are overwriting this sequence.
[r4-route-policy]if-
[r4-route-policy]if-match ip-
[r4-route-policy]if-match ip-prefix c3
[r4-route-policy]apply cost 3
[r4-route-policy]q
原来
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 26 Routes : 29
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 O_ASE 150 1 D 10.1.2.1 GigabitEthernet
0/0/1
2.2.2.2/32 OSPF 10 1 D 10.1.2.1 GigabitEthernet
0/0/1
3.3.3.0/24 Direct 0 0 D 3.3.3.3 LoopBack0
3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
3.3.3.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
4.4.4.0/24 O_ASE 150 1 D 10.1.3.2 GigabitEthernet
0/0/0
4.4.4.4/32 OSPF 10 1 D 10.1.3.2 GigabitEthernet
0/0/0
5.0.0.0/8 O_ASE 150 1 D 10.1.3.2 GigabitEthernet
0/0/0
O_ASE 150 1 D 10.1.5.2 GigabitEthernet
0/0/2
6.6.6.0/24 O_ASE 150 1 D 10.1.5.2 GigabitEthernet
0/0/2
6.6.6.6/32 OSPF 10 1 D 10.1.5.2 GigabitEthernet
0/0/2
10.1.1.0/24 OSPF 10 2 D 10.1.2.1 GigabitEthernet
0/0/1
10.1.2.0/24 Direct 0 0 D 10.1.2.2 GigabitEthernet
0/0/1
10.1.2.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.3.0/24 Direct 0 0 D 10.1.3.1 GigabitEthernet
0/0/0
10.1.3.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.3.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.4.0/24 O_ASE 150 1 D 10.1.3.2 GigabitEthernet
0/0/0
O_ASE 150 1 D 10.1.5.2 GigabitEthernet
0/0/2
10.1.5.0/24 Direct 0 0 D 10.1.5.1 GigabitEthernet
0/0/2
10.1.5.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
10.1.5.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
10.1.6.0/24 O_ASE 150 1 D 10.1.3.2 GigabitEthernet
0/0/0
O_ASE 150 1 D 10.1.5.2 GigabitEthernet
0/0/2
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
路由优化后
Routing Tables: Public
Destinations : 25 Routes : 25
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 O_ASE 150 1 D 10.1.2.1 GigabitEthernet
0/0/1
2.2.2.2/32 OSPF 10 1 D 10.1.2.1 GigabitEthernet
0/0/1
3.3.3.0/24 Direct 0 0 D 3.3.3.3 LoopBack0
3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
3.3.3.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
4.4.4.4/32 OSPF 10 1 D 10.1.3.2 GigabitEthernet
0/0/0
5.0.0.0/8 O_ASE 150 2 D 10.1.3.2 GigabitEthernet
0/0/0
6.6.6.0/24 O_ASE 150 1 D 10.1.5.2 GigabitEthernet
0/0/2
6.6.6.6/32 OSPF 10 1 D 10.1.5.2 GigabitEthernet
0/0/2
10.1.1.0/24 OSPF 10 2 D 10.1.2.1 GigabitEthernet
0/0/1
10.1.2.0/24 Direct 0 0 D 10.1.2.2 GigabitEthernet
0/0/1
10.1.2.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.3.0/24 Direct 0 0 D 10.1.3.1 GigabitEthernet
0/0/0
10.1.3.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.3.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.4.0/24 O_ASE 150 1 D 10.1.5.2 GigabitEthernet
0/0/2
10.1.5.0/24 Direct 0 0 D 10.1.5.1 GigabitEthernet
0/0/2
10.1.5.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
10.1.5.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
10.1.6.0/24 O_ASE 150 1 D 10.1.5.2 GigabitEthernet
0/0/2
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
---- More ----
1.1.1.0的下一跳恢复正常,实验完成。
标签:10.1,r4,32,route,GigabitEthernet,发布,policy,OSPF 来源: https://blog.csdn.net/helloword1997/article/details/119297319