A-A+
利用OSPF协议过滤外部路由的实验报告
【实验拓扑】
【实验要求】
1、按照上图配置好网络
2、在R5上增加1条静态路由150.1.50.0/24 指向null 0,并重发布到OSPF中
3、在R6上增加1条静态路由150.1.60.0/24 指向null 0,并重发布到OSPF中
4、在R1与R4上设置过滤,过滤掉来自R6的外部路由
【实验思考】
我们知道OSPF从外部学习的路由都会标记为E2,我们可以通过route-map来过滤外部标记,但是如何只过滤来自于R6的呢?
同样用Route-map 中的过滤路由来源。
【配置方法】
- R1 & R4
- access-list 1 permit 150.1.6.6
- !
- route-map FILTER_OSPF deny 10
- match route-type external type-2
- match ip route-source 1
- route-map FILTER_OSPF permit 1000
- !
- router ospf 1
- distribute-list route-map FILTER_OSPF in
- R5:
- ip route 160.1.50.0 255.255.255.0 null 0
- router ospf 1
- redistribute static subnets
- R6:
- ip route 160.1.60.0 255.255.255.0 null 0
- router ospf 1
- redistribute static subnets
【过滤后验证方法】
过滤之前
----------------------------------------------------------------------------------------------->>
- R1#show ip route ospf
- 160.1.0.0/24 is subnetted, 2 subnets
- O E2 160.1.50.0 [110/20] via 155.1.0.5, 00:01:00, Serial0/0
- O E2 160.1.60.0 [110/20] via 155.1.146.6, 00:01:00, FastEthernet0/0
- 150.1.0.0/16 is variably subnetted, 4 subnets, 2 masks
- O 150.1.6.6/32 [110/11] via 155.1.146.6, 00:01:00, FastEthernet0/0
- O 150.1.5.5/32 [110/65] via 155.1.0.5, 00:01:00, Serial0/0
- O 150.1.4.4/32 [110/11] via 155.1.146.4, 00:01:00, FastEthernet0
过滤之后,仅剩余1条外部学习到的路由
----------------------------------------------------------------------------------------------->>
- R1#show ip route ospf
- 160.1.0.0/24 is subnetted, 1 subnets
- O E2 160.1.50.0 [110/20] via 155.1.0.5, 00:00:03, Serial0/0
- 150.1.0.0/16 is variably subnetted, 4 subnets, 2 masks
- O 150.1.6.6/32 [110/11] via 155.1.146.6, 00:00:03, FastEthernet0/0
- O 150.1.5.5/32 [110/65] via 155.1.0.5, 00:00:03, Serial0/0
- O 150.1.4.4/32 [110/11] via 155.1.146.4, 00:00:03, FastEther
【实验前的基本配置】
----------------------------------------------------------------------------------------------
- R1:
- interface Fa 0/0
- ip address 155.1.146.1 255.255.255.0
- no shut
- !
- interface Serial 0/0
- encapsulation frame-relay
- no frame-relay inverse-arp
- ip address 155.1.0.1 255.255.255.0
- http://www.xiaoxiongboke.com
- frame-relay map ip 155.1.0.5 105
- frame-relay map ip 155.1.0.4 105
- ip ospf priority 0
- no shutdown
- !
- interface Loopback0
- ip address 150.1.1.1 255.255.255.0
- !
- router ospf 1
- router-id 150.1.1.1
- network 155.1.146.1 0.0.0.0 area 1
- network 150.1.1.1 0.0.0.0 area 1
- network 155.1.0.1 0.0.0.0 area 0
- R4:
- interface Eth 0/1
- ip address 155.1.146.4 255.255.255.0
- !
- interface Serial 0/0
- encapsulation frame-relay
- no frame-relay inverse-arp
- ip address 155.1.0.4 255.255.255.0
- frame-relay map ip 155.1.0.5 405
- frame-relay map ip 155.1.0.1 405
- ip ospf priority 0
- !
- interface Loopback0
- ip address 150.1.4.4 255.255.255.0
- !
- router ospf 1
- router-id 150.1.4.4
- network 155.1.146.4 0.0.0.0 area 1
- network 150.1.4.4 0.0.0.0 area 1
- network 155.1.0.4 0.0.0.0 area 0
- R5:
- interface Serial 0/0
- encapsulation frame-relay
- no frame-relay inverse-arp
- ip address 155.1.0.5 255.255.255.0
- frame-relay map ip 155.1.0.4 504
- frame-relay map ip 155.1.0.1 501
- !
- interface Loopback0
- ip address 150.1.5.5 255.255.255.0
- !
- router ospf 1
- router-id 150.1.5.5
- network 150.1.5.5 0.0.0.0 area 0
- network 155.1.0.5 0.0.0.0 area 0
- neighbor 155.1.0.4
- neighbor 155.1.0.1
- R6:
- interface Gig 0/1
- ip address 155.1.146.6 255.255.255.0
- !
- interface Loopback0
- ip address 150.1.6.6 255.255.255.0
- !
- router ospf 1
- router-id 150.1.6.6
- network 155.1.146.6 0.0.0.0 area 1
- network 150.1.6.6 0.0.0.0 area 1