目 录
1 OSPF路由典型配置举例 ···················································································································· 1-1?
1.1 简介 ··················································································································································· 1-1?1.2 OSPF基本功能典型配置举例 ············································································································ 1-1?
1.2.1 适用产品和版本 ······················································································································ 1-1?1.2.2 组网需求 ································································································································· 1-1?1.2.3 配置注意事项 ·························································································································· 1-1?1.2.4 配置步骤 ································································································································· 1-1?1.2.5 验证配置 ································································································································· 1-2?1.2.6 配置文件 ································································································································· 1-4?1.3 OSPF的Stub区域典型配置举例 ········································································································ 1-5?
1.3.1 适用产品和版本 ······················································································································ 1-5?1.3.2 组网需求 ································································································································· 1-6?1.3.3 配置注意事项 ·························································································································· 1-6?1.3.4 配置步骤 ································································································································· 1-6?1.3.5 验证配置 ································································································································· 1-7?1.3.6 配置文件 ································································································································· 1-8?1.4 OSPF的NSSA区域典型配置举例 ···································································································· 1-10?
1.4.1 适用产品和版本 ···················································································································· 1-10?1.4.2 组网需求 ······························································································································· 1-10?1.4.3 配置注意事项 ························································································································ 1-10?1.4.4 配置步骤 ······························································································································· 1-10?1.4.5 验证配置 ······························································································································· 1-11?1.4.6 配置文件 ······························································································································· 1-12?1.5 OSPF应用于分支机构网络的典型配置举例 ···················································································· 1-14?
1.5.1 适用产品和版本 ···················································································································· 1-14?1.5.2 组网需求 ······························································································································· 1-14?1.5.3 配置思路 ······························································································································· 1-14?1.5.4 配置步骤 ······························································································································· 1-15?1.5.5 配置文件 ······························································································································· 1-16?1.6 OSPF在AS间发布聚合路由的典型配置举例 ··················································································· 1-18?
1.6.1 适用产品和版本 ···················································································································· 1-18?1.6.2 组网需求 ······························································································································· 1-18?1.6.3 配置注意事项 ························································································································ 1-18?1.6.4 配置步骤 ······························································································································· 1-19?1.6.5 验证配置 ······························································································································· 1-20?1.6.6 配置文件 ······························································································································· 1-21?1.7 OSPF的DR选择典型配置举例 ········································································································· 1-23?
i
1.7.1 适用产品和版本 ···················································································································· 1-23?1.7.2 组网需求 ······························································································································· 1-23?1.7.3 配置注意事项 ························································································································ 1-23?1.7.4 配置步骤 ······························································································································· 1-23?1.7.5 验证配置 ······························································································································· 1-26?1.7.6 配置文件 ······························································································································· 1-28?1.8 OSPF虚连接典型配置举例 ·············································································································· 1-29?
1.8.1 适用产品和版本 ···················································································································· 1-29?1.8.2 组网需求 ······························································································································· 1-29?1.8.3 配置注意事项 ························································································································ 1-29?1.8.4 配置步骤 ······························································································································· 1-29?1.8.5 验证配置 ······························································································································· 1-31?1.8.6 配置文件 ······························································································································· 1-31?1.9 OSPF GR典型配置举例 ·················································································································· 1-32?
1.9.1 适用产品和版本 ···················································································································· 1-32?1.9.2 组网需求 ······························································································································· 1-33?1.9.3 配置步骤 ······························································································································· 1-33?1.9.4 验证配置 ······························································································································· 1-34?1.9.5 配置文件 ······························································································································· 1-34?1.10 配置OSPF与BFD联动典型配置举例 ····························································································· 1-35?
1.10.1 适用产品和版本 ·················································································································· 1-35?1.10.2 组网需求 ····························································································································· 1-36?1.10.3 配置注意事项 ······················································································································ 1-36?1.10.4 配置步骤 ····························································································································· 1-36?1.10.5 验证配置 ····························································································································· 1-37?1.10.6 配置文件 ····························································································································· 1-38?
ii
1 OSPF路由典型配置举例
1.1 简介
本章介绍了OSPF路由协议的各种典型配置。
1.2 OSPF基本功能典型配置举例
1.2.1 适用产品和版本
表1 配置适用的产品与软件版本关系
产品
软件版本
S10500系列以太网交换机 Release 1120系列,Release 1130系列,Release 1200系列 S5800&S5820X系列以太网交换机 Release 1808 S5830系列以太网交换机 Release 1115,Release 1118 S5500-EI系列以太网交换机 Release 2220
1.2.2 组网需求
如图1所示网络,通过配置OSPF基本功能实现网络内所有设备的路由互通,每台设备都能学习到网络中所有网段的路由。配置时将网络划分为3个OSPF区域,Area 1、Area 2均与骨干区域Area 0保持连接。
图1 OSPF基本配置组网图
Switch AVlan-int100192.168.0.1/24Area 0Vlan-int100192.168.0.2/24Switch BVlan-int200192.168.1.1/24Vlan-int200192.168.2.1/24Vlan-int200192.168.2.2/24Area 1Vlan-int200192.168.1.2/24Vlan-int300172.16.1.1/24Area 2Switch CVlan-int300172.17.1.1/24Switch D
1.2.3 配置注意事项
Router ID用来在一个自治系统中唯一的标识一台路由器,Router ID需要保证在同一个自治系统中不重复。
1.2.4 配置步骤
(1) 配置各接口的IP地址(略) (2) 配置OSPF基本功能 # 配置Switch A。
1-1
[SwitchA] router id 192.168.1.1 [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] router id 192.168.2.1 [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] router id 192.168.1.2 [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] router id 192.168.2.2 [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
1.2.5 验证配置
# 查看Switch A的OSPF邻居,可以看到Switch A和Switch B、Switch C都形成了OSPF邻居。
[SwitchA] display ospf peer verbose
OSPF Process 1 with Router ID 192.168.1.1 Neighbors
Area 0.0.0.0 interface 192.168.0.1(Vlan-interface 100)'s neighbors Router ID: 192.168.2.1 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
1-2
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.1.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 192.168.0.2 192.168.2.1 0.0.0.0 192.168.1.0/24 1562 Transit 192.168.1.1 192.168.0.1 0.0.0.1 192.168.2.0/24 3124 Inter 192.168.0.2 192.168.2.1 0.0.0.0 192.168.0.0/24 1562 Transit 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 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 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 192.168.2.1 192.168.2.1 0.0.0.2 192.168.2.0/24 1562 Transit 192.168.2.2 192.168.2.2 0.0.0.2 192.168.0.0/24 3124 Inter 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
# 在Switch D上使用Ping进行测试连通性,可以成功ping通Switch C。
[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
1-3