07

您所在的位置:网站首页 新华三核心部门 07

07

2024-07-17 19:46:27| 来源: 网络整理| 查看: 265

1  简介

本文档介绍了OSPF路由信息过滤的配置举例。

2  配置前提

本文档不严格与具体软、硬件版本对应,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。

本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。

本文档假设您已了解OSPF路由信息过滤的特性。

3  OSPF路由信息过滤配置举例 3.1  组网需求

如图1所示,公司A使用OSPF路由协议实现公司设备全网互通,后来公司A扩张兼并了公司B,要求将公司B采用的RIP路由协议与公司A的OSPF协议互相引入,使得各个部门可以实现互通。Device A和Device B作为公司核心设备负责各个部门间的通信。由于业务需要,现要求通过下列措施控制并调整网络中的路由信息:

·              在Device E上对引入的路由信息进行过滤,使得研发二部所在网段无法被引入到OSPF内。

·              在Device C上使用路由信息的过滤功能,使得市场一部所在网段无法访问研发一部。

·              在Device D上使用路由信息的过滤功能,使得研发一部和售后服务部所在网段无法访问市场二部。

图1 OSPF路由信息过滤组网图

设备

接口

IP地址

设备

接口

IP地址

Device A

Vlan-int100

10.1.1.1/24

Device B

Vlan-int100

10.1.1.2/24

 

Vlan-int200

10.2.1.1/24

 

Vlan-int300

10.3.1.1/24

 

Vlan-int400

10.4.1.1/24

 

 

 

Device C

Vlan-int200

10.2.1.2/24

Device D

Vlan-int300

10.3.1.2/24

 

Loop0

192.168.3.1/24

(市场一部所在网段)

 

Loop0

192.168.1.1/24

(售后服务部所在网段)

 

 

 

 

Loop1

192.168.2.1/24

(研发一部所在网段)

Device E

Vlan-int400

10.4.1.2/24

Device F

Vlan-int500

10.5.1.2/24

 

Vlan-int500

10.5.1.1/24

 

Loop0

192.168.4.1/24

(研发二部所在网段)

 

 

 

 

Loop1

192.168.5.1/24

(市场二部所在网段)

 

3.2  配置注意事项

·              路由信息过滤功能中对于引入外部路由信息时采用export关键字进行过滤,该参数只能在ASBR上生效。

·              路由信息过滤功能只是对路由表中相关路由信息过滤,并不是过滤掉OSPF中通告的LSA。

·              由于路由通信是双向的,使用路由信息过滤功能将某一目的网段过滤后,该路由器下联的其它网段无法访问这个目的网段的设备,这个目的网段的设备也不能访问源地址网段的设备。

·              使用路由信息过滤功能配合ACL使用时,必须将最后一条规则设置为允许所有源地址通过才能避免将所有网段路由全部过滤掉。

3.3  配置步骤 3.3.1  配置各接口的IP地址

#配置接口Vlan-int100的IP地址。

system-view

[DeviceA] interface vlan-interface 100

[DeviceA-Vlan-interface100] ip address 10.1.1.1 24

#请参考以上方法配置其它相关接口的IP地址,配置步骤这里省略。

3.3.2  配置OSPF网络的基本功能

# 在Device A上使能指定网段的OSPF路由功能。

system-view

[DeviceA] ospf

[DeviceA-ospf-1] area 0

