Skip to content

策略路由

标签
HCIP-Datacom
字数
277 字
阅读时间
2 分钟

实验拓扑

实验要求

三个路由器运行OSPF协议,使用路由策略工具Filter-Policy在R2上过滤掉192.168.0.0的路由,使用策略路由工具Traffic-Policy在R2上过滤掉192.168.1.0的流量。

配置代码

基础路由

AR1

int g0/0/0
	ip add 10.0.12.1 24
int lo0
	ip add 192.168.0.1 24
int lo1
	ip add 192.168.1.1 24
int lo2
	ip add 192.168.2.1 24
	quit
ospf
	area 0
		network 10.0.12.0 0.0.0.255
		network 192.168.0.0 0.0.0.255
		network 192.168.1.0 0.0.0.255
		network 192.168.2.0 0.0.0.255
		quit
	quit

AR2

int g0/0/0
	ip add 10.0.12.2 24
int g0/0/1
	ip add 10.0.23.2 24
ospf
	area 0
		network 10.0.12.0 0.0.0.255
		network 10.0.23.0 0.0.0.255
		quit
	quit

AR3

int g0/0/0
	ip add 10.0.23.3 24
ospf
	area 0
		network 10.0.23.0 0.0.0.255
		quit
	quit

在R3查看OSPF路由

路由策略工具

在AR2上配置

acl 2000
	rule 5 deny source 192.168.0.0 0.0.0.255
	rule 10 permit source any
	quit
ospf	
	filter-policy 2000 import
	quit

在R2上查看OSPF路由

流量过滤配置

acl 3000
	rule 5 deny ip source 192.168.1.0 0.0.0.255 destination any 
	rule 10 permit ip source any destination any 
	quit
traffic classifier tc1 operator or 
	if-match acl 3000
traffic behavior tb1 
	deny 
traffic policy tp1
	classifier tc1 behavior tb1 
	quit

在R3上pingR1的192.168.1.1

贡献者

The avatar of contributor named as lishu620 lishu620

文件历史

撰写