您的当前位置:首页OSPF路由过滤配置案例

OSPF路由过滤配置案例

来源:小侦探旅游网
OSPF路由过滤配置案例

TAC中心

拓扑图: Fa0/1

Switch A 192.168.0.1 Fa0/1 Switch B 192.168.0.2 交换机配置:

Switch A通过设置loopback1~loopback4模拟直连用户网段。 Switch A:

hostname SwitchA vlan 1 !

vlan 2 !

enable secret level 1 5 !.t{bckn7|7zyglo-/-aeh`@~1'dfimL

enable secret level 15 5 !mLMp]K*7nAxB^\"[lowNq&#Z`@IOrJ%( !

interface FastEthernet 0/1 switchport access vlan 2 !

interface Vlan 1 !

interface Vlan 2

ip address 192.168.0.1 255.255.255.0

!

interface Loopback 0

ip address 1.1.1.1 255.255.255.255 !

interface Loopback 1

ip address 10.0.1.1 255.255.255.0 !

interface Loopback 2

ip address 10.0.2.1 255.255.255.0 !

interface Loopback 3

ip address 10.0.3.1 255.255.255.0

!

interface Loopback 4

ip address 10.0.4.1 255.255.255.0 !

! !

router ospf area 0.0.0.0

network 1.1.1.1 255.255.255.255 area 0.0.0.0 network 192.168.0.0 255.255.255.0 area 0.0.0.0 redistribute connected ! end

Switch B:

hostname SwitchB vlan 1 !

vlan 2 !

logging monitor

interface FastEthernet 0/1 switchport access vlan 2 !

interface Vlan 2

ip address 192.168.0.2 255.255.255.0 !

interface Loopback 0

ip address 2.2.2.2 255.255.255.255 !

router ospf area 0.0.0.0

network 2.2.2.2 255.255.255.255 area 0.0.0.0 network 192.168.0.0 255.255.255.0 area 0.0.0.0 ! end

在Switch B可以通过命令查看学习到的路由信息:

Switch B# show ip route

Type: C - connected, S - static, R - RIP, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2

Type Destination IP Next hop Interface Distance Metric Status ---- ------------------ --------------- --------- -------- -------- --------

O 1.1.1.1/32 192.168.0.1 VL2 110 2 Active C 2.2.2.2/32 0.0.0.0 Lo0 0 0 Active O E2 10.0.1.0/24 192.168.0.1 VL2 110 20 Active O E2 10.0.1.1/32 192.168.0.1 VL2 110 20 Active O E2 10.0.2.0/24 192.168.0.1 VL2 110 20 Active O E2 10.0.2.1/32 192.168.0.1 VL2 110 20 Active O E2 10.0.3.0/24 192.168.0.1 VL2 110 20 Active O E2 10.0.3.1/32 192.168.0.1 VL2 110 20 Active O E2 10.0.4.0/24 192.168.0.1 VL2 110 20 Active O E2 10.0.4.1/32 192.168.0.1 VL2 110 20 Active C 192.168.0.0/24 0.0.0.0 VL2 0 0 Active

路由过滤需求:

要求Switch B不学习10.0.3.0/24和10.0.4.0/24的路由信息。 Switch B增加如下配置:

ip access-list standard acl_1 deny 10.0.3.0 0.0.0.255 deny 10.0.4.0 0.0.0.255 permit any router ospf

distribute-list acl_1 in

路由过滤结果:

Switch B显示路由信息,发现成功的将10.0.3.0/24和10.0.4.0/24的路由信息删除。 Switch B#show ip route

Type: C - connected, S - static, R - RIP, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2

Type Destination IP Next hop Interface Distance Metric Status ---- ------------------ --------------- --------- -------- -------- --------

O 1.1.1.1/32 192.168.0.1 VL2 110 2 Active C 2.2.2.2/32 0.0.0.0 Lo0 0 0 Active O E2 10.0.1.0/24 192.168.0.1 VL2 110 20 Active O E2 10.0.1.1/32 192.168.0.1 VL2 110 20 Active O E2 10.0.2.0/24 192.168.0.1 VL2 110 20 Active O E2 10.0.2.1/32 192.168.0.1 VL2 110 20 Active C 192.168.0.0/24 0.0.0.0 VL2 0 0 Active

因篇幅问题不能全部显示,请点此查看更多更全内容