ospf的虚连接配置
作者:邓聪聪
配置OSPF虚连接
组网需求
在图1中,Area2没有与骨干区域直接相连。Area1被用作传输区域(Transit Area)来连接Area2和Area0。SwitchA、SwitchB之间配置一条虚连接。
Switch |
接口 |
对应的VLANIF |
IP地址 |
SwitchA |
GigabitEthernet1/0/1 |
VLANIF 10 |
192.168.1.1/24 |
SwitchA |
GigabitEthernet1/0/2 |
VLANIF 20 |
10.1.1.1/8 |
SwitchB |
GigabitEthernet1/0/1 |
VLANIF 10 |
192.168.1.2/24 |
SwitchB |
GigabitEthernet1/0/2 |
VLANIF 30 |
172.16.1.1/16 |
SwitchC |
GigabitEthernet1/0/1 |
VLANIF 20 |
10.1.1.2/8 |
SwitchD |
GigabitEthernet1/0/1 |
VLANIF 30 |
172.16.1.2/16 |
配置思路
采用如下的思路配置OSPF虚连接:
在各Switch上使能OSPF,配置OSPF基本功能。
在SwitchA、SwitchB上配置虚连接,使非骨干区域与骨干区域连通。
数据准备
为完成此配置例,需准备如下的数据:
- 各接口所属的VLAN ID,具体数据如图1所示。
- 各VLANIF接口的IP地址,具体数据如图1所示。
各Switch设备的Router ID,OSPF进程号以及各接口所属的区域。
- SwitchA的Router ID 1.1.1.1,运行的OSPF进程号1,区域1的网段192.168.1.0/24,区域0的网段10.0.0.0/8。
- SwitchB的Router ID 2.2.2.2,运行的OSPF进程号1,区域1的网段192.168.1.0/24,区域2的网段172.16.0.0/16。
- SwitchC的Router ID 3.3.3.3,运行的OSPF进程号1,区域0的网段10.0.0.0/8。
- SwitchD的Router ID 4.4.4.4,运行的OSPF进程号1,区域2的网段172.16.0.0/16。
操作步骤
- 配置各接口所属VLAN
<Quidway> system-view
[Quidway] sysname SwitchA
[SwitchA] vlan batch 10 20
[SwitchA] interface gigabitethernet 1/0/1
[SwitchA-GigabitEthernet1/0/1]port hybrid pvid vlan 10
[SwitchA-GigabitEthernet1/0/1]port hybrid untagged vlan 10
[SwitchA-GigabitEthernet1/0/1] quit
[SwitchA] interface gigabitethernet 1/0/2
[SwitchA-GigabitEthernet1/0/2] port hybrid pvid vlan 20
[SwitchA-GigabitEthernet1/0/2] port hybrid untagged vlan 20
[SwitchA-GigabitEthernet1/0/2] quitSwitchB、SwitchC、SwitchD的配置同SwitchA(略)
- 配置各VLANIF接口的IP地址
[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] ip address 192.168.1.1 24
[SwitchA-Vlanif10] quit
[SwitchA] interface vlanif 20
[SwitchA-Vlanif20] ip address 10.1.1.1 8
[SwitchA-Vlanif20] quitSwitchB、SwitchC、SwitchD的配置同SwitchA(略)
- 配置OSPF基本功能
# 配置SwitchA。
[SwitchA] ospf 1 router-id 1.1.1.1
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 10.0.0.0 0.255.255.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# 配置SwitchB。
[SwitchB] ospf 1 router-id 2.2.2.2
[SwitchB-ospf-1] area 1
[SwitchB-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.1] quit
[SwitchB-ospf-1] area 2
[SwitchB–ospf-1-area-0.0.0.2] network 172.16.0.0 0.0.255.255
[SwitchB–ospf-1-area-0.0.0.2] quit
[SwitchB–ospf-1] quit# 配置SwitchC。
[SwitchC] ospf 1 router-id 3.3.3.3
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 10.0.0.0 0.255.255.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit# 配置SwitchD。
[SwitchD] ospf 1 router-id 4.4.4.4
[SwitchD-ospf-1] area 2
[SwitchD-ospf-1-area-0.0.0.2] network 172.16.0.0 0.0.255.255
[SwitchD-ospf-1-area-0.0.0.2] quit
[SwitchD-ospf-1] quit# 查看SwitchA的OSPF路由表。
[SwitchA] display ospf routing OSPF Process 1 with Router ID 1.1.1.1
Routing Tables Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.0.0.0/8 1 Transit 10.1.1.1 3.3.3.3 0.0.0.0
192.168.1.0/24 1 Transit 192.168.1.1 2.2.2.2 0.0.0.1
Total Nets: 2
Intra Area: 2 Inter Area: 0 ASE: 0 NSSA: 0由于Area2没有与Area0直接相连,所以SwitchA路由表中没有Area2中的路由。
- 配置虚连接
# 配置SwitchA。
[SwitchA] ospf
[SwitchA-ospf-1] area 1
[SwitchA-ospf-1-area-0.0.0.1] vlink-peer 2.2.2.2
[SwitchA-ospf-1-area-0.0.0.1] quit
[SwitchA-ospf-1] quit# 配置SwitchB。
[SwitchB] ospf 1
[SwitchB-ospf-1] area 1
[SwitchB-ospf-1-area-0.0.0.1] vlink-peer 1.1.1.1
[SwitchB-ospf-1-area-0.0.0.1] quit
[SwitchB-ospf-1] quit - 验证配置结果
# 查看SwitchA的OSPF路由表。
[SwitchA] display ospf routing OSPF Process 1 with Router ID 1.1.1.1
Routing Tables Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.0.0/16 2 Inter-area 192.168.1.2 2.2.2.2 0.0.0.0
10.0.0.0/8 1 Transit 10.1.1.1 1.1.1.1 0.0.0.0
192.168.1.0/24 1 Transit 192.168.1.1 2.2.2.2 0.0.0.1 Total Nets: 3
Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0
配置文件
SwitchA的配置文件
#
sysname SwitchA
#
vlan batch 10 20
#
interface Vlanif10
ip address 192.168.1.1 255.255.255.0
#
interface Vlanif20
ip address 10.1.1.1 255.0.0.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 10
port hybrid untagged vlan 10
#
interface GigabitEthernet1/0/2
port hybrid pvid vlan 20
port hybrid untagged vlan 20
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.0.0.0 0.255.255.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
vlink-peer 2.2.2.2
#
returnSwitchB的配置文件
#
sysname SwitchB
#
vlan batch 10 30
#
interface Vlanif10
ip address 192.168.1.2 255.255.255.0
#
interface Vlanif30
ip address 172.16.1.1 255.255.0.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 10
port hybrid untagged vlan 10
#
interface GigabitEthernet1/0/2
port hybrid pvid vlan 30
port hybrid untagged vlan 30
#
ospf 1 router-id 2.2.2.2
area 0.0.0.1
network 192.168.1.0 0.0.0.255
vlink-peer 1.1.1.1
area 0.0.0.2
network 172.16.0.0 0.0.255.255
#
returnSwitchC的配置文件
#
sysname SwitchC
#
vlan 20
#
interface Vlanif20
ip address 10.1.1.2 255.0.0.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 20
port hybrid untagged vlan 20
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 10.0.0.0 0.255.255.255
#
returnSwitchD的配置文件
#
sysname SwitchD
#
vlan 30
#
interface Vlanif30
ip address 172.16.1.2 255.255.0.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 30
port hybrid untagged vlan 30
#
ospf 1 router-id 4.4.4.4
area 0.0.0.2
network 172.16.0.0 0.0.255.255
#
return
最新文章
- RTMP流媒体播放过程
- Thinkphp3.2.3 执行query命令 包括在模板中使用<;php>; <;/php>;时 query的使用方法
- KIWI Syslog配置
- yii 自定义组件的调用
- Java集合---HashMap源码剖析
- 深入C++中构造函数、拷贝构造函数、赋值操作符、析构函数的调用过程总结
- Android Glide加载图片时转换为圆形、圆角、毛玻璃等图片效果
- Linux FTP服务器搭建与使用
- GitHub使用教程及常见错误解决
- 通过ajax提交form表单
- Excel VBA批量修改文件夹下的文件名
- (转)C++静态库与动态库
- Swift—属性观察者-备
- 【部分枚举】【3-21个人赛】ProblemH
- CentOS 6下配置本地用户访问vsftpd并赋予写权限
- 浅谈JS中的浅拷贝与深拷贝
- June 30th. 2018, Week 26th. Saturday
- 【Android Studio安装部署系列】四十一、Android Studio安装Alibaba Java Coding Guidelines插件(检查代码规范)
- JDBC编程六部曲
- ffmpeg 推流相关指令