<返回更多

华三交换机OSPF多域配置方法

2020-03-08    
加入收藏

1 配置需求或说明

1.1适用产品系列

本案例适用于如S7506E 、S5130S-28S-SI、S5500V2-24P-WiNet等支持OSPF协议的V7交换机。

1.2配置需求

SWA、SWB、SWC、SWD都运行OSPF,并将整个自治系统划分为3个区域。其中Switch A和Switch B作为ABR来转发区域之间的路由。配置完成后,每台交换机都应学到AS内的到所有网段的路由。

2 组网图

华三交换机OSPF多域配置方法(命令行)

 

3 配置步骤

3.1 SWA配置

#创建vlan100和vlan200,并把G1/0/1口加入vlan100、1/0/2口加入vlan200 ,并且配置vlan100和vlan200 的虚接口地址

<SWA>system-view

System View: return to User View with Ctrl+Z.

[SWA]vlan 100

[SWA-vlan100]port GigabitEthernet 1/0/1

[SWA-vlan100]quit

[SWA]vlan 200

[SWA-vlan200]port GigabitEthernet 1/0/2

[SWA-vlan200]quit

[SWA]interface vlan 100

[SWA-Vlan-interface100]ip address 192.168.0.1 255.255.255.0

[SWA-Vlan-interface100]quit

[SWA]interface vlan 200

[SWA-Vlan-interface200]ip address 192.168.1.1 255.255.255.0

[SWA-Vlan-interface200]quit

#启动ospf协议,并设置路由器的router id

[SWA]ospf 1 router-id 192.168.1.1

#配置区域0并且发布网段

[SWA-ospf-1]area 0