[DeviceA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

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

[DeviceA-ospf-1] area 2

[DeviceA-ospf-1-area-0.0.0.2] network 10.2.1.0 0.0.0.255

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

[DeviceA-ospf-1] area 1

[DeviceA-ospf-1-area-0.0.0.1] network 10.4.1.0 0.0.0.255

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

[DeviceA-ospf-1] quit

# 在Device B上使能指定网段的OSPF路由功能。

system-view

[DeviceB] ospf

[DeviceB-ospf-1] area 0

[DeviceB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

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

[DeviceB-ospf-1] area 3

[DeviceB-ospf-1-area-0.0.0.3] network 10.3.1.0 0.0.0.255

[DeviceB-ospf-1-area-0.0.0.3] quit

[DeviceB-ospf-1] quit

# 在Device C上使能指定网段的OSPF路由功能。

system-view

[DeviceC] ospf

[DeviceC-ospf-1] area 2

[DeviceC-ospf-1-area-0.0.0.2] network 10.2.1.0 0.0.0.255

[DeviceC-ospf-1-area-0.0.0.2] network 192.168.3.0 0.0.0.255

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

[DeviceC-ospf-1] quit

# 在Device D上使能指定网段的OSPF路由功能。

system-view

[DeviceD] ospf

[DeviceD-ospf-1] area 3

[DeviceD-ospf-1-area-0.0.0.3] network 10.3.1.0 0.0.0.255

[DeviceD-ospf-1-area-0.0.0.3] network 192.168.1.0 0.0.0.255

[DeviceD-ospf-1-area-0.0.0.3] network 192.168.2.0 0.0.0.255

[DeviceD-ospf-1-area-0.0.0.3] quit

[DeviceD-ospf-1] quit

# 在Device E上使能指定网段的OSPF路由功能。

system-view

[DeviceE] ospf

[DeviceE-ospf-1] area 1

[DeviceE-ospf-1-area-0.0.0.1] network 10.4.1.0 0.0.0.255

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

[DeviceE-ospf-1] quit

3.3.3  配置RIP网络的基本功能

# 在Device E上使能指定网段的RIP功能。

system-view

[DeviceE] rip

[DeviceE-rip-1] version 2

[DeviceE-rip-1] undo summary

[DeviceE-rip-1] network 10.5.1.0 0.0.0.255

[DeviceE-rip-1] quit

# 在Device F上使能指定网段的RIP功能。

system-view

[DeviceF] rip

[DeviceF-rip-1] version 2

[DeviceF-rip-1] undo summary

[DeviceF-rip-1] network 10.5.1.0 0.0.0.255

[DeviceF-rip-1] network 192.168.4.0 0.0.0.255

[DeviceF-rip-1] network 192.168.5.0 0.0.0.255

[DeviceF-rip-1] quit

3.3.4  将RIP路由和OSPF路由互相引入

# 在Device E上将直连路由和OSPF路由引入到RIP网络中。

system-view

[DeviceE] rip

[DeviceE-rip-1] import-route direct

[DeviceE-rip-1] import-route ospf

[DeviceE-rip-1] quit

# 在Device E上将直连路由和RIP路由引入到OSPF网络中。

[DeviceE] ospf

[DeviceE-ospf-1] import-route direct

[DeviceE-ospf-1] import-route rip

[DeviceE-ospf-1] quit

# 查看Device E的路由表信息。

[Device E] display ip routing-table

 

Destinations : 24        Routes : 24

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

0.0.0.0/32          Direct 0    0            127.0.0.1       InLoop0

10.1.1.0/24         OSPF   10   2            10.4.1.1        Vlan400

10.2.1.0/24         OSPF   10   2            10.4.1.1        Vlan400

10.3.1.0/24         OSPF   10   3            10.4.1.1        Vlan400

10.4.1.0/24         Direct 0    0            10.4.1.2        Vlan400

10.4.1.0/32         Direct 0    0            10.4.1.2        Vlan400

10.4.1.2/32         Direct 0    0            127.0.0.1       InLoop0

10.4.1.255/32       Direct 0    0            10.4.1.2        Vlan400

10.5.1.0/24         Direct 0    0            10.5.1.1        Vlan500

10.5.1.0/32         Direct 0    0            10.5.1.1        Vlan500

10.5.1.1/32         Direct 0    0            127.0.0.1       InLoop0

10.5.1.255/32       Direct 0    0            10.5.1.1        Vlan500

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

192.168.1.1/32      OSPF   10   3            10.4.1.1        Vlan400

192.168.2.1/32      OSPF   10   3            10.4.1.1        Vlan400

192.168.3.1/32      OSPF   10   2            10.4.1.1        Vlan400

192.168.4.0/24      RIP    100  1            10.5.1.2        Vlan500

192.168.5.0/24      RIP    100  1            10.5.1.2        Vlan500

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

以上显示信息表明Device E拥有路由域内所有网段路由,然后依次查看其他所有设备的路由表信息,路由域内所有的网段均可互通。

3.3.5  配置OSPF的路由过滤功能

# 在Device C上创建基本ACL并匹配需要拒绝访问的目的网段192.168.2.0/24。

system-view

[DeviceC] acl basic 2000

[DeviceC-acl-ipv4-basic-2000] rule 0 deny source 192.168.2.0 0.0.0.255

[DeviceC-acl-ipv4-basic-2000] rule permit source any

[DeviceC-acl-ipv4-basic-2000] quit

# 在Device C上通过指定访问控制列表ACL 2000来对要加入到路由表的路由信息进行过滤。

[DeviceC] ospf

[DeviceC-ospf-1] filter-policy 2000 import

[DeviceC-ospf-1] quit

# 在Device D上创建基本ACL并匹配需要拒绝访问的目的网段192.168.5.0/24。

system-view

[DeviceD] acl basic 2000

[DeviceD-acl-ipv4-basic-2000] rule 0 deny source 192.168.5.0 0.0.0.255

[DeviceD-acl-ipv4-basic-2000] rule permit source any

[DeviceD-acl-ipv4-basic-2000] quit

# 在Device D上通过指定访问控制列表ACL 2000来对要加入到路由表的路由信息进行过滤。

[DeviceD] ospf

[DeviceD-ospf-1] filter-policy 2000 import

[DeviceD-ospf-1] quit

# 在Device E上创建基本ACL并匹配需要拒绝访问的目的网段192.168.4.0/24。

system-view

[DeviceE] acl basic 2000

[DeviceE-acl-ipv4-basic-2000] rule 0 deny source 192.168.4.0 0.0.0.255

[DeviceE-acl-ipv4-basic-2000] rule permit source any

[DeviceE-acl-ipv4-basic-2000] quit

# 在Device E上通过指定访问控制列表ACL 2000来对引入OSPF的RIP路由信息进行过滤。

[DeviceE] ospf

[DeviceE-ospf-1] filter-policy 2000 export rip 1

[DeviceE-ospf-1] quit

3.4  验证配置

# 查看Device C的路由表信息。

[DeviceC] display ip routing-table

 

Destinations : 22        Routes : 22

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

0.0.0.0/32          Direct 0    0            127.0.0.1       InLoop0

10.1.1.0/24         OSPF   10   2            10.2.1.1        Vlan200

10.2.1.0/24         Direct 0    0            10.2.1.2        Vlan200

10.2.1.0/32         Direct 0    0            10.2.1.2        Vlan200

10.2.1.2/32         Direct 0    0            127.0.0.1       InLoop0

10.2.1.255/32       Direct 0    0            10.2.1.2        Vlan200

10.3.1.0/24         OSPF   10   3            10.2.1.1        Vlan200

10.4.1.0/24         OSPF   10   2            10.2.1.1        Vlan200

10.5.1.0/24         OSPF   150  1            10.2.1.1        Vlan200

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

192.168.1.1/32      OSPF   10   3            10.2.1.1        Vlan200

192.168.3.0/24      Direct 0    0            192.168.3.1     Loop0

192.168.3.0/32      Direct 0    0            192.168.3.1     Loop0

192.168.3.1/32      Direct 0    0            127.0.0.1       InLoop0

192.168.3.255/32    Direct 0    0            192.168.3.1     Loop0

192.168.5.0/24      OSPF   150  1            10.2.1.1        Vlan200

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

以上显示信息表明Device C的路由表中已经没有192.168.2.0/24网段的路由信息了。

# 在Device C上使用源地址192.168.3.1Ping目标地址192.168.2.1进行验证。

[DeviceC] ping -a 192.168.3.1 192.168.2.1

Ping 192.168.2.1 (192.168.2.1) from 192.168.3.1: 56 data bytes, press CTRL_C to

break

Request time out

Request time out

Request time out

Request time out

Request time out

 

--- Ping statistics for 192.168.2.1 ---

5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss

以上信息表明Device C通过过滤路由表中192.168.2.0/24网段的路由信息,使得市场一部所在网段无法访问研发一部所在网段。

# 查看Device D的路由表信息。

[DeviceD] display ip routing-table

 

Destinations : 25        Routes : 25

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

0.0.0.0/32          Direct 0    0            127.0.0.1       InLoop0

10.1.1.0/24         OSPF   10   2            10.3.1.1        Vlan300

10.2.1.0/24         OSPF   10   3            10.3.1.1        Vlan300

10.3.1.0/24         Direct 0    0            10.3.1.2        Vlan300

10.3.1.0/32         Direct 0    0            10.3.1.2        Vlan300

10.3.1.2/32         Direct 0    0            127.0.0.1       InLoop0

10.3.1.255/32       Direct 0    0            10.3.1.2        Vlan300

10.4.1.0/24         OSPF   10   3            10.3.1.1        Vlan300

10.5.1.0/24         OSPF   150  1            10.3.1.1        Vlan300

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

192.168.1.0/24      Direct 0    0            192.168.1.1     Loop0

192.168.1.0/32      Direct 0    0            192.168.1.1     Loop0

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     Loop0

192.168.2.0/24      Direct 0    0            192.168.2.1     Loop1

192.168.2.0/32      Direct 0    0            192.168.2.1     Loop1

192.168.2.1/32      Direct 0    0            127.0.0.1       InLoop0

192.168.2.255/32    Direct 0    0            192.168.2.1     Loop1

192.168.3.1/32      OSPF   10   3            10.3.1.1        Vlan300

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

以上显示信息表明Device D的路由表中已经没有192.168.5.0/24网段的路由信息了。

# 在Device D上使用源地址192.168.1.1Ping目标地址192.168.5.1进行验证。

[DeviceD] ping -a 192.168.1.1 192.168.5.1

Ping 192.168.5.1 (192.168.5.1) from 192.168.1.1: 56 data bytes, press CTRL_C to

break

Request time out

Request time out

Request time out

Request time out

Request time out

 

--- Ping statistics for 192.168.5.1 ---

5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss

# 在Device D上使用源地址192.168.2.1Ping目标地址192.168.5.1进行验证。

[DeviceD] ping -a 192.168.2.1 192.168.5.1

Ping 192.168.5.1 (192.168.5.1) from 192.168.2.1: 56 data bytes, press CTRL_C to

break

Request time out

Request time out

Request time out

Request time out

Request time out

 

--- Ping statistics for 192.168.5.1 ---

5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss

以上信息表明Device D通过过滤路由表中192.168.5.0/24网段的路由信息,使得研发一部和售后服务部所在网段无法访问市场二部所在网段。

综合Device C和Device D的路由表信息,发现路由表中均没有192.168.4.0/24网段路由信息,说明设备已经将引入OSPF的RIP路由中研发二部所在网段过滤掉。

3.5  配置文件

·              Device A:

#

ospf 1

 area 0.0.0.0

  network 10.1.1.0 0.0.0.255

 area 0.0.0.1

network 10.4.1.0 0.0.0.255

area 0.0.0.2

  network 10.2.1.0 0.0.0.255

#

vlan 100

#

vlan 200

#

vlan 400

#

interface Vlan-interface100

 ip address 10.1.1.1 255.255.255.0

#

interface Vlan-interface200

 ip address 10.2.1.1 255.255.255.0

#

interface Vlan-interface400

 ip address 10.4.1.1 255.255.255.0

#

·              Device B:

#

ospf 1

 area 0.0.0.0

  network 10.1.1.0 0.0.0.255

 area 0.0.0.3

  network 10.3.1.0 0.0.0.255

#

vlan 100

#

vlan 300

#

interface Vlan-interface100

 ip address 10.1.1.2 255.255.255.0

#

interface Vlan-interface300

 ip address 10.3.1.1 255.255.255.0

#

·              Device C:

#

ospf 1

 filter-policy 2000 import

 area 0.0.0.2

  network 10.2.1.0 0.0.0.255

  network 192.168.3.0 0.0.0.255

#

vlan 200

#

interface LoopBack0

 ip address 192.168.3.1 255.255.255.0

#

interface Vlan-interface200

 ip address 10.2.1.2 255.255.255.0

#

acl basic 2000

 rule 0 deny source 192.168.2.0 0.0.0.255

rule 5 permit

#

·              Device D:

#

ospf 1

 filter-policy 2000 import

 area 0.0.0.3

  network 10.3.1.0 0.0.0.255

  network 192.168.1.0 0.0.0.255

  network 192.168.2.0 0.0.0.255

#

vlan 300

#

interface LoopBack0

 ip address 192.168.1.1 255.255.255.0

#

interface LoopBack1

 ip address 192.168.2.1 255.255.255.0

#

interface Vlan-interface300

 ip address 10.3.1.2 255.255.255.0

#

acl basic 2000

 rule 0 deny source 192.168.5.0 0.0.0.255

rule 5 permit

#

·              Device E:

#

ospf 1

 import-route direct

 import-route rip 1

 filter-policy 2000 export rip 1

 area 0.0.0.1

  network 10.4.1.0 0.0.0.255

#

rip 1

 undo summary

 version 2

 network 10.5.1.0 0.0.0.255

 import-route direct

 import-route ospf 1

#

vlan 400

#

vlan 500

#

interface Vlan-interface400

 ip address 10.4.1.2 255.255.255.0

#

interface Vlan-interface500

 ip address 10.5.1.1 255.255.255.0

#

acl basic 2000

 rule 0 deny source 192.168.4.0 0.0.0.255

rule 5 permit

#

·              Device F:

#

rip 1

 undo summary

 version 2

 network 10.5.1.0 0.0.0.255

 network 192.168.4.0

 network 192.168.5.0

#

vlan 500

#

interface LoopBack0

 ip address 192.168.4.1 255.255.255.0

#

interface LoopBack1

 ip address 192.168.5.1 255.255.255.0

#

interface Vlan-interface500

 ip address 10.5.1.2 255.255.255.0

#

4  相关资料

·              H3C S12500-S系列交换机 三层技术-IP路由配置指导-R757X

·              H3C S12500-S系列交换机 三层技术-IP路由命令参考-R757X



【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


    图片新闻

    实验室药品柜的特性有哪些
    实验室药品柜是实验室家具的重要组成部分之一,主要
    小学科学实验中有哪些教学
    计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
    实验室各种仪器原理动图讲
    1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
    高中化学常见仪器及实验装
    1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
    微生物操作主要设备和器具
    今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
    浅谈通风柜使用基本常识
     众所周知,通风柜功能中最主要的就是排气功能。在

    专题文章

      CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