Filtering with Prefix-list
R4
ip prefix-list Filter seq 5 deny 40.1.2.0/24
ip prefix-list Filter seq 10 permit 0.0.0.0/0 le 32
!
router bgp 201
bgp log-neighbor-changes
network 40.1.1.0 mask 255.255.255.0
network 40.1.2.0 mask 255.255.255.0
network 40.1.3.0 mask 255.255.255.0
network 40.1.4.0 mask 255.255.255.0
neighbor 3.3.3.3 prefix-list Filter out
R3
R3#sh ip bgp | in 40|44
*> 40.1.1.0/24 4.4.4.4 0 0 201 i
* i 40.1.2.0/24 28.0.0.8 0 100 0 201 i
*> 40.1.3.0/24 4.4.4.4 0 0 201 i
*> 40.1.4.0/24 4.4.4.4 0 0 201 i
*> 44.4.4.4/32 4.4.4.4 0 0 201 i
Standard Access-Lists
R4
router bgp 201
bgp log-neighbor-changes
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 distribute-list 20 out
access-list 20 deny 40.1.2.0 0.0.0.255
access-list 20 permit any
R3#sh ip bgp | in 40|44
* 40.1.1.0/24 4.4.4.4 0 0 201 i
* i 40.1.2.0/24 28.0.0.8 0 100 0 201 i
* 40.1.3.0/24 4.4.4.4 0 0 201 i
* 40.1.4.0/24 4.4.4.4 0 0 201 i
* 44.4.4.4/32 4.4.4.4 0 0 201 i
R3#
Extended Access-Lists
R4
access-list 101 deny ip host 40.1.2.0 host 255.255.255.0
access-list 101 permit ip any any
router bgp 201
bgp log-neighbor-changes
network 40.1.1.0 mask 255.255.255.0
network 40.1.2.0 mask 255.255.255.0
network 40.1.3.0 mask 255.255.255.0
network 40.1.4.0 mask 255.255.255.0
network 44.4.4.4 mask 255.255.255.255
neighbor 3.3.3.3 remote-as 101
neighbor 3.3.3.3 ebgp-multihop 255
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 distribute-list 101 out
R3#sh ip bgp | in 40|44
* 40.1.1.0/24 4.4.4.4 0 0 201 i
* i 40.1.2.0/24 28.0.0.8 0 100 0 201 i
* 40.1.3.0/24 4.4.4.4 0 0 201 i
* 40.1.4.0/24 4.4.4.4 0 0 201 i
* 44.4.4.4/32 4.4.4.4 0 0 201 i
R3#
Path Filtering with BGP Regular Expressions
Objective- 1:- Filter out prefixes originated from 1.301 in R4
R4
R4 Before Applying Filter list
R4#sh ip bgp regexp _1.301$
BGP table version is 17, local router ID is 44.4.4.4
Network Next Hop Metric LocPrf Weight Path
*> 69.0.0.0/11 3.3.3.3 0 101 1.301 i
R4#
Now As-Path filter list
ip as-path access-list 1 deny _1.301$ Prefix originated from 1.301
ip as-path access-list 1 permit .*
route-map ASPATH permit 10
match as-path 1
R4(config)#router bgp 201
R4(config-router)# nei 3.3.3.3 route-map ASPATH in
Objective- 2:- Filter out prefixes originated from 201 in R3
R3
Before Applying rules,
R3#sh ip bgp
BGP table version is 141, local router ID is 39.1.4.1
Network Next Hop Metric LocPrf Weight Path
* i 8.8.8.8/32 28.0.0.8 0 100 0 201 i
*> 4.4.4.4 0 201 i
*> 33.3.3.3/32 0.0.0.0 0 32768 i
*> 39.1.0.0/19 0.0.0.0 32768 i
*> 39.1.1.0/24 0.0.0.0 0 32768 ?
*> 39.1.2.0/24 0.0.0.0 0 32768 ?
*> 39.1.3.0/24 0.0.0.0 0 32768 ?
*> 39.1.4.0/24 0.0.0.0 0 32768 ?
* i 40.1.1.0/24 28.0.0.8 0 100 0 201 i
*> 4.4.4.4 0 0 201 i
* i 40.1.2.0/24 28.0.0.8 0 100 0 201 i
*> 4.4.4.4 0 0 201 i
* i 40.1.3.0/24 28.0.0.8 0 100 0 201 i
*> 4.4.4.4 0 0 201 i
* i 40.1.4.0/24 28.0.0.8 0 100 0 201 i
Network Next Hop Metric LocPrf Weight Path
*> 4.4.4.4 0 0 201 i
* i 44.4.4.4/32 28.0.0.8 0 100 0 201 i
*> 4.4.4.4 0 0 201 i
*>i 55.5.5.5/32 5.5.5.5 0 100 0 i
*>i 69.0.0.0/11 1.1.1.1 0 100 0 1.301 i
*>i 69.1.1.0/24 1.1.1.1 0 100 0 ?
*>i 111.111.111.111/32
1.1.1.1 0 100 0 i
R3
ip as-path access-list 1 deny ^201_
ip as-path access-list 1 permit .*
route-map ASPATH permit 10
match as-path 1
router bgp 101
neighbor 4.4.4.4 ebgp-multihop 255neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 send-community
neighbor 4.4.4.4 route-map ASPATH inneighbor 4.4.4.4 ebgp-multihop 255
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 send-community
neighbor 4.4.4.4 route-map ASPATH in
*******************************
All prefix from As 201 from nei 4.4.4.4 are not in BGP table
R3#sh ip bgp regexp ^201_
BGP table version is 11, local router ID is 39.1.4.1
Network Next Hop Metric LocPrf Weight Path
* i 8.8.8.8/32 28.0.0.8 0 100 0 201 i
* i 40.1.1.0/24 28.0.0.8 0 100 0 201 i
* i 40.1.2.0/24 28.0.0.8 0 100 0 201 i
* i 40.1.3.0/24 28.0.0.8 0 100 0 201 i
* i 40.1.4.0/24 28.0.0.8 0 100 0 201 i
* i 44.4.4.4/32 28.0.0.8 0 100 0 201 i
R3
router bgp 101
bgp asnotation dotbgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 101
neighbor 2.2.2.2 update-source Loopback0
neighbor 2.2.2.2 route-map ASPATH in
No prefix from AS 201
Filtering With Maximum Prefix
R6
Before applying the Rule R6 have prefix from R1 and R5
R6
R6(config-router)# nei 1.1.1.1 maximum-prefix 9
%BGP-4-MAXPFX: Number of prefixes received from 1.1.1.1 (afi 0) reaches 9, max 9
R6(config-router)#^Z
%BGP-3-MAXPFXEXCEED: Number of prefixes received from 1.1.1.1 (afi 0): 9 exceeds limit 8
R6(config-router)#^Z
R6#
%BGP-5-ADJCHANGE: neighbor 1.1.1.1 Down Peer over prefix limit
Sh ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 11.11.11.11/32 5.5.5.5 0 101 i
*> 33.3.3.3/32 5.5.5.5 0 101 i
*> 39.1.0.0/19 5.5.5.5 0 101 i
*> 39.1.1.0/24 5.5.5.5 0 101 ?
*> 39.1.2.0/24 5.5.5.5 0 101 ?
*> 39.1.3.0/24 5.5.5.5 0 101 ?
*> 39.1.4.0/24 5.5.5.5 0 101 ?
*> 55.5.5.5/32 5.5.5.5 0 0 101 i
By default it will drop the connection
R6(config-router)# nei 1.1.1.1 maximum-prefix 20 50
NO warning message
R6(config-router)# nei 1.1.1.1 maximum-prefix 20 40
R6(config-router)#
%BGP-4-MAXPFX: Number of prefixes received from 1.1.1.1 (afi 0) reaches 9, max 20
at 40% of max , it will show a message,
R6(config-router)# nei 1.1.1.1 maximum-prefix 8 warning-only
R6(config-router)#
%BGP-3-MAXPFXEXCEED: Number of prefixes received from 1.1.1.1 (afi 0): 9 exceeds limit 8
Now it is showing only warning no neighborship down.
Community
No comments:
Post a Comment