[SWA-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.0.255

[SWA-ospf-1-area-0.0.0.0]quit

#配置区域1并且发布网段

[SWA-ospf-1]area 1

[SWA-ospf-1-area-0.0.0.1]network 192.168.1.0 0.0.0.255

[SWA-ospf-1-area-0.0.0.1]quit

[SWA-ospf-1]quit

#保存配置

[SWA]save force

3.2 SWB配置

#创建vlan100和vlan200,并把G1/0/1口加入vlan100、1/0/2口加入vlan200 ,并且配置vlan100和vlan200 的虚接口地址

<SWB>system-view

System View: return to User View with Ctrl+Z.

[SWB]vlan 100

[SWB-vlan100]port GigabitEthernet 1/0/1

[SWB-vlan100]quit

[SWB]vlan 200

[SWB-vlan200]port GigabitEthernet 1/0/2

[SWB-vlan200]quit

[SWB]interface vlan 100

[SWB-Vlan-interface100]ip address 192.168.0.2 255.255.255.0

[SWB-Vlan-interface100]quit

[SWB]interface vlan 200

[SWB-Vlan-interface200]ip address 192.168.2.1 255.255.255.0

[SWB-Vlan-interface200]quit

#启动ospf协议,并设置路由器的router id

[SWB]ospf 1 router-id 192.168.2.1

#配置区域0并且发布网段

[SWB-ospf-1]area 0

[SWB-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.0.255

[SWB-ospf-1-area-0.0.0.0]quit

#配置区域2并且发布网段

[SWB-ospf-1]area 2

[SWB-ospf-1-area-0.0.0.2]network 192.168.2.0 0.0.0.255

[SWB-ospf-1-area-0.0.0.2]quit

[SWB-ospf-1]quit

#保存配置

[SWB]save force

3.3 SWC配置

#创建vlan200和vlan300,并把G1/0/1口加入vlan300、1/0/2口加入vlan200 ,并且配置vlan300和vlan200 的虚接口地址

<SWC>system-view

System View: return to User View with Ctrl+Z.

[SWC]vlan 300

[SWC-vlan300]port GigabitEthernet 1/0/1

[SWC-vlan300]quit

[SWC]vlan 200

[SWC-vlan200]port GigabitEthernet 1/0/2

[SWC-vlan200]quit

[SWC]interface vlan 300

[SWC-Vlan-interface300]ip address 172.16.1.1 255.255.255.0

[SWC-Vlan-interface300]quit

[SWC]interface vlan 200

[SWC-Vlan-interface200]ip address 192.168.1.2 255.255.255.0

[SWC-Vlan-interface200]quit

#启动ospf协议,并设置路由器的router id

[SWC]ospf 1 router-id 192.168.1.2

#配置区域1并且发布网段

[SWC-ospf-1]area 1

[SWC-ospf-1-area-0.0.0.1]network 192.168.1.0 0.0.0.255

[SWC-ospf-1-area-0.0.0.1]network 172.16.1.0 0.0.0.255

[SWC-ospf-1-area-0.0.0.1]quit

[SWC-ospf-1]quit

#保存配置

[SWC]save force

3.4 SWD配置

#创建vlan200和vlan300,并把G1/0/1口加入vlan300、1/0/2口加入vlan200 ,并且配置vlan300和vlan200 的虚接口地址

<SWD>system-view

System View: return to User View with Ctrl+Z.

[SWD]vlan 300

[SWD-vlan300]port GigabitEthernet 1/0/1

[SWD-vlan300]quit

[SWD]vlan 200

[SWD-vlan200]port GigabitEthernet 1/0/2

[SWD-vlan200]quit

[SWD]interface vlan 300

[SWD-Vlan-interface300]ip address 172.17.1.1 255.255.255.0

[SWD-Vlan-interface300]quit

[SWD]interface vlan 200

[SWD-Vlan-interface200]ip address 192.168.2.2 255.255.255.0

[SWD-Vlan-interface200]quit

#启动ospf协议,并设置路由器的router id

[SWD]ospf 1 router-id 192.168.2.2

#配置区域1并且发布网段

[SWD-ospf-1]area 2

[SWD-ospf-1-area-0.0.0.2]network 192.168.2.0 0.0.0.255

[SWD-ospf-1-area-0.0.0.2]network 172.17.1.0 0.0.0.255

[SWD-ospf-1-area-0.0.0.2]quit

[SWD-ospf-1]quit

#保存配置

[SWD]save force

 

3.5 验证配置

# 查看Switch A的OSPF邻居,Full是正常状态

[SWA]display ospf peer

OSPF Process 1 with Router ID 192.168.1.1

Neighbor Brief Information

Area: 0.0.0.0

Router ID Address Pri Dead-Time State Interface

192.168.2.1 192.168.0.2 1 32 Full/BDR Vlan100

Area: 0.0.0.1

Router ID Address Pri Dead-Time State Interface

192.168.1.2 192.168.1.2 1 36 Full/BDR Vlan200

#查看Switch A的OSPF路由信息

[SWA]display ospf routing

OSPF Process 1 with Router ID 192.168.1.1

Routing Table

Topology base (MTID 0)

Routing for network

Destination Cost Type NextHop AdvRouter Area

172.16.1.0/24 2 Stub 192.168.1.2 192.168.1.2 0.0.0.1

172.17.1.0/24 3 Inter 192.168.0.2 192.168.2.1 0.0.0.0

192.168.0.0/24 1 Transit 0.0.0.0 192.168.1.1 0.0.0.0

192.168.1.0/24 1 Transit 0.0.0.0 192.168.1.1 0.0.0.1

192.168.2.0/24 2 Inter 192.168.0.2 192.168.2.1 0.0.0.0

Total nets: 5

Intra area: 3 Inter area: 2 ASE: 0 NSSA: 0

#查看Switch A的路由表信息,有到172.16.1.0、172.17.1.0、192.168.2.0的路由

[SWA]display ip routing-table

Destinations : 19 Routes : 19

Destination/Mask Proto Pre Cost NextHop Interface

0.0.0.0/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.0/32 Direct 0 0 127.0.0.1 InLoop0

127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0

127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

172.16.1.0/24 O_INTRA 10 2 192.168.1.2 Vlan200

172.17.1.0/24 O_INTER 10 3 192.168.0.2 Vlan100

192.168.0.0/24 Direct 0 0 192.168.0.1 Vlan100

192.168.0.0/32 Direct 0 0 192.168.0.1 Vlan100

192.168.0.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.0.255/32 Direct 0 0 192.168.0.1 Vlan100

192.168.1.0/24 Direct 0 0 192.168.1.1 Vlan200

192.168.1.0/32 Direct 0 0 192.168.1.1 Vlan200

192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0

192.168.1.255/32 Direct 0 0 192.168.1.1 Vlan200

192.168.2.0/24 O_INTER 10 2 192.168.0.2 Vlan100

224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0

224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0

255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

# PC1 ping PC2 正常通信

C:Usersmfw2656>ping 172.17.1.2

Ping 172.17.1.2 (172.17.1.2): 56 data bytes, press CTRL_C to break

56 bytes from 172.17.1.2: icmp_seq=0 ttl=254 time=8.000 ms

56 bytes from 172.17.1.2: icmp_seq=1 ttl=254 time=2.000 ms

56 bytes from 172.17.1.2: icmp_seq=2 ttl=254 time=3.000 ms

56 bytes from 172.17.1.2: icmp_seq=3 ttl=254 time=3.000 ms

172.17.1.2的 Ping 统计信息:

数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),

返行程的估计时间(以毫秒为单位):

最短 = 2ms,最长 = 3ms,平均 = 2ms

声明:本站部分内容来自互联网,如有版权侵犯或其他问题请与我们联系,我们将立即删除或处理。
▍相关推荐
更多资讯 >>>