华为OSPF路由Stub(末梢)区域配置示例

华为OSPF路由Stub(末梢)区域配置示例

1、组网需求

华为OSPF路由Stub(末梢)区域配置示例

图1 OSPF Stub区域组网示例图

如上图1所示,三台交换机之间运行OSPF协议,整个OSPF网络被划分为Area0和Area1两个区域,其中SwitchB作为ASBR与OSPF外部网络实现互通。

现要求在不影响通信的情况下减少SwitchC上OSPF路由表的规模,即配置Area1为Stub区域来实现。

2、配置思路

2.1、在各交换机上配置OSPF基本功能,实现OSPF网络的基本互通。

2.2、在SwitchB上配置静态路由,并引入到OSPF路由表中,实现OSPF网络到外部网络路由可达。

2.3、配置Area1为Stub区域,初步减少SwitchC上OSPF路由表的规模。

2.4、在Area1的ABR(SwitchA)上配置禁止向Stub区域通告Type3 LSA,即将Area1配置为Totally Stub区域,达到最大限度减少SwitchC上OSPF路由表规模的目的。

3、操作步骤

3.1、配置各接口所属的VLAN

# 配置SwitchA。SwitchB和SwitchC的配置与SwitchA类似。

<huawei> system-view/<huawei>

[HUAWEI] sysname SwitchA

[SwitchA] vlan batch 10 20

[SwitchA] interface gigabitethernet 1/0/1

[SwitchA-GigabitEthernet1/0/1] port link-type trunk

[SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 10

[SwitchA-GigabitEthernet1/0/1] quit

[SwitchA] interface gigabitethernet 1/0/2

[SwitchA-GigabitEthernet1/0/2] port link-type trunk

[SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 20

[SwitchA-GigabitEthernet1/0/2] quit

3.2、配置各VLANIF接口的IP地址

# 配置SwitchA。SwitchB和SwitchC的配置与SwitchA类似。

[SwitchA] interface vlanif 10

[SwitchA-Vlanif10] ip address 192.168.0.1 24

[SwitchA-Vlanif10] quit

[SwitchA] interface vlanif 20

[SwitchA-Vlanif20] ip address 192.168.1.1 24

[SwitchA-Vlanif20] quit

3.3、配置OSPF基本功能

# 配置SwitchA。

[SwitchA] ospf 1 router-id 10.1.1.1

[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

# 配置SwitchB。

[SwitchB] ospf 1 router-id 10.2.2.2

[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] quit

# 配置SwitchC。

[SwitchC] ospf 1 router-id 10.3.3.3

[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] quit

[SwitchC-ospf-1] quit

3.4、配置SwitchB引入静态路由

[SwitchB] ip route-static 10.0.0.0 8 null 0

[SwitchB] ospf 1

[SwitchB-ospf-1] import-route static type 1

[SwitchB-ospf-1] quit

# 查看SwitchC的OSPF路由表信息,可以看到OSPF路由表中存在AS外部的路由。

[SwitchC] display ospf routing

OSPF Process 1 with Router ID 10.3.3.3

Routing Tables

Routing for Network

Destination Cost Type NextHop AdvRouter Area

192.168.1.0/24 1 Transit 192.168.1.2 10.3.3.3 0.0.0.1

192.168.0.0/24 2 Inter-area 192.168.1.1 10.1.1.1 0.0.0.1

Routing for ASEs

Destination Cost Type Tag NextHop AdvRouter

10.0.0.0/8 3 Type1 1 192.168.1.1 10.2.2.2

Total Nets: 3

Intra Area: 1 Inter Area: 1 ASE: 1 NSSA: 0

3.5、配置Area1为Stub区域

# 配置SwitchA。

[SwitchA] ospf 1

[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

# 配置SwitchC。

[SwitchC] ospf 1

[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

# 查看SwitchC的OSPF路由表信息,发现此时AS外部的路由已经消失,但是多了一条通往区域外部的缺省路由。

[SwitchC] display ospf routing

OSPF Process 1 with Router ID 10.3.3.3

Routing Tables

Routing for Network

Destination Cost Type NextHop AdvRouter Area

192.168.1.0/24 1 Transit 192.168.1.2 10.3.3.3 0.0.0.1

0.0.0.0/0 2 Inter-area 192.168.1.1 10.1.1.1 0.0.0.1

192.168.0.0/24 2 Inter-area 192.168.1.1 10.1.1.1 0.0.0.1

Total Nets: 3

Intra Area: 1 Inter Area: 2 ASE: 0 NSSA: 0

3.6、配置Area1为Totally Stub区域

[SwitchA] ospf 1

[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

[SwitchA-ospf-1] quit

4、验证配置结果

# 查看SwitchC的OSPF路由表,发现目的地址为192.168.0.0/24的路由也消失了,仅保留了区域内的OSPF路由以及一条通往区域外部缺省路由。

[SwitchC] display ospf routing

OSPF Process 1 with Router ID 10.3.3.3

Routing Tables

Routing for Network

Destination Cost Type NextHop AdvRouter Area

192.168.1.0/24 1 Transit 192.168.1.2 10.3.3.3 0.0.0.1

0.0.0.0/0 2 Inter-area 192.168.1.1 10.1.1.1 0.0.0.1

Total Nets: 2

Intra Area: 1 Inter Area: 1 ASE: 0 NSSA: 0

5、配置文件

5.1、SwitchA的配置文件

#

sysname SwitchA

#

vlan batch 10 20

#

interface Vlanif10

ip address 192.168.0.1 255.255.255.0

#

interface Vlanif20

ip address 192.168.1.1 255.255.255.0

#

interface GigabitEthernet1/0/1

port link-type trunk

port trunk allow-pass vlan 10

#

interface GigabitEthernet1/0/2

port link-type trunk

port trunk allow-pass vlan 20

#

ospf 1 router-id 10.1.1.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

#

return

5.2、SwitchB的配置文件

#

sysname SwitchB

#

vlan batch 10

#

interface Vlanif10

ip address 192.168.0.2 255.255.255.0

#

interface GigabitEthernet1/0/1

port link-type trunk

port trunk allow-pass vlan 10

#

ospf 1 router-id 10.2.2.2

import-route static type 1

area 0.0.0.0

network 192.168.0.0 0.0.0.255

#

ip route-static 10.0.0.0 255.0.0.0 NULL0

#

return

5.3、SwitchC的配置文件

#

sysname SwitchC

#

vlan batch 20

#

interface Vlanif20

ip address 192.168.1.2 255.255.255.0

#

interface GigabitEthernet1/0/1

port link-type trunk

port trunk allow-pass vlan 20

#

ospf 1 router-id 10.3.3.3

area 0.0.0.1

network 192.168.1.0 0.0.0.255

stub

#

return


分享到:


相關文章: