AI智能
改变未来

2020.7.7_ie_07_OSPF的一种常见架构的分流处理

底层ip配置

R1

R2

R3

R4

方法一:虚链路

左边是区域0、右边是区域1

R1

ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.1.12.0 0.0.0.255
network 10.100.1.0 0.0.0.255
area 0.0.0.1
network 10.1.13.0 0.0.0.255
network 10.200.1.0 0.0.0.255
vlink-peer 4.4.4.4

R2

ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 10.1.12.0 0.0.0.255
network 10.1.24.0 0.0.0.255

R3

ospf 1 router-id 3.3.3.3
area 0.0.0.1
network 10.1.13.0 0.0.0.255
network 10.1.34.0 0.0.0.255

R4

ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 10.1.24.0 0.0.0.255
area 0.0.0.1
network 10.1.34.0 0.0.0.255
vlink-peer 1.1.1.1

测试

断开R1和r2之间的链路

方法二:重发布

四台路由器都在区域0里面

R2和R3的上面为进程1,下面为进程2

启动ospf

R1

ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.1.12.0 0.0.0.255
network 10.1.13.0 0.0.0.255
network 10.100.1.0 0.0.0.255
network 10.200.1.0 0.0.0.255

R2

ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 10.1.12.0 0.0.0.255

ospf 2 router-id 22.22.22.22
area 0.0.0.0
network 10.1.24.0 0.0.0.255

R3

ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 10.1.13.0 0.0.0.255

ospf 2 router-id 33.33.33.33
area 0.0.0.0
network 10.1.34.0 0.0.0.255

R4

ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 10.1.24.0 0.0.0.255
network 10.1.34.0 0.0.0.255

R2和R3上做路由策略

R2

route-policy a permit node 10
if-match ip-prefix 100
apply cost 100

route-policy a permit node 20
if-match ip-prefix 200
apply cost 200

ip ip-prefix 100 index 10 permit 10.100.1.0 24 greater-equal 25 less-equal 32
ip ip-prefix 200 index 10 permit 10.200.1.0 24 greater-equal 25 less-equal 32

R3

route-policy a permit node 10
if-match ip-prefix 100
apply cost 200

route-policy a permit node 20
if-match ip-prefix 200
apply cost 100

ip ip-prefix 100 index 10 permit 10.100.1.0 24 greater-equal 25 less-equal 32
ip ip-prefix 200 index 10 permit 10.200.1.0 24 greater-equal 25 less-equal 32

做重发布

R2

[R2]ospf 1

[R2-ospf-1]import-route ospf 2 route-policy a

[R2]ospf 2

[R2-ospf-2]import-route ospf 1 route-policy a

R3

[R3]ospf 1
[R3-ospf-1]import-route ospf 2 route-policy a
[R3]ospf 2
[R3-ospf-2]import-route ospf 1 route-policy a

方法三:最长匹配原则

上面是区域0,下面是区域1

启动ospf

R1

ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.1.12.0 0.0.0.255
network 10.1.13.0 0.0.0.255
network 10.100.1.0 0.0.0.255
network 10.200.1.0 0.0.0.255

R2

ospf 1
area 0.0.0.0
network 10.1.12.0 0.0.0.255
area 0.0.0.1
network 10.1.24.0 0.0.0.255

R3

ospf 1
area 0.0.0.0
network 10.1.13.0 0.0.0.255
area 0.0.0.1
network 10.1.34.0 0.0.0.255

R4

ospf 1
area 0.0.0.1
network 10.0.0.0 0.255.255.255

区域汇总

R2

[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]abr-summary 10.0.0.0 255.0.0.0
[R2-ospf-1-area-0.0.0.0]a 1
[R2-ospf-1-area-0.0.0.1]abr-summary 10.200.0.0 255.255.0.0

R3

[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]abr-summary 10.0.0.0 255.0.0.0
[R3-ospf-1-area-0.0.0.0]a 1
[R3-ospf-1-area-0.0.0.1]abr-summary 10.100.0.0 255.255.0.0

测试

R1 R2之间的链路断开

R3

[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]abr-summary 10.0.0.0 255.0.0.0
[R3-ospf-1-area-0.0.0.0]a 1
[R3-ospf-1-area-0.0.0.1]abr-summary 10.100.0.0 255.255.0.0

测试

[外链图片转存中…(img-3vH9RPeP-1595044588781)]

R1 R2之间的链路断开

赞(0) 打赏
未经允许不得转载:爱站程序员基地 » 2020.7.7_ie_07_OSPF的一种常见架构的分流处理