Lab BGP Distribute-list

Lab 7 利用分发列表进行路由过滤

R1:
s0/0:12.1.1.1/24
lo0:1.1.1.1/32
lo1:172.16.1.1/24
lo2:172.16.2.1/24
R2:
s0/0:12.1.1.2/24
s0/1:23.1.1.2/24
lo0:2.2.2.2/32
R3:
s0/0:23.1.1.3/24
lo0:3.3.3.3/32

目的:以上拓扑中,在R1上起用两个环回口,一个是172.16.1.1,一个是172.16.2.1,要使R3上不可以收到172.16.1.0的路由。

Step 1、配置各台路由器的IP地址,并且使用Ping命令确认各路由器的直连口的互通性。

Step 2、在R1,R2和R2,R3之间运行EBGP,并宣告环回口。
R1(config-if)#router bgp 1
R1(config-router)#bgp router-id 1.1.1.1
R1(config-router)#no au
R1(config-router)#no sy
R1(config-router)#neighbor 12.1.1.2 remote-as 2
R1(config-router)#network 172.16.1.0 mask 255.255.255.0
R1(config-router)#network 172.16.2.0 mask 255.255.255.0

R2(config)#router bgp 2
R2(config-router)#no au
R2(config-router)#no sy
R2(config-router)#bgp router-id 2.2.2.2
R2(config-router)#network  2.2.2.2 mask 255.255.255.255
R2(config-router)#nei 12.1.1.1 remote-as 1
R2(config-router)#neighbor 23.1.1.3 remote-as 3

R3(config)#router bgp 3
R3(config-router)#no au
R3(config-router)#no sy
R3(config-router)#bgp router-id 3.3.3.3        
R3(config-router)#neighbor 23.1.1.2 remote-as 2
R3(config-router)#network 3.3.3.3 mask 255.255.255.255

Step 3、在R2的BGP进程里用分发列表调用。
A:使用访问控制列表。
R2(config)#access-list 1 deny 172.16.1.0 0.0.0.255
R2(config)#access-list 1 permit any
R2(config)#router bgp 2
R2(config-router)#neighbor 23.1.1.3 distribute-list 1 out 

B:使用前缀列表。
R2(config)#ip prefix-list FILTER deny 172.16.1.0/24      
R2(config)#ip prefix-list FILTER permit 0.0.0.0/0 le 32
R2(config)#router bgp 2
R2(config-router)#distribute-list prefix FILTER out 

Step 4、在R3上验证结果,成功。
R3#sh ip bgp 
BGP table version is 22, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

扫描二维码关注公众号,回复: 10774450 查看本文章

   Network          Next Hop            Metric LocPrf Weight Path
*> 2.2.2.2/32       23.1.1.2                 0             0 2 i
*> 3.3.3.3/32       0.0.0.0                  0         32768 i
*> 172.16.2.0/24    23.1.1.2                               0 2 1 i

结论:分发列表通过调用ACL或prefix-list来对路由进行过滤,可以在一个单独的路由区域内过滤,也可在路由协议之间做重分发的时候进行过滤。


 

发布了220 篇原创文章 · 获赞 2 · 访问量 4463

猜你喜欢

转载自blog.csdn.net/qq_43207781/article/details/105503794
BGP