1.实验拓扑
2.实验要求:在所有设备正常运转时,办公网段走左边(图中R1/3/5链路),业务走右边(图中R2/4/6链路),出现故障互为备份,实现分流且互备的效果
3.实施
3.1拓扑搭建(实际工程综合布线)
3.2所有底层设备均拥有合理IP地址
sysname R1
#
interface GigabitEthernet0/0/0
ip address 10.0.12.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.13.1 255.255.255.0
#
interface LoopBack0
ip address 10.1.1.1 255.255.255.0
#
interface LoopBack1
ip address 10.2.1.1 255.255.255.0
#
sysname R2
#
interface GigabitEthernet0/0/0
ip address 10.0.24.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.12.2 255.255.255.0
#
interface LoopBack0
ip address 10.1.2.1 255.255.255.0
#
interface LoopBack1
ip address 10.2.2.1 255.255.255.0
#
sysname R3
interface GigabitEthernet0/0/0
ip address 10.0.13.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.35.1 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 10.0.34.1 255.255.255.0
#
interface GigabitEthernet4/0/0
ip address 10.0.36.1 255.255.255.0
#
sysname R4
#
interface GigabitEthernet0/0/0
ip address 10.0.46.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.24.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 10.0.34.2 255.255.255.0
#
interface GigabitEthernet4/0/0
ip address 10.0.45.1 255.255.255.0
#
sysname R5
#
interface GigabitEthernet0/0/0
ip address 10.0.35.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.45.2 255.255.255.0
#
interface LoopBack0
ip address 10.1.5.1 255.255.255.0
#
interface LoopBack1
ip address 10.2.5.1 255.255.255.0
#
sysname R6
#
interface GigabitEthernet0/0/0
ip address 10.0.36.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.46.2 255.255.255.0
#
interface LoopBack0
ip address 10.1.6.1 255.255.255.0
#
interface LoopBack1
ip address 10.2.6.1 255.255.255.0
3.3起ospf动态路由协议
R1
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
R2
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 0.0.0.0 255.255.255.255
R3
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 10.0.13.0 0.0.0.255
network 10.0.34.0 0.0.0.255
#
ospf 2 router-id 3.3.3.3
area 0.0.0.1
network 10.0.35.0 0.0.0.255
network 10.0.36.0 0.0.0.255
R4
#
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 10.0.24.0 0.0.0.255
network 10.0.34.0 0.0.0.255
#
ospf 2 router-id 4.4.4.4
area 0.0.0.1
network 10.0.45.0 0.0.0.255
network 10.0.46.0 0.0.0.255
R5
#
ospf 2 router-id 5.5.5.5
area 0.0.0.1
network 10.0.35.0 0.0.0.255
network 10.0.45.0 0.0.0.255
network 10.1.5.1 0.0.0.0
network 10.2.5.1 0.0.0.0
R6
#
ospf 2 router-id 6.6.6.6
area 0.0.0.1
network 10.0.36.0 0.0.0.255
network 10.0.46.0 0.0.0.255
network 10.1.6.1 0.0.0.0
network 10.2.6.1 0.0.0.0
3.4配置策略
R3
#
ip ip-prefix yw index 10 permit 10.2.0.0 16 greater-equal 17 less-equal 32 前缀列表叫yw 抓10.2.0.0/16段的路由
#
route-policy 5to1 deny node 5 拒绝tag201的路由(防环——因为此处是双点双向重发布)
if-match tag 201
#
route-policy 5to1 permit node 10 匹配前缀列表yw 更改开销为10
if-match ip-prefix yw
apply cost 10
#
route-policy 5to1 permit node 20 空表允许剩余所有
#
ospf 1 router-id 3.3.3.3
import-route ospf 2 type 1 tag 100 route-policy 5to1 在进程1重发布进程2 类型为五类类型1 打上tag100 匹配策略路由5to1
#
route-policy 1to5 deny node 5 拒绝tag200的路由(防环——因为此处是双点双向重发布)
if-match tag 200
#
route-policy 1to5 permit node 10 匹配前缀列表yw 更改开销为10
if-match ip-prefix yw
apply cost 10
#
route-policy 1to5 permit node 20 空表允许剩余所有
ospf 2 router-id 3.3.3.3
import-route ospf 1 type 1 tag 101 route-policy 1to5 在进程2重发布进程1 类型为五类类型1 打上tag101 匹配策略路由1to5
#
interface GigabitEthernet0/0/2
ospf cost 5
R4
#
ip ip-prefix bg index 10 permit 10.1.0.0 16 greater-equal 17 less-equal 32 前缀列表叫bg 抓10.1.0.0/16段的路由
#
route-policy 6to2 deny node 5 拒绝tag101的路由(防环——因为此处是双点双向重发布)
if-match tag 101
#
route-policy 6to2 permit node 10 匹配前缀列表bg 更改开销为10
if-match ip-prefix bg
apply cost 10
#
route-policy 6to2 permit node 20 空表允许剩余所有
#
ospf 1 router-id 4.4.4.4
import-route ospf 2 type 1 tag 200 route-policy 6to2 在进程1重发布进程2 类型为五类类型1 打上tag200 匹配策略路由6to2
#
route-policy 2to6 deny node 5 拒绝tag100的路由(防环——因为此处是双点双向重发布)
if-match tag 100
#
route-policy 2to6 permit node 10 匹配前缀列表bg 更改开销为10
if-match ip-prefix bg
apply cost 10
#
route-policy 2to6 permit node 20 空表允许剩余所有
#
ospf 2 router-id 4.4.4.4
import-route ospf 1 type 1 tag 201 route-policy 2to6 在进程2重发布进程1 类型为五类类型1 打上tag201 匹配策略路由2to6
#
interface GigabitEthernet0/0/2
ospf cost 5
4.测试
下面我们模拟测试一下出现故障以后的情况:
①关闭[R5-GigabitEthernet0/0/0]测试如下图:
由上图可知我们可以成功切换到另一条链路上去
② 关闭[R6-GigabitEthernet0/0/0]测试如下图:
由上图可知我们可以成功切换到另一条链路上去
R5/R6 g/0/0/1我们就在这里不一一测试了
总结:本实验中拓扑设计是分流互备,我以前上传过关于解决远离骨干的非骨干三种解决方案,其中咱们最推荐的做重发布,本实验需要注意的是咱们做的还是双点双向重发布,这样做的时候我就要注意防环,使用的方法是打tag,用route-policy做过滤;至于做分流是用前缀列表抓路由,用route-policy改开销来干扰ospf选路;还有一点是ospf进程1 的区域 0 里面R1——R2和R3——R4
的这两条链路,我们是修改R3连接R4这条链路的开销,不让他们这两条链路负载均衡。