02-OSPF典型配置指导
本章节下载: 02-OSPF典型配置指导 (471.73 KB)
目 录
OSPF(Open Shortest Path First,开放最短路径优先)是IETF组织开发的一个基于链路状态的内部网关协议。目前针对IPv4协议使用的是OSPF Version 2(RFC 2328)。
OSPF具有如下特点:
l 适应范围广——支持各种规模的网络,最多可支持几百台路由器。
l 快速收敛——在网络的拓扑结构发生变化后立即发送更新报文,使这一变化在自治系统中同步。
l 无自环——由于OSPF根据收集到的链路状态用最短路径树算法计算路由,从算法本身保证了不会生成自环路由。
l 区域划分——允许自治系统的网络被划分成区域来管理,区域间传送的路由信息被进一步抽象,从而减少了占用的网络带宽。
l 等价路由——支持到同一目的地址的多条等价路由。
l 路由分级——使用4类不同的路由,按优先顺序来说分别是:区域内路由、区域间路由、第一类外部路由、第二类外部路由。
l 支持验证——支持基于接口的报文验证,以保证报文交互和路由计算的安全性。
l 组播发送——在某些类型的链路上以组播地址发送协议报文,减少对其他设备的干扰。
如图所示网络,通过进行OSPF基本功能配置,实现网络互通。
图1-1 OSPF基本配置组网图
l 所有的交换机都运行OSPF,并将整个自治系统划分为3个区域。
l 其中Switch A和Switch B作为ABR来转发区域之间的路由。
l 配置完成后,每台交换机都应学到AS内的到所有网段的路由。
表1-1 配置适用的产品与软件版本关系
产品 |
软件版本 |
S7500E系列以太网交换机 |
Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列 |
S7600系列以太网交换机 |
Release 6600系列,Release 6610系列 |
S5800&S5820X系列以太网交换机 |
Release 1110,Release 1211 |
CE3000-32F以太网交换机 |
Release 1211 |
S5500-EI系列以太网交换机 |
Release 2202,Release 2208 |
S5500-EI-D系列以太网交换机 |
Release 2208 |
S3610&S5510系列以太网交换机 |
Release 5301,Release 5303,Release 5306,Release 5309 |
S3500-EA系列以太网交换机 |
Release 5303,Release 5309 |
(1) 配置各接口的IP地址(略)
(2) 配置OSPF基本配置
# 配置Switch A。
<SwitchA> system-view
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] area 1
[SwitchA-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.1] quit
[SwitchA-ospf-1] quit
# 配置Switch B。
<SwitchB> system-view
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] area 2
[SwitchB-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.2] quit
[SwitchB-ospf-1] quit
# 配置Switch C。
<SwitchC> system-view
[SwitchC] ospf
[SwitchC-ospf-1] area 1
[SwitchC-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.1] quit
[SwitchC-ospf-1] quit
# 配置Switch D。
<SwitchD> system-view
[SwitchD] ospf
[SwitchD-ospf-1] area 2
[SwitchD-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.2] quit
[SwitchD-ospf-1] quit
(3) 检验配置结果
# 查看Switch A的OSPF邻居。
[SwitchA] display ospf peer verbose
OSPF Process 1 with Router ID 192.168.0.1
Neighbors
Area 0.0.0.0 interface 192.168.0.1(Vlan-interface 100)'s neighbors
Router ID: 192.168.0.2 Address: 192.168.0.2 GR State: Normal
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.0.2 BDR: 192.168.0.1 MTU: 0
Dead timer due in 36 sec
Neighbor is up for 00:15:04
Authentication Sequence: [ 0 ]
Neighbor state change count: 3
Neighbors
Area 0.0.0.1 interface 192.168.1.1(Vlan-interface 200)'s neighbors
Router ID: 192.168.1.2 Address: 192.168.1.2 GR State: Normal
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.1.2 BDR: 192.168.1.1 MTU: 0
Dead timer due in 39 sec
Neighbor is up for 00:07:32
Authentication Sequence: [ 0 ]
Neighbor state change count: 2
# 显示Switch A的OSPF路由信息。
[SwitchA] display ospf routing
OSPF Process 1 with Router ID 192.168.0.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.1.0/24 1563 Stub 192.168.1.2 172.16.1.1 0.0.0.1
172.17.1.0/24 3125 Inter-area 192.168.0.2 192.168.2.1 0.0.0.0
192.168.1.0/24 1562 Stub 192.168.1.1 192.168.0.1 0.0.0.1
192.168.2.0/24 3124 Inter-area 192.168.0.2 192.168.2.1 0.0.0.0
192.168.0.0/24 1562 Stub 192.168.0.1 192.168.0.1 0.0.0.0
Total Nets: 5
Intra Area: 3 Inter Area: 2 ASE: 0 NSSA: 0
# 显示Switch A的LSDB。
[SwitchA] display ospf lsdb
OSPF Process 1 with Router ID 192.168.0.1
Link State Data Base
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 192.168.2.1 192.168.2.1 874 48 80000006 1562
Router 192.168.0.1 192.168.0.1 976 48 80000005 1562
Sum-Net 192.168.1.0 192.168.0.1 630 28 80000001 1562
Sum-Net 172.17.1.0 192.168.2.1 411 28 80000001 1563
Sum-Net 192.168.2.0 192.168.2.1 429 28 80000001 1562
Sum-Net 172.16.1.0 192.168.0.1 565 28 80000001 1563
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 192.168.1.2 192.168.1.2 964 48 80000003 1562
Router 192.168.0.1 192.168.0.1 590 48 80000002 1562
Router 172.16.1.1 172.16.1.1 526 60 80000005 1562
Sum-Net 172.17.1.0 192.168.0.1 410 28 80000001 3125
Sum-Net 192.168.2.0 192.168.0.1 428 28 80000001 3124
Sum-Net 192.168.0.0 192.168.0.1 630 28 80000001 1562
# 查看Switch D的路由表。
[SwitchD] display ospf routing
OSPF Process 1 with Router ID 192.168.2.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.1.0/24 4687 Inter-area 192.168.2.1 192.168.2.1 0.0.0.2
172.17.1.0/24 1 Stub 172.17.1.1 192.168.2.2 0.0.0.2
192.168.1.0/24 4686 Inter-area 192.168.2.1 192.168.2.1 0.0.0.2
192.168.2.0/24 1562 Stub 192.168.2.2 192.168.2.2 0.0.0.2
192.168.0.0/24 3124 Inter-area 192.168.2.1 192.168.2.1 0.0.0.2
Total Nets: 5
Intra Area: 2 Inter Area: 3 ASE: 0 NSSA: 0
# 使用Ping进行测试连通性。
[SwitchD] ping 172.16.1.1
PING 172.16.1.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.1.1: bytes=56 Sequence=1 ttl=253 time=62 ms
Reply from 172.16.1.1: bytes=56 Sequence=2 ttl=253 time=16 ms
Reply from 172.16.1.1: bytes=56 Sequence=3 ttl=253 time=62 ms
Reply from 172.16.1.1: bytes=56 Sequence=4 ttl=253 time=94 ms
Reply from 172.16.1.1: bytes=56 Sequence=5 ttl=253 time=63 ms
--- 172.16.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 16/59/94 ms
l 配置Switch A
#
vlan 100
#
vlan 200
#
interface Vlan-interface100
ip address 192.168.0.1 255.255.255.0
#
interface Vlan-interface200
ip address 192.168.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
#
l 配置Switch B
#
vlan 100
#
vlan 200
#
interface Vlan-interface100
ip address 192.168.0.2 255.255.255.0
#
interface Vlan-interface200
ip address 192.168.2.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.2
network 192.168.2.0 0.0.0.255
#
l 配置Switch C
#
vlan 200
#
vlan 300
#
interface Vlan-interface200
ip address 192.168.1.2 255.255.255.0
#
interface Vlan-interface300
ip address 172.16.1.1 255.255.255.0
#
ospf 1
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 172.16.1.0 0.0.0.255
#
l 配置Switch D
#
vlan 200
#
vlan 300
#
interface Vlan-interface200
ip address 192.168.2.2 255.255.255.0
#
interface Vlan-interface300
ip address 172.17.1.1 255.255.255.0
#
ospf 1
area 0.0.0.2
network 192.168.2.0 0.0.0.255
network 172.17.1.0 0.0.0.255
#
l 在OSPF的各项配置任务中,必须先启动OSPF、指定接口和区域号后,才能配置其它的功能特性。
l 一个网段只能属于一个区域,并且必须为每个运行OSPF协议的接口指明属于某一个特定的区域。
某企业存在多个分支机构,各分支网络通过企业的一级网与外部网络连接。该一级网由四台交换机组成,其中两台交换机作为汇聚层设备分别连接各分支网络,另外两台交换机联入核心层负责连接外部网络。
两台汇聚交换机均为双上行(提供冗余备份链路),上连两台核心交换机,核心交换机负责连接外部网络。
图1-2 OSPF应用典型配置指导
设备 |
接口 |
IP地址 |
设备 |
接口 |
IP地址 |
Switch A |
Vlan-int100 |
10.1.1.1/24 |
Switch C |
Vlan-int100 |
10.1.1.2/24 |
|
Vlan-int200 |
10.1.2.1/24 |
|
Vlan-int300 |
10.1.3.2/24 |
Switch B |
Vlan-int300 |
10.1.3.1/24 |
Switch D |
Vlan-int200 |
10.1.2.2/24 |
|
Vlan-int400 |
10.1.4.1/24 |
|
Vlan-int400 |
10.1.4.2/24 |
可以通过如下配置,实现访问需求:
l 160.1.0.0/16网段分支网络中的主机将网关地址配置为Switch A与之连接的接口地址。
l 160.2.0.0/16网段分支网络中的主机将网关地址配置为Switch B与之连接的接口地址。
l 汇聚层和核心层交换机之间均采用三层互联,使用OSPF路由协议,且均属于区域0。
l 在汇聚层设备上将去往各分支网络的路由引入到OSPF网络,,让两台核心层设备能够通过OSPF学习到去往分支网络的路由。
l 由于ASBR引入外部路由后,每一条路由都会放在单独的一条ASE LSA中向外宣告,可以通过配置路由聚合(与Switch A下连分支网络均属于160.1.0.0/16网段,与Switch B下连分支网络均属于160.2.0.0/16网段,),路由器只把聚合后的路由放在ASE LSA中向外宣告,减少了LSDB中LSA的数量。
l 在核心层交换机上通过BGP学习路由,并将BGP学到的路由重新注入到OSPF网络,最终达到在两台汇聚层交换机上去往外网的路由形成两条等价路由。
表1-2 配置适用的产品与软件版本关系
产品 |
软件版本 |
S7500E系列以太网交换机 |
Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列 |
S7600系列以太网交换机 |
Release 6600系列,Release 6610系列 |
S5800&S5820X系列以太网交换机 |
Release 1110,Release 1211 |
CE3000-32F以太网交换机 |
Release 1211 |
S5500-EI系列以太网交换机 |
Release 2202,Release 2208 |
S5500-EI-D系列以太网交换机 |
Release 2208 |
S3610&S5510系列以太网交换机 |
Release 5301,Release 5303,Release 5306,Release 5309 |
S3500-EA系列以太网交换机 |
Release 5303,Release 5309 |
本配置举例仅列出与OSPF相关内容,有关BGP路由学习和引入的内容请参见BGP手册。
(1) 配置接口的IP地址(略)
(2) 配置OSPF
# 配置Switch A。
<SwitchA> system-view
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# 配置Switch B。
<SwitchB> system-view
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] network 10.1.4.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
# 配置Switch C。
<SwitchC> system-view
[SwitchC] ospf
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
# 配置Switch D。
<SwitchD> system-view
[SwitchD] ospf
[SwitchD-ospf-1] area 0
[SwitchD-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] network 10.1.4.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
# 查看Switch A的路由表信息(假定Switch A下连三个分支网络)。
[SwitchA] display ip routing-table
Routing Tables: Public
Destinations : 14 Routes : 14
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.0/24 Direct 0 0 10.1.1.1 Vlan100
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.2.0/24 Direct 0 0 10.1.2.1 Vlan200
10.1.2.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.3.0/24 OSPF 10 2 10.1.1.2 Vlan100
10.1.4.0/24 OSPF 10 2 10.1.2.2 Vlan200
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
160.1.1.0/24 Direct 0 0 160.1.1.1 Vlan1
160.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
160.1.2.0/24 Direct 0 0 160.1.2.1 Vlan2
160.1.2.1/32 Direct 0 0 127.0.0.1 InLoop0
160.1.3.0/24 Direct 0 0 160.1.3.1 Vlan3
160.1.3.1/32 Direct 0 0 127.0.0.1 InLoop0
(3) 配置路由引入
# 在Switch A上配置OSPF引入直连路由(一部分分支网络与Switch A直连),只发布聚合路由160.1.0.0/16。
[SwitchA] ospf
[SwitchA-ospf-1] import-route direct
[SwitchA-ospf-1] asbr-summary 160.1.0.0 16
# 在Switch B上配置OSPF引入直连路由(另一部分各分支网络与Switch B直连),只发布聚合路由160.2.0.0/16。
[SwitchB] ospf
[SwitchB-ospf-1] import-route direct
[SwitchB-ospf-1] asbr-summary 160.2.0.0 16
# 在Switch C上配置OSPF引入BGP路由。
[SwitchC] ospf
[SwitchC-ospf-1] import-route bgp
# 在Switch D上配置OSPF引入BGP路由。
[SwitchD] ospf
[SwitchD-ospf-1] import-route bgp
l 配置Switch A
#
vlan 100
#
vlan 200
#
interface Vlan-interface100
ip address 10.1.1.1 255.255.255.0
#
interface Vlan-interface200
ip address 10.1.2.1 255.255.255.0
#
ospf 1
asbr-summary 160.1.0.0 255.255.0.0
import-route direct
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.2.0 0.0.0.255
#
l 配置Switch B
#
vlan 300
#
vlan 400
#
interface Vlan-interface300
ip address 10.1.3.1 255.255.255.0
#
interface Vlan-interface400
ip address 10.1.4.1 255.255.255.0
#
ospf 1
asbr-summary 160.2.0.0 255.255.0.0
import-route direct
area 0.0.0.0
network 10.1.3.0 0.0.0.255
network 10.1.4.0 0.0.0.255
#
l 配置Switch C
#
vlan 100
#
vlan 300
#
interface Vlan-interface100
ip address 10.1.1.2 255.255.255.0
#
interface Vlan-interface300
ip address 10.1.3.2 255.255.255.0
#
ospf 1
import-route bgp
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.3.0 0.0.0.255
#
l 配置Switch D
#
vlan 200
#
vlan 400
#
interface Vlan-interface200
ip address 10.1.2.2 255.255.255.0
#
interface Vlan-interface400
ip address 10.1.4.2 255.255.255.0
#
ospf 1
import-route bgp
area 0.0.0.0
network 10.1.2.0 0.0.0.255
network 10.1.4.0 0.0.0.255
#
l 针对自治系统边界路由器(ASBR),使用asbr-summary命令可对引入的聚合地址范围内的Type-5 LSA描述的路由进行聚合;当配置了NSSA区域时,还要对引入的聚合地址范围内的Type-7 LSA描述的路由进行聚合。
l 如果本地路由器是区域边界路由器(ABR),且是NSSA区域的转换路由器,则对由Type-7 LSA转化成的Type-5 LSA描述的路由进行聚合处理;对于不是NSSA区域的转换路由器,则不进行聚合处理。
l 配置asbr-summary命令后,对处于聚合地址范围内的外部路由,本地路由器只向邻居路由器发布一条聚合后的路由;配置undo asbr-summary命令后,原来被聚合的外部路由将重新被发布。
如下图所示网络,划分为两个AS,AS是拥有同一选路策略,在同一技术管理部门下运行的一组路由器。在AS之间,可以通过BGP(Border Gateway Protocol,边界网关协议)进行路由协议交换, OSPF作为内部网关路由协议,与BGP结合获取网络间路由信息。另外OSPF在引入外部AS的路由时,可以进行聚合,从而减少路由条目数。
图1-3 配置OSPF发布聚合路由
l Switch A和Switch B位于AS200内,Switch C、Switch D和Switch E位于AS100内,AS100和AS200内均使用OSPF做为IGP协议;
l Switch B和Switch C之间建立EBGP连接。
l 为了让AS 200内路由器获取AS100内路由信息,在Switch C上配置BGP引入OSPF路由、直连路由;在Switch B上配置OSPF进程引入BGP路由。
l 为了减小Switch A的路由表规模,在Switch B上配置路由聚合,只发布聚合后的路由10.0.0.0/8。
l 为了让AS 100内路由器获取AS200内路由信息,在Switch B上配置BGP引入直连路由;在Switch C上配置OSPF进程引入BGP路由。
表1-3 配置适用的产品与软件版本关系
产品 |
软件版本 |
S7500E系列以太网交换机 |
Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列 |
S7600系列以太网交换机 |
Release 6600系列,Release 6610系列 |
S5800&S5820X系列以太网交换机 |
Release 1110,Release 1211 |
CE3000-32F以太网交换机 |
Release 1211 |
S5500-EI系列以太网交换机 |
Release 2202,Release 2208 |
S5500-EI-D系列以太网交换机 |
Release 2208 |
S3610&S5510系列以太网交换机 |
Release 5301,Release 5303,Release 5306,Release 5309 |
S3500-EA系列以太网交换机 |
Release 5303,Release 5309 |
(1) 配置接口的IP地址(略)
(2) 配置OSPF
# 配置Switch A。
<SwitchA> system-view
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# 配置Switch B。
<SwitchB> system-view
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
# 配置Switch C。
<SwitchC> system-view
[SwitchC] ospf
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
# 配置Switch D。
<SwitchD> system-view
[SwitchD] ospf
[SwitchD-ospf-1] area 0
[SwitchD-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] network 10.3.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] quit
# 配置Switch E。
<SwitchE> system-view
[SwitchE] ospf
[SwitchE-ospf-1] area 0
[SwitchE-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[SwitchE-ospf-1-area-0.0.0.0] network 10.4.1.0 0.0.0.255
[SwitchE-ospf-1-area-0.0.0.0] quit
[SwitchE-ospf-1] quit
(3) 配置BGP
# 配置Switch B。
<SwitchB> system-view
[SwitchB] bgp 200
[SwitchB-bgp] peer 11.1.1.2 as-number 100
[SwitchB-bgp] quit
# 配置Switch C。
<SwitchC> system-view
[SwitchC] bgp 100
[SwitchC-bgp] peer 11.1.1.1 as-number 200
# 在配置Switch C上配置将OSPF路由引入BGP。
[SwitchC-bgp] import-route ospf
# 在配置Switch C上配置将直连路由引入BGP。
[SwitchC-bgp] import-route direct
# 在Switch C上配置OSPF引入BGP路由
[SwitchC] ospf
[SwitchC-ospf-1] import-route bgp
(4) 在Switch B上配置路由引入
# 在Switch B上配置OSPF引入BGP路由
[SwitchB] ospf
[SwitchB-ospf-1] import-route bgp
# 在配置Switch B上配置将直连路由引入BGP。
[SwitchB] bgp 200
[SwitchB-bgp] import-route direct
# 查看Switch A的路由表信息。
[SwitchA] display ip routing-table
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.0/24 O_ASE 150 1 11.2.1.1 Vlan100
10.2.1.0/24 O_ASE 150 1 11.2.1.1 Vlan100
10.3.1.0/24 O_ASE 150 1 11.2.1.1 Vlan100
10.4.1.0/24 O_ASE 150 1 11.2.1.1 Vlan100
11.2.1.0/24 Direct 0 0 11.2.1.2 Vlan100
11.2.1.2/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
(5) 在Switch B上配置路由聚合,只发布聚合路由10.0.0.0/8。
[SwitchB-ospf-1] asbr-summary 10.0.0.0 8
# 查看Switch A的路由表信息。
[SwitchA] display ip routing-table
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost NextHop Interface
10.0.0.0/8 O_ASE 150 2 11.2.1.1 Vlan100
11.2.1.0/24 Direct 0 0 11.2.1.2 Vlan100
11.2.1.2/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
l 配置Switch A
#
vlan 100
#
interface Vlan-interface100
ip address 11.2.1.2 255.255.255.0
#
ospf 1
area 0.0.0.0
network 11.2.1.0 0.0.0.255
#
l 配置Switch B
#
vlan 100
#
vlan 200
#
interface Vlan-interface100
ip address 11.2.1.1 255.255.255.0
#
interface Vlan-interface200
ip address 11.1.1.1 255.255.255.0
#
bgp 200
undo synchronization
peer 11.1.1.2 as-number 100
import-route direct
#
ospf 1
asbr-summary 10.0.0.0 255.0.0.0
import-route bgp
area 0.0.0.0
network 11.2.1.0 0.0.0.255
#
l 配置Switch C
#
vlan 200
#
vlan 300
#
vlan 400
#
interface Vlan-interface200
ip address 11.1.1.2 255.255.255.0
#
interface Vlan-interface300
ip address 10.2.1.1 255.255.255.0
#
interface Vlan-interface400
ip address 10.1.1.2 255.255.255.0
#
bgp 100
import-route ospf 1
undo synchronization
peer 11.1.1.1 as-number 200
import-route direct
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.2.1.0 0.0.0.255
import-route bgp
#
l 配置Switch D
#
vlan 400
#
vlan 500
#
interface Vlan-interface400
ip address 10.1.1.1 255.255.255.0
#
interface Vlan-interface500
ip address 10.3.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.3.1.0 0.0.0.255
#
l 配置Switch E
#
vlan 300
#
vlan 600
#
interface Vlan-interface300
ip address 10.2.1.2 255.255.255.0
#
interface Vlan-interface600
ip address 10.4.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 10.2.1.0 0.0.0.255
network 10.4.1.0 0.0.0.255
#
配置引入路由到BGP中时,注意引入直连路由,否则直连网段的路由信息,无法传递到另一个AS。
因为引入路由时只能引入路由表中状态为active的路由,直连路由优先级高于OSPF路由,因此路由表中直连网段的路由不是OSPF路由。
OSPF划分区域后,可以减少网络中LSA的数量,OSPF的扩展性也得以增强。对于一些非骨干区域,为了更多的缩减其路由表规模和降低LSA的数量,可以将它们配置为Stub区域。
比如下图中,如果Switch C下面直接连接主机,不再有其他路由器相连,则Switch C可以配置为Stub区域,作为末梢区域,可以简化其路由表及通告的LSA数量。
图1-4 配置OSPF Stub区域组网图
l 所有的交换机都运行OSPF,整个自治系统划分为3个区域。
l 其中Switch A和Switch B作为ABR来转发区域之间的路由,Switch D作为ASBR引入了外部路由(静态路由)。
l 要求将Area1配置为Stub区域,减少通告到此区域内的LSA数量,但不影响路由的可达性。
表1-4 配置适用的产品与软件版本关系
产品 |
软件版本 |
S7500E系列以太网交换机 |
Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列 |
S7600系列以太网交换机 |
Release 6600系列,Release 6610系列 |
S5800&S5820X系列以太网交换机 |
Release 1110,Release 1211 |
CE3000-32F以太网交换机 |
Release 1211 |
S5500-EI系列以太网交换机 |
Release 2202,Release 2208 |
S5500-EI-D系列以太网交换机 |
Release 2208 |
S3610&S5510系列以太网交换机 |
Release 5301,Release 5303,Release 5306,Release 5309 |
S3500-EA系列以太网交换机 |
Release 5303,Release 5309 |
(1) 配置接口的IP地址(略)
(2) 配置OSPF(同前例1.2 )
(3) 配置Switch D引入静态路由
[SwitchD] ip route-static 200.0.0.0 8 null 0
[SwitchD] ospf
[SwitchD-ospf-1] import-route static
[SwitchD-ospf-1] quit
# 查看Switch C的ABR/ASBR信息。
[SwitchC] display ospf abr-asbr
OSPF Process 1 with Router ID 172.16.1.1
Routing Table to ABR and ASBR
Type Destination Area Cost Nexthop RtType
Intra-area 192.168.0.1 0.0.0.1 1562 192.168.1.1 ABR
Inter-area 172.17.1.1 0.0.0.1 4686 192.168.1.1 ASBR
# 查看Switch C的OSPF路由表。
[SwitchC] display ospf routing
OSPF Process 1 with Router ID 172.16.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.1.0/24 1 Stub 172.16.1.1 172.16.1.1 0.0.0.1
172.17.1.0/24 4687 Inter-area 192.168.1.1 192.168.0.1 0.0.0.1
192.168.1.0/24 1562 Stub 192.168.1.2 172.16.1.1 0.0.0.1
192.168.2.0/24 4686 Inter-area 192.168.1.1 192.168.0.1 0.0.0.1
192.168.0.0/24 3124 Inter-area 192.168.1.1 192.168.0.1 0.0.0.1
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
200.0.0.0/8 10 Type2 1 192.168.1.1 172.17.1.1
Routing for NSSAs
Destination Cost Type Tag NextHop AdvRouter
Total Nets: 6
Intra Area: 2 Inter Area: 3 ASE: 1 NSSA: 0
当Switch C所在区域为普通区域时,可以看到路由表中存在AS外部的路由。
(4) 配置Area1为Stub区域
# 配置Switch A。
[SwitchA] ospf
[SwitchA-ospf-1] area 1
[SwitchA-ospf-1-area-0.0.0.1] stub
[SwitchA-ospf-1-area-0.0.0.1] quit
[SwitchA-ospf-1] quit
# 配置Switch C。
[SwitchC] ospf
[SwitchC-ospf-1] stub-router
[SwitchC-ospf-1] area 1
[SwitchC-ospf-1-area-0.0.0.1] stub
[SwitchC-ospf-1-area-0.0.0.1] quit
[SwitchC-ospf-1] quit
# 显示Switch C的OSPF路由表。
[SwitchC] display ospf routing
OSPF Process 1 with Router ID 172.16.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
0.0.0.0/0 65536 Inter-area 192.168.1.1 192.168.0.1 0.0.0.1
172.16.1.0/24 1 Stub 172.16.1.1 172.16.1.1 0.0.0.1
172.17.1.0/24 68660 Inter-area 192.168.1.1 192.168.0.1 0.0.0.1
192.168.1.0/24 1562 Stub 192.168.1.2 172.16.1.1 0.0.0.1
192.168.2.0/24 68659 Inter-area 192.168.1.1 192.168.0.1 0.0.0.1
192.168.0.0/24 67097 Inter-area 192.168.1.1 192.168.0.1 0.0.0.1
Total Nets: 6
Intra Area: 2 Inter Area: 4 ASE: 0 NSSA: 0
当把Switch C所在区域配置为Stub区域时,已经看不到AS外部的路由,取而代之的是一条缺省路由。
# 配置禁止向Stub区域通告Type3 LSA。
[SwitchA] ospf
[SwitchA-ospf-1] area 1
[SwitchA-ospf-1-area-0.0.0.1] stub no-summary
[SwitchA-ospf-1-area-0.0.0.1] quit
# 查看Switch C的OSPF路由表。
[SwitchC] display ospf routing
OSPF Process 1 with Router ID 172.16.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
0.0.0.0/0 1563 Inter-area 192.168.1.1 192.168.0.1 0.0.0.1
172.16.1.0/24 1 Stub 172.16.1.1 172.16.1.1 0.0.0.1
192.168.1.0/24 1562 Stub 192.168.1.2 172.16.1.1 0.0.0.1
Total Nets: 3
Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0
禁止向Stub区域通告Summary LSA后,Stub路由器的路由表项进一步减少,只保留了一条通往区域外部的缺省路由。
l 配置Switch A
#
vlan 100
#
vlan 200
#
interface Vlan-interface100
ip address 192.168.0.1 255.255.255.0
#
interface Vlan-interface200
ip address 192.168.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
stub no-summary
#
l 配置Switch B
#
vlan 100
#
vlan 200
#
interface Vlan-interface100
ip address 192.168.0.2 255.255.255.0
#
interface Vlan-interface200
ip address 192.168.2.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.2
network 192.168.2.0 0.0.0.255
#
l 配置Switch C
#
vlan 200
#
vlan 300
#
interface Vlan-interface200
ip address 192.168.1.2 255.255.255.0
#
interface Vlan-interface300
ip address 172.16.1.1 255.255.255.0
#
ospf 1
stub-router
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 172.16.1.0 0.0.0.255
stub
#
l 配置Switch D
#
vlan 200
#
vlan 300
#
interface Vlan-interface200
ip address 192.168.2.2 255.255.255.0
#
interface Vlan-interface300
ip address 172.17.1.1 255.255.255.0
#
ospf 1
area 0.0.0.2
network 192.168.2.0 0.0.0.255
network 172.17.1.0 0.0.0.255
import-route static
#
ip route-static 200.0.0.0 255.0.0.0 NULL0
#
l 骨干区域不能配置成(Totally)Stub区域。
l 如果要将一个区域配置成Stub区域,则该区域中的所有路由器必须都要配置stub命令。
l 如果要将一个区域配置成Totally Stub区域,该区域中的所有路由器必须配置stub命令,而其中该区域的ABR路由器需要配置stub no-summary 命令。
l (Totally)Stub区域内不能存在ASBR,即自治系统外部的路由不能在本区域内传播。
l 虚连接不能穿过(Totally)Stub区域。
Stub区域不能引入外部路由,为此又产生了NSSA区域的概念。NSSA区域中允许Type7 LSA(NSSA External LSA)的传播。Type7 LSA由NSSA区域的ASBR产生,当它到达NSSA区域的ABR时,就会转换成Type5 LSA(AS External LSA),并通告到其他区域。
比如下图中,如果Switch C需要引入外部路由,则可以配置为NSSA区域。
图1-5 配置OSPF NSSA区域组网图
l 所有的交换机都运行OSPF,整个自治系统划分为3个区域。
l 其中Switch A和Switch B作为ABR来转发区域之间的路由,Switch D作为ASBR引入了外部路由(静态路由)。
l 要求将Area1配置为NSSA区域,同时将Switch C配置为ASBR引入外部路由(静态路由),且路由信息可正确的在AS内传播。
表1-5 配置适用的产品与软件版本关系
产品 |
软件版本 |
S7500E系列以太网交换机 |
Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列 |
S7600系列以太网交换机 |
Release 6600系列,Release 6610系列 |
S5800&S5820X系列以太网交换机 |
Release 1110,Release 1211 |
CE3000-32F以太网交换机 |
Release 1211 |
S5500-EI系列以太网交换机 |
Release 2202,Release 2208 |
S5500-EI-D系列以太网交换机 |
Release 2208 |
S3610&S5510系列以太网交换机 |
Release 5301,Release 5303,Release 5306,Release 5309 |
S3500-EA系列以太网交换机 |
Release 5303,Release 5309 |
(1) 配置各接口的IP地址(略)
(2) 配置OSPF(同前例1.1 )
(3) 配置Switch D引入静态路由(同前例1.5 )
(4) 配置Area1区域为NSSA区域
# 配置Switch A。
[SwitchA] ospf
[SwitchA-ospf-1] area 1
[SwitchA-ospf-1-area-0.0.0.1] nssa default-route-advertise no-summary
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# 配置Switch C。
[SwitchC] ospf
[SwitchC-ospf-1] area 1
[SwitchC-ospf-1-area-0.0.0.1] nssa
[SwitchC-ospf-1-area-0.0.0.1] quit
[SwitchC-ospf-1] quit
l 如果NSSA区域内路由器(这里的Switch C)需要获取通往AS内其他区域的路由,ABR(这里的Switch A)上必须配置default-route-advertise参数,这样Switch C才可以获取到缺省路由。
l 建议在ABR(这里的Switch A)上配置no-summary参数,这样可以减少NSSA路由器的路由表数量。其他NSSA路由器只需配置nssa命令就可以。
# 查看Switch C的OSPF路由表。
[SwitchC] display ospf routing
OSPF Process 1 with Router ID 172.16.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
0.0.0.0/0 1563 Inter-area 192.168.1.1 192.168.0.1 0.0.0.1
172.16.1.0/24 1 Stub 172.16.1.1 172.16.1.1 0.0.0.1
192.168.1.0/24 1562 Stub 192.168.1.2 172.16.1.1 0.0.0.1
Total Nets: 3
Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0
(5) 配置Switch C引入静态路由
[SwitchC] ip route-static 100.0.0.0 8 null 0
[SwitchC] ospf
[SwitchC-ospf-1] import-route static
[SwitchC-ospf-1] quit
# 查看Switch D的OSPF路由表。
[SwitchD-ospf-1] display ospf routing
OSPF Process 1 with Router ID 172.17.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.1.0/24 4687 Inter-area 192.168.2.1 192.168.0.2 0.0.0.2
172.17.1.0/24 1 Stub 172.17.1.1 172.17.1.1 0.0.0.2
192.168.1.0/24 4686 Inter-area 192.168.2.1 192.168.0.2 0.0.0.2
192.168.2.0/24 1562 Stub 192.168.2.2 172.17.1.1 0.0.0.2
192.168.0.0/24 3124 Inter-area 192.168.2.1 192.168.0.2 0.0.0.2
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
100.0.0.0/8 10 Type2 1 192.168.2.1 192.168.0.1
Routing for NSSAs
Destination Cost Type Tag NextHop AdvRouter
Total Nets: 6
Intra Area: 2 Inter Area: 3 ASE: 1 NSSA: 0
在Switch D上可以看到NSSA区域引入的一条AS外部的路由。
l 配置Switch A
#
vlan 100
#
vlan 200
#
interface Vlan-interface100
ip address 192.168.0.1 255.255.255.0
#
interface Vlan-interface200
ip address 192.168.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
nssa default-route-advertise no-summary
#
l 配置Switch B
#
vlan 100
#
vlan 200
#
interface Vlan-interface100
ip address 192.168.0.2 255.255.255.0
#
interface Vlan-interface200
ip address 192.168.2.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.2
network 192.168.2.0 0.0.0.255
#
l 配置Switch C
#
vlan 200
#
vlan 300
#
interface Vlan-interface200
ip address 192.168.1.2 255.255.255.0
#
interface Vlan-interface300
ip address 172.16.1.1 255.255.255.0
#
ospf 1
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 172.16.1.0 0.0.0.255
nssa
import-route static
#
ip route-static 100.0.0.0 255.0.0.0 NULL0
#
l 配置Switch D
#
vlan 200
#
vlan 300
#
interface Vlan-interface200
ip address 192.168.2.2 255.255.255.0
#
interface Vlan-interface300
ip address 172.17.1.1 255.255.255.0
#
ospf 1
area 0.0.0.2
network 192.168.2.0 0.0.0.255
network 172.17.1.0 0.0.0.255
import-route static
#
ip route-static 200.0.0.0 255.0.0.0 NULL0
#
l 所有连接到NSSA区域的路由器必须使用nssa命令将该区域配置成NSSA属性。
l 假如路由器上已经配置了stub属性,则需要先通过undo stub命令,取消stub区域配置,才能配置NSSA属性。
l 如果NSSA区域内路由器需要获取通往AS内其他区域的路由,ABR上必须配置default-route-advertise参数来发布缺省路由。
l 与Stub区域一样,虚连接也不能穿过NSSA区域。
在广播网和NBMA网络中,任意两台路由器之间都要交换路由信息。如果网络中有n台路由器,则需要建立n(n-1)/2个邻接关系。这使得任何一台路由器的路由变化都会导致多次传递,浪费了带宽资源。为解决这一问题,OSPF协议定义了指定路由器DR(Designated Router),所有路由器都只将信息发送给DR,由DR将网络链路状态发送出去。
如果DR由于某种故障而失效,则网络中的路由器必须重新选举DR,再与新的DR同步。这需要较长的时间,在这段时间内,路由的计算是不正确的。为了能够缩短这个过程,OSPF提出了BDR(Backup Designated Router,备份指定路由器)的概念。
BDR实际上是对DR的一个备份,在选举DR的同时也选举出BDR,BDR也和本网段内的所有路由器建立邻接关系并交换路由信息。当DR失效后,BDR会立即成为DR。由于不需要重新选举,并且邻接关系事先已建立,所以这个过程是非常短暂的。当然这时还需要再重新选举出一个新的BDR,虽然一样需要较长的时间,但并不会影响路由的计算。
运行OSPF进程的网络中,既不是DR也不是BDR的路由器为DR Other。DR Other仅与DR和BDR之间建立邻接关系,DR Other之间不交换任何路由信息。这样就减少了广播网和NBMA网络上各路由器之间邻接关系的数量,同时减少网络流量,节约了带宽资源。
Switch A、Switch B、Switch C、Switch D在同一网段,运行OSPF协议;通过对DR优先级的调整,配置指定路由器作为DR和BDR。
图1-6 配置OSPF优先级的DR选择组网图
通过配置DR优先级,实现OSPF网络中Switch A为DR,Switch C为BDR。
产品 |
软件版本 |
S7500E系列以太网交换机 |
Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列 |
S7600系列以太网交换机 |
Release 6600系列,Release 6610系列 |
S5800&S5820X系列以太网交换机 |
Release 1110,Release 1211 |
CE3000-32F以太网交换机 |
Release 1211 |
S5500-EI系列以太网交换机 |
Release 2202,Release 2208 |
S5500-EI-D系列以太网交换机 |
Release 2208 |
S3610&S5510系列以太网交换机 |
Release 5301,Release 5303,Release 5306,Release 5309 |
S3500-EA系列以太网交换机 |
Release 5303,Release 5309 |
(1) 配置各接口的IP地址(略)
(2) 配置OSPF基本功能
# 配置Switch A,设置其Router ID为1.1.1.1,并启动OSPF。
<SwitchA> system-view
[SwitchA] router id 1.1.1.1
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# 配置Switch B,设置其Router ID为2.2.2.2,并启动OSPF。
<SwitchB> system-view
[SwitchB] router id 2.2.2.2
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] quit
# 配置Switch C,设置其Router ID为3.3.3.3,并启动OSPF。
<SwitchC> system-view
[SwitchC] router id 3.3.3.3
[SwitchC] ospf
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
# 配置Switch D,设置其Router ID为4.4.4.4,并启动OSPF。
<SwitchD> system-view
[SwitchD] router id 4.4.4.4
[SwitchD] ospf
[SwitchD-ospf-1] area 0
[SwitchD-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] quit
[SwitchD-ospf-1] quit
# 查看Switch A的邻居信息。
[SwitchA] display ospf peer verbose
OSPF Process 1 with Router ID 1.1.1.1
Neighbors
Area 0.0.0.0 interface 192.168.1.1(Vlan-interface1)'s neighbors
Router ID: 2.2.2.2 Address: 192.168.1.2 GR State: Normal
State: 2-Way Mode: None Priority: 1
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 38 sec
Neighbor is up for 00:01:31
Authentication Sequence: [ 0 ]
Neighbor state change count: 2
Router ID: 3.3.3.3 Address: 192.168.1.3 GR State: Normal
State: Full Mode: Nbr is Master Priority: 1
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 31 sec
Neighbor is up for 00:01:28
Authentication Sequence: [ 0 ]
Neighbor state change count: 2
Router ID: 4.4.4.4 Address: 192.168.1.4 GR State: Normal
State: Full Mode: Nbr is Master Priority: 1
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 31 sec
Neighbor is up for 00:01:28
Authentication Sequence: [ 0 ]
Neighbor state change count: 2
可以看到Switch D为DR,Switch C为BDR。
(3) 配置接口的DR优先级
# 配置Switch A。
[SwitchA] interface vlan-interface 1
[RouterA-Vlan-interface1] ospf dr-priority 100
[RouterA-Vlan-interface1] quit
# 配置Switch B。
[SwitchB] interface vlan-interface 1
[SwitchB-Vlan-interface1] ospf dr-priority 0
[SwitchB-Vlan-interface1] quit
# 配置Switch C。
[SwitchC] interface vlan-interface 1
[SwitchC-Vlan-interface1] ospf dr-priority 2
[SwitchC-Vlan-interface] quit
# 查看Switch D的邻居信息。
[SwitchD] display ospf peer verbose
OSPF Process 1 with Router ID 4.4.4.4
Neighbors
Area 0.0.0.0 interface 192.168.1.4(Vlan-interface1)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.1 GR State: Normal
State: Full Mode:Nbr is Slave Priority: 100
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 31 sec
Neighbor is up for 00:11:17
Authentication Sequence: [ 0 ]
Neighbor state change count: 3
Router ID: 2.2.2.2 Address: 192.168.1.2 GR State: Normal
State: Full Mode:Nbr is Slave Priority: 0
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 35 sec
Neighbor is up for 00:11:19
Authentication Sequence: [ 0 ]
Neighbor state change count: 3
Router ID: 3.3.3.3 Address: 192.168.1.3 GR State: Normal
State: Full Mode:Nbr is Slave Priority: 2
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 33 sec
Neighbor is up for 00:11:15
Authentication Sequence: [ 0 ]
Neighbor state change count: 3
可以看到,网络中DR/BDR并没有改变。
网络中DR/BDR已经存在的情况下,接口上的路由器优先级的配置并不会立即生效。
(4) 重启OSPF进程
# 重启Switch D的进程。
<SwitchD> reset ospf 1 process
Warning : Reset OSPF process? [Y/N]:y
# 查看Switch D的邻居信息。
[SwitchD] display ospf peer verbose
OSPF Process 1 with Router ID 4.4.4.4
Neighbors
Area 0.0.0.0 interface 192.168.1.4(Vlan-interface1)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.1.1 GR State: Normal
State: Full Mode: Nbr is Slave Priority: 100
DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0
Dead timer due in 39 sec
Neighbor is up for 00:01:40
Authentication Sequence: [ 0 ]
Neighbor state change count: 2
Router ID: 2.2.2.2 Address: 192.168.1.2 GR State: Normal
State: 2-Way Mode: None Priority: 0
DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0
Dead timer due in 35 sec
Neighbor is up for 00:01:44
Authentication Sequence: [ 0 ]
Neighbor state change count: 2
Router ID: 3.3.3.3 Address: 192.168.1.3 GR State: Normal
State: Full Mode: Nbr is Slave Priority: 2
DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0
Dead timer due in 39 sec
Neighbor is up for 00:01:41
Authentication Sequence: [ 0 ]
Neighbor state change count: 2
可以看到Switch A成为DR,Switch C为BDR。
l 如果邻居的状态是Full,这说明它和邻居之间形成了邻接关系;
l 如果邻居的状态是2-Way,则说明它们都不是DR或BDR,两者之间不需要交换LSA。
# 查看OSPF接口的状态。
[SwitchA] display ospf interface
OSPF Process 1 with Router ID 1.1.1.1
Interfaces
Area: 0.0.0.0
IP Address Type State Cost Pri DR BDR
192.168.1.1 Broadcast DR 1 100 192.168.1.1 192.168.1.3
[SwitchB] display ospf interface
OSPF Process 1 with Router ID 2.2.2.2
Interfaces
Area: 0.0.0.0
IP Address Type State Cost Pri DR BDR
192.168.1.2 Broadcast DROther 1 0 192.168.1.1 192.168.1.3
如果OSPF接口的状态是DROther,则说明它既不是DR,也不是BDR。
l 配置Switch A
#
router id 1.1.1.1
#
interface Vlan-interface1
ip address 192.168.1.1 255.255.255.0
ospf dr-priority 100
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
l 配置Switch B
#
router id 2.2.2.2
#
interface Vlan-interface1
ip address 192.168.1.2 255.255.255.0
ospf dr-priority 0
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
l 配置Switch C
#
router id 3.3.3.3
#
interface Vlan-interface1
ip address 192.168.1.3 255.255.255.0
ospf dr-priority 2
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
l 配置Switch D
#
router id 4.4.4.4
#
interface Vlan-interface1
ip address 192.168.1.4 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
l 只有在广播或NBMA类型接口才会选举DR,在点到点或点到多点类型的接口上不需要选举DR。
l DR是某个网段中的概念,是针对路由器的接口而言的。某台路由器在一个接口上可能是DR,在另一个接口上有可能是BDR,或者是DR Other。
l 路由器的优先级可以影响DR/BDR的选举过程,但是当DR/BDR已经选举完毕,就算一台具有更高优先级的路由器变为有效,也不会替换该网段中已经存在的DR/BDR成为新的DR/BDR。
l DR并不一定就是路由器优先级最高的路由器接口;同理,BDR也并不一定就是路由器优先级次高的路由器接口。
OSPF划分区域之后,并非所有的区域都是平等的关系。其中有一个区域是与众不同的,它的区域号(Area ID)是0,通常被称为骨干区域。骨干区域负责区域之间的路由,非骨干区域之间的路由信息必须通过骨干区域来转发。对此,OSPF有两个规定:
l 所有非骨干区域必须与骨干区域保持连通;
l 骨干区域自身也必须保持连通。
但在实际应用中,可能会因为各方面条件的限制,无法满足这个要求。这时可以通过配置OSPF虚连接(Virtual Link)予以解决。
虚连接是指在两台ABR之间通过一个非骨干区域而建立的一条逻辑上的连接通道。它的两端必须是ABR,而且必须在两端同时配置方可生效。为虚连接两端提供一条非骨干区域内部路由的区域称为传输区(Transit Area)。
l 如下所示组网图,Area 2与Area0没有直接相连。
l 在配置虚连接之前,Area 2区域中路由器无法获得其他区域路由,其他区域内路由器也无法获取Area 2内相关网络的路由信息。
l 通过配置虚连接,将Area 2与骨干区域连接,从而将整个网络连通,实现路由信息全网交换。
图1-7 配置OSPF虚连接组网图
l Area 1被用作传输区域(Transit Area)来连接Area2和Area0,在Area 1中的Switch B和Switch C之间配置一条虚连接。
l 配置完成后,Switch B能够学到Area2中的路由,Switch D能够学到Area 1、Area 2中的路由。
表1-7 配置适用的产品与软件版本关系
产品 |
软件版本 |
S7500E系列以太网交换机 |
Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列 |
S7600系列以太网交换机 |
Release 6600系列,Release 6610系列 |
S5800&S5820X系列以太网交换机 |
Release 1110,Release 1211 |
CE3000-32F以太网交换机 |
Release 1211 |
S5500-EI系列以太网交换机 |
Release 2202,Release 2208 |
S5500-EI-D系列以太网交换机 |
Release 2208 |
S3610&S5510系列以太网交换机 |
Release 5301,Release 5303,Release 5306,Release 5309 |
S3500-EA系列以太网交换机 |
Release 5303,Release 5309 |
(1) 配置各接口的IP地址(略)
(2) 配置OSPF基本功能
# 配置Switch A,启动OSPF,并设置其Router ID为1.1.1.1。
<SwitchA> system-view
[SwitchA] ospf 1 router-id 1.1.1.1
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
# 配置Switch B,启动OSPF,并设置其Router ID为2.2.2.2。
<SwitchB> system-view
[SwitchB] ospf 1 router-id 2.2.2.2
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] area 1
[SwitchB–ospf-1-area-0.0.0.1] network 10.2.1.0 0.0.0.255
[SwitchB–ospf-1-area-0.0.0.1] quit
# 配置Switch C,启动OSPF,并设置其Router ID为3.3.3.3。
<SwitchC> system-view
[SwitchC] ospf 1 router-id 3.3.3.3
[SwitchC-ospf-1] area 1
[SwitchC-ospf-1-area-0.0.0.1] network 10.2.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.1] quit
[SwitchC-ospf-1] area 2
[SwitchC–ospf-1-area-0.0.0.2] network 10.3.1.0 0.0.0.255
[SwitchC–ospf-1-area-0.0.0.2] quit
# 配置Switch D,启动OSPF,并设置其Router ID为4.4.4.4。
<SwitchD> system-view
[SwitchD] ospf 1 router-id 4.4.4.4
[SwitchD-ospf-1] area 2
[SwitchD-ospf-1-area-0.0.0.2] network 10.3.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.2] quit
# 查看Switch B的OSPF路由表。
[SwitchB] display ospf routing
OSPF Process 1 with Router ID 2.2.2.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.2.1.0/24 2 Transit 10.2.1.1 3.3.3.3 0.0.0.1
10.1.1.0/24 2 Transit 10.1.1.2 2.2.2.2 0.0.0.0
Total Nets: 2
Intra Area: 2 Inter Area: 0 ASE: 0 NSSA: 0
由于Area0没有与Area2直接相连,所以Switch B的路由表中没有Area 2的路由。
(3) 配置虚连接
# 配置Area 1中Switch B与对端Switch C建立虚连接。
[SwitchB] ospf
[SwitchB-ospf-1] area 1
[SwitchB-ospf-1-area-0.0.0.1] vlink-peer 3.3.3.3
[SwitchB-ospf-1-area-0.0.0.1] quit
[SwitchB-ospf-1] quit
# 配置Area 1中Switch C与对端Switch B建立虚连接。
[SwitchC] ospf 1
[SwitchC-ospf-1] area 1
[SwitchC-ospf-1-area-0.0.0.1] vlink-peer 2.2.2.2
[SwitchC-ospf-1-area-0.0.0.1] quit
# 查看Switch B的OSPF路由表。
[SwitchB] display ospf routing
OSPF Process 1 with Router ID 2.2.2.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.2.1.0/24 2 Transit 10.2.1.1 3.3.3.3 0.0.0.1
10.3.1.0/24 5 Inter 10.2.1.2 3.3.3.3 0.0.0.0
10.1.1.0/24 2 Transit 10.1.1.2 2.2.2.2 0.0.0.0
Total Nets: 3
Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0
可以看到,Switch B已经学到了Area2的路由10.3.1.0/24。
l 配置Switch A
#
vlan 300
#
interface Vlan-interface300
ip address 10.1.1.1 255.255.255.0
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
#
l 配置Switch B
#
vlan 200
#
vlan 300
#
interface Vlan-interface200
ip address 10.2.1.1 255.255.255.0
#
interface Vlan-interface300
ip address 10.1.1.2 255.255.255.0
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 10.1.1.0 0.0.0.255
area 0.0.0.1
network 10.2.1.0 0.0.0.255
vlink-peer 3.3.3.3
#
l 配置Switch C
#
vlan 100
#
vlan 200
#
interface Vlan-interface100
ip address 10.3.1.2 255.255.255.0
#
interface Vlan-interface200
ip address 10.2.1.2 255.255.255.0
#
ospf 1 router-id 3.3.3.3
area 0.0.0.1
network 10.2.1.0 0.0.0.255
vlink-peer 2.2.2.2
area 0.0.0.2
network 10.3.1.0 0.0.0.255
#
l 配置Switch D
#
vlan 100
#
interface Vlan-interface100
ip address 10.3.1.1 255.255.255.0
#
ospf 1 router-id 4.4.4.4
area 0.0.0.2
network 10.3.1.0 0.0.0.255
#
l 为使虚连接生效,在虚连接的两端都需配置vlink-peer命令,并且两端配置的hello、dead等参数必须一致。
l vlink-peer命令采用指定对端Router ID来创建虚连接,创建前注意查看对端Router ID,这并不一定是对端相连接口的地址。
l 虚连接不能穿过Stub区域。
l 虚连接也不能穿过NSSA区域。
GR是Graceful Restart(平滑重启)的简称,是一种在协议重启时保证转发业务不中断的机制。
GR机制的核心在于:当某设备进行协议重启时,能够通知其周边设备在一定时间内将到该设备的邻居关系和路由保持稳定。在协议重启完毕后,周边设备协助其进行信息(包括支持GR的路由/MPLS相关协议所维护的各种拓扑、路由和会话信息)同步,在尽量短的时间内使该设备恢复到重启前的状态。
在整个协议重启过程中不会产生路由振荡,报文转发路径也没有任何改变,整个系统可以不间断地转发数据。这个过程即称为平滑重启。
进行OSPF GR相关配置,使Switch B在整个协议重启过程中不会产生路由振荡,报文转发路径也没有任何改变,整个系统可以不间断地转发数据。
图1-8 OSPF GR配置组网图
l Switch A、B、C、D既属于同一自治系统,也属于同一OSPF域,通过OSPF协议实现网络互连。
l 配置Switch B作为GR Restarter,Switch A、C、D作为GR Helper,以实现当Switch B OSPF协议重启或者主备倒换时,整个网络的转发业务不中断。
l 设备提供IETF标准方式和非IETF标准方式两种方式提供GR功能,如下举例中以IETF标准方式进行配置。
表1-8 配置适用的产品与软件版本关系
产品 |
软件版本 |
S7500E系列以太网交换机 |
Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列 |
S7600系列以太网交换机 |
Release 6600系列,Release 6610系列 |
S5800&S5820X系列以太网交换机 |
Release 1110,Release 1211 |
CE3000-32F以太网交换机 |
Release 1211 |
S5500-EI系列以太网交换机 |
Release 2202,Release 2208 |
S5500-EI-D系列以太网交换机 |
Release 2208 |
S3610&S5510系列以太网交换机 |
Release 5301,Release 5303,Release 5306,Release 5309 |
S3500-EA系列以太网交换机 |
Release 5303,Release 5309 |
(1) 配置各交换机接口IP地址,并在接口上启用OSPF基本功能。
# 配置Switch A,启动OSPF。
<SwitchA> system-view
[SwitchA] interface vlan-interface 100
[SwitchA-Vlan-interface100] ip address 10.1.1.2 255.255.255.0
[SwitchA-Vlan-interface100] quit
[SwitchA] ospf 1
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] return
# 配置Switch B,启动OSPF。
<SwitchB> system-view
[SwitchB] interface vlan-interface 100
[SwitchB-Vlan-interface100] ip address 10.1.1.1 255.255.255.0
[SwitchB-Vlan-interface100] quit
[SwitchB] interface vlan-interface 200
[SwitchB-Vlan-interface200] ip address 10.2.1.1 255.255.255.0
[SwitchB-Vlan-interface200] quit
[SwitchB] interface vlan-interface 300
[SwitchB-Vlan-interface300] ip address 10.3.1.1 255.255.255.0
[SwitchB-Vlan-interface300] quit
[SwitchB] ospf 1
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] network 10.3.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] return
# 配置Switch C,启动OSPF。
<SwitchC> system-view
[SwitchC] interface vlan-interface 100
[SwitchC-Vlan-interface100] ip address 10.2.1.2 255.255.255.0
[SwitchC-Vlan-interface100] quit
[SwitchC] ospf 1
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] return
# 配置Switch D,启动OSPF。
<SwitchD> system-view
[SwitchD] interface vlan-interface 300
[SwitchD-Vlan-interface300] ip address 10.3.1.2 255.255.255.0
[SwitchD-Vlan-interface300] quit
[SwitchD] ospf 1
[SwitchD-ospf-1] area 0
[SwitchD-ospf-1-area-0.0.0.0] network 10.3.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] return
(2) 配置各交换机启用IETF标准方式的GR能力。
# 配置Switch B作为GR Restarter。
<SwitchB> system-view
[SwitchB] ospf 1
[SwitchB-ospf-1] opaque-capability enable
[SwitchB-ospf-1] graceful-restart ietf
# 配置Switch A作为GR Helper。
<SwitchA> system-view
[SwitchA] ospf 1
[SwitchA-ospf-1] opaque-capability enable
# 配置Switch C作为GR Helper。
<SwitchC> system-view
[SwitchC] ospf 1
[SwitchC-ospf-1] opaque-capability enable
# 配置Switch D作为GR Helper。
<SwitchD> system-view
[SwitchD] ospf 1
[SwitchD-ospf-1] opaque-capability enable
(3) 检验配置效果
# 运行稳定后,打开Switch B的OSPF平滑启动事件调试信息开关。在Switch B上以GR方式重启OSPF进程。可以看到Switch B在Switch A、C、D的协助下完成GR过程。
<SwitchB> debugging ospf event graceful-restart
<SwitchB> terminal monitor
<SwitchB> terminal debugging
<SwitchB> reset ospf 1 process graceful-restart
%Jan 8 10:58:36:728 2010 SwitchB RM/3/RMLOG:OSPF-NBRCHANGE: Process 1, Neighbor
10.1.1.2(Vlan-interface100) from Full to Down
%Jan 8 10:58:36:728 2010 SwitchB RM/3/RMLOG:OSPF-NBRCHANGE: Process 1, Neighbor
10.2.1.2(Vlan-interface200) from Full to Down
%Jan 8 10:58:36:728 2010 SwitchB RM/3/RMLOG:OSPF-NBRCHANGE: Process 1, Neighbor
10.3.1.2(Vlan-interface300) from Full to Down
*Jan 8 10:58:36:728 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 IETF GR Started for OSPF Router
*Jan 8 10:58:36:728 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 notify RM that OSPF process will enter GR.
*Jan 8 10:58:36:728 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 created GR wait timer, timeout interval is 40(s).
*Jan 8 10:58:36:728 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 created IETF GR suppress hello timer,timeout interval is 5(s).
*Jan 8 10:58:37:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.3.1.1.
*Jan 8 10:58:37:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.2.1.1.
*Jan 8 10:58:37:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.1.1.1.
*Jan 8 10:58:38:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.3.1.1.
*Jan 8 10:58:38:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.2.1.1.
*Jan 8 10:58:38:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.1.1.1.
*Jan 8 10:58:39:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.3.1.1.
*Jan 8 10:58:39:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.2.1.1.
*Jan 8 10:58:39:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.1.1.1.
*Jan 8 10:58:40:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.3.1.1.
*Jan 8 10:58:40:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.2.1.1.
*Jan 8 10:58:40:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.1.1.1.
*Jan 8 10:58:41:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.3.1.1.
*Jan 8 10:58:41:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.2.1.1.
*Jan 8 10:58:41:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 generated grace LSA for interface 10.1.1.1.
*Jan 8 10:58:41:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 IETF Gr Suppress hello timer fired.
*Jan 8 10:58:41:057 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 deleted IETF GR suppress hello timer.
*Jan 8 10:58:41:057 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 created GR Interval timer,timeout interval is 120(s).
%Jan 8 10:58:51:170 2010 SwitchB RM/3/RMLOG:OSPF-NBRCHANGE: Process 1, Neighbor
10.3.1.2(Vlan-interface300) from Loading to Full
%Jan 8 10:58:53:068 2010 SwitchB RM/3/RMLOG:OSPF-NBRCHANGE: Process 1, Neighbor
10.2.1.2(Vlan-interface200) from Loading to Full
%Jan 8 10:58:55:069 2010 SwitchB RM/3/RMLOG:OSPF-NBRCHANGE: Process 1, Neighbor
10.1.1.2(Vlan-interface100) from Loading to Full
*Jan 8 10:59:16:056 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 Gr Wait Timeout timer fired.
*Jan 8 10:59:16:057 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 deleted GR wait timer.
*Jan 8 10:59:16:057 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 flushed grace LSAs.
*Jan 8 10:59:16:057 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 deleted GR Interval timer.
*Jan 8 10:59:16:057 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 GR Completed for OSPF Router
*Jan 8 10:59:21:099 2010 SwitchB RM/6/RMDEBUG:
OSPF 1 notified RM that OSPF process left GR.
*Jan 8 10:59:21:099 2010 SwitchB RM/6/RMDEBUG:
RM notified that all protocol left GR.
在GR过程中,所有交换机的路由表保持不变,网络保持畅通,还可以通过ping命令验证GR过程中的网络连通性。
l 配置Switch A
#
vlan 100
#
interface Vlan-interface100
ip address 10.1.1.2 255.255.255.0
#
ospf 1
opaque-capability enable
area 0.0.0.0
network 10.1.1.0 0.0.0.255
#
l 配置Switch B
#
vlan 100
#
vlan 200
#
vlan 300
#
interface Vlan-interface100
ip address 10.1.1.2 255.255.255.0
#
interface Vlan-interface200
ip address 10.2.1.2 255.255.255.0
#
interface Vlan-interface300
ip address 10.3.1.2 255.255.255.0
#
ospf 1
opaque-capability enable
graceful-restart ietf
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.2.1.0 0.0.0.255
network 10.3.1.0 0.0.0.255
#
l 配置Switch C
vlan 100
#
interface Vlan-interface100
ip address 10.2.1.2 255.255.255.0
#
ospf 1
opaque-capability enable
area 0.0.0.0
network 10.2.1.0 0.0.0.255
#
l 配置Switch D
#
vlan 300
#
interface Vlan-interface300
ip address 10.3.1.2 255.255.255.0
#
ospf 1
opaque-capability enable
area 0.0.0.0
network 10.3.1.0 0.0.0.255
#
以上举例为IETF标准方式实现GR时的完整配置。
以非IETF标准方式实现GR时,要求这些GR设备上必须预先使能以下三种能力,具体配置参见相关操作手册:
l 本地链路信令能力;
l 带外同步能力;
l 非标准GR能力。
l Switch A、Switch B通过二层交换机互连,并且在双方接口上使能BFD应用,之间运行OSPF,网络层相互可达。
l 当Switch B和二层交换机之间的链路出现故障后,BFD能够快速检测并通告OSPF协议。
图1-9 OSPF与BFD联动配置组网图
表1-9 配置适用的产品与软件版本关系
产品 |
软件版本 |
S7500E系列以太网交换机 |
Release 6100系列,Release 6300系列,Release 6600系列,Release 6610系列 |
S7600系列以太网交换机 |
Release 6600系列,Release 6610系列 |
S5800&S5820X系列以太网交换机 |
Release 1110,Release 1211 |
CE3000-32F以太网交换机 |
Release 1211 |
S5500-EI系列以太网交换机 |
Release 2202,Release 2208 |
S5500-EI-D系列以太网交换机 |
Release 2208 |
S3610&S5510系列以太网交换机 |
Release 5301,Release 5303,Release 5306,Release 5309 |
S3500-EA系列以太网交换机 |
Release 5303,Release 5309 |
(1) 配置各接口的IP地址(略)
(2) 配置OSPF基本功能
# 配置Switch A。
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.0.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
[SwitchA] interface vlan 10
[SwitchA-Vlan-interface10] ospf bfd enable
[SwitchA-Vlan-interface10] quit
# 配置Switch B。
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 10.1.0.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] quit
[SwitchB] interface vlan-interface 10
[SwitchB-Vlan-interface10] ospf bfd enable
[SwitchA-Vlan-interface10] quit
(3) 配置BFD参数
# 配置Switch A。
[SwitchA] bfd session init-mode active
[SwitchA] interface vlan-interface 10
[SwitchA-Vlan-interface10] bfd min-transmit-interval 500
[SwitchA-Vlan-interface10] bfd min-receive-interval 500
[SwitchA-Vlan-interface10] bfd detect-multiplier 7
[SwitchA-Vlan-interface10] quit
[SwitchA] quit
# 配置Switch B。
[SwitchB] bfd session init-mode active
[SwitchB] interface vlan-interface 10
[SwitchB-Vlan-interface10] bfd min-transmit-interval 500
[SwitchB-Vlan-interface10] bfd min-receive-interval 500
[SwitchB-Vlan-interface10] bfd detect-multiplier 6
(4) 检查配置结果
# 显示Switch A的BFD信息。
<SwitchA> display bfd session
Total Session Num: 1 Init Mode: Active
Session Working Under Ctrl Mode:
LD/RD SourceAddr DestAddr State Holdtime Interface
3/1 10.1.0.102 10.1.0.100 Up 1700ms vlan10
# 显示Switch A上OSPF的邻居信息。
<SwitchA> display ospf peer
OSPF Process 1 with Router ID 192.168.1.40
Neighbor Brief Information
Area: 0.0.0.1
Router ID Address Pri Dead-Time Interface State
10.1.0.102 10.1.0.100 1 31 vlan10 Full/DR
# 打开Switch A的调试开关。
<SwitchA> debugging bfd scm
<SwitchA> debugging bfd event
<SwitchA> debugging ospf event
<SwitchA> terminal debugging
# Switch B和交换机之间的链路发生故障时,可以看到Switch A能够快速感知Switch B的变化。
%Nov 12 18:34:48:823 2005 SwitchA BFD/5/LOG: Sess[10.1.0.102/10.1.0.100, vlan10], Sta : UP->DOWN, Diag: 1
%Nov 12 18:34:48:824 2005 SwitchA RM/4/RMLOG:OSPF-NBRCHANGE: Process 1, Neighbour 10.1.0.102 (vlan10) from Full to Down
*0.50673825 SwitchA BFD/8/SCM:Sess[10.1.0.102/10.1.0.100, vlan10],Oper: Reset
*0.50673825 SwitchA BFD/8/EVENT:Send sess-down Msg, [Src:10.1.0.102, Dst:10.1.0.100, vlan10] Protocol: OSPF
*0.50673826 SwitchA RM/7/RMDEBUG:OSPF-BFD: Message Type rcv BFD down, Connect Type direct-connect, Src IP Address 10.1.0.102, Src IFIndex 5, Dst IP Address 10.1.0.100
*0.50673827 SwitchA RM/7/RMDEBUG:OSPF-BFD: Message Type delete session, Connect Type direct-connect, Src IP Address 10.1.0.102, Src IFIndex 5, Dst IP Address 10.1.0.100
OSPF 1: Nbr 10.1.0.100 Rcv KillNbr State Full -> Down.
*0.50673829 SwitchA BFD/8/EVENT:Receive Delete-sess, [Src:10.1.0.102, Dst:10.1.0.100, vlan10], Direct, Proto:OSPF
*0.50673830 SwitchA BFD/8/SCM:Sess[10.1.0.102/10.1.0.100, vlan10], Oper: Del application(OSPF)
*0.50673831 SwitchA BFD/8/SCM:No application in session, delete session[10.1.0.102/10.1.0.100, vlan10]
*0.50673831 SwitchA BFD/8/SCM:Sess[10.1.0.102/10.1.0.100, vlan10], Oper: Delete
*0.50673832 SwitchA BFD/8/SCM:Delete send-packet timer
*0.50673833 SwitchA BFD/8/SCM:Delete session entry
*0.50673833 SwitchA BFD/8/SCM:Delete session from IP hash table
*0.50673834 SwitchA BFD/8/SCM:Delete session from bfd interface
*0.50673834 SwitchA BFD/8/SCM:No session under bfd-int[vlan10] with default configuration, delete bfd-if
*0.50673835 SwitchA BFD/8/SCM:Bfd-if[vlan10], Oper: Delete
*0.50673840 SwitchA BFD/8/SCM:No bfd session exists, stop receiving any bfd packets
# 显示Switch A的BFD信息。
查看Switch A的BFD信息,Switch A已取消与Switch B的邻居关系,没有任何输出信息。
<SwitchA> display bfd session
# 显示Switch A上OSPF的邻居信息。
查看Switch A上OSPF的邻居信息,Switch A已取消与Switch B的邻居关系,没有任何输出信息。
<SwitchA> display ospf peer
OSPF Process 1 with Router ID 192.168.1.40
Neighbor Brief Information
l 配置Switch A
#
vlan 10
#
interface Vlan-interface10
ip address 10.1.0.102 255.255.255.0
ospf bfd enable
bfd min-transmit-interval 500
bfd min-receive-interval 500
bfd detect-multiplier 7
#
ospf 1
area 0.0.0.0
network 10.1.0.0 0.0.0.255
#
l 配置Switch B
#
vlan 10
#
interface Vlan-interface10
ip address 10.1.0.101 255.255.255.0
ospf bfd enable
bfd min-transmit-interval 500
bfd min-receive-interval 500
bfd detect-multiplier 6
#
ospf 1
area 0.0.0.0
network 10.1.0.0 0.0.0.255
#
无
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!