HCIP-IERS 部署企业级路由交换网络 - HCIP分解实验 - IS_IS路由过滤(9)

目录

IS-IS实验9: IS-IS路由过滤


IS-IS实验9: IS-IS路由过滤

在IS-IS 网络中,有时需要使用 filter-policy 工具对 IS-IS 路由进行过滤。这里所说的过滤,是指路由器在将自己IS-IS 路由表中的某些 IS-IS 路由纳入进自己的 IP 路由表的过程,一些满足了过滤条件的 IS-IS 路由将被限制纳入 IP 路由表中。

需要注意的是, filter-policy 进行过滤的并非是生成那些 IS-IS 路由的 LSP ,所以 filter-policy 进行路由过滤之后,路由器中的 IS-IS 链路状态数据库和 IS-IS 路由表都不会受到任何影响。

所有路由器均为 level-2路由器

基本配置
R1:
undo ter mo
sys
sysname R1
user-interface console 0
idle-timeout 0 0
int loop 0
ip add 1.1.1.1 24
int g0/0/0
ip add 192.168.12.1 24
int g0/0/1
ip add 192.168.14.1 24
q

R2:
undo ter mo
sys
sysname R2
user-interface console 0
idle-timeout 0 0
int loop 0
ip add 2.2.2.2 24
int g0/0/0
ip add 192.168.12.2 24
int g0/0/1
ip add 192.168.23.2 24
q

R3:
undo ter mo
sys
sysname R3
user-interface console 0
idle-timeout 0 0
int loop 1
ip add 172.16.1.1 24
int loop 2
ip add 172.16.2.1 24
int g0/0/1
ip add 192.168.23.3 24
int g0/0/2
ip add 192.168.34.3 24
q

R4:
undo ter mo
sys
sysname R4
user-interface console 0
idle-timeout 0 0
int loop 0
ip add 4.4.4.4 24
int g0/0/1
ip add 192.168.14.4 24
int g0/0/2
ip add 192.168.34.4 24
q

配置IS-IS 协议,所有路由器均为 Level-2路由器
R1:
isis
network-entity 10.0000.0000.0001.00
is-name R1
is-level level-2
int loo 0
isis enable
int g0/0/0
isis enable
int g0/0/1
isis enable
q

R2:
isis
network-entity 10.0000.0000.0002.00
is-name R2
is-level level-2
int loo 0
isis enable
int g0/0/0
isis enable
int g0/0/1
isis enable
q

R3:
isis
network-entity 20.0000.0000.0003.00
is-name R3
is-level level-2
int loo 1
isis enable
int loo 2
isis enable
int g0/0/1
isis enable
int g0/0/2
isis enable
q

R4:
isis
network-entity 10.0000.0000.0004.00
is-name R4
is-level level-2
int loo 0
isis enable
int g0/0/1
isis enable
int g0/0/2
isis enable
q

配置完成后,查看邻居的建立
路由表学习也正常

========
使用 filter-policy实现路由过滤
R1 只能经R2 访问 R3 的loopback 1
R1 只能经R4 访问 R3 的loopback 2

在R2 上过滤掉R3的loopback 2
R2:
acl 2000
rule deny source 172.16.2.0 0.0.0.255
rule permit source any

isis
filter-policy 2000 import


<R2>display ip routing-table

172.16.2.0 已经没有了,只有 1.0
但在IS-IS 路由表中,还是有的
display isis route

过滤掉的路由条目不能进入IP 路由表,但并不会对生成这些路由的LSP进行过滤。

在R4 上过滤掉R3的loopback 1
R4:
acl 2000
rule deny source 172.16.1.0 0.0.0.255
rule permit source any

isis
filter-policy 2000 import

查看一下,R4 的路由表中,已经没有 172.16.1.0 的路由

=========
配合使用filter-policy 和 route-policy

在R1 上查看路由表,还是有两个下一跳的,在R2 R4上的过滤,对R1不起作用,这两条路由的LSP还继续泛洪。
在R1上进行路由过滤时,不能只考虑路由的前缀,同时还要考虑到路由的下一跳。

R1 :
定义ACL 2012匹配路由下一跳 192.168.12.2
定义ACL 2014匹配路由下一跳 192.168.14.4
定义ACL 2001匹配路由前缀 172.16.1.0/24
定义ACL 2002匹配路由前缀 172.16.2.0/24


R1:
acl 2001
rule permit source 172.16.1.0 0.0.0.255
acl 2002
rule permit source 172.16.2.0 0.0.0.255
acl 2012
rule permit source 192.168.12.2 0
acl 2014
rule permit source 192.168.14.4 0


route-policy 10 deny node 1
if-match ip next-hop acl 2012
if-match acl 2002

route-policy 10 deny node 2
if-match ip next-hop acl 2014
if-match acl 2001

route-policy 10 permit node 3

isis
filter-policy route-policy 10 import

=======
也可以 permit 放行
R1:
route-policy 10 permit node 1
if-match ip next-hop acl 2012
if-match acl 2001


route-policy 10 permit node 2
if-match ip next-hop acl 2014
if-match acl 2002

配置完成后,查看 R1 的路由表

现在完成要求。

猜你喜欢

转载自blog.csdn.net/weixin_57099902/article/details/132467358