Tuesday, January 10, 2012

Route filtering with BGP



Route filtering can be done with "ACL","prefix-list" and "offset-list" with a  combination of "route-map",here i am using the BGP as a routing protocol between different autonomous systems.i apply the route filtering at router R2 which it going to effect the R4 routing table.This filtering can be applied any where depends up on our requirement.

let me show you the BGP routing table of R4 without a route filtering configured at R2
i shutdown the interface between the R0 and R4 to make R4 to reach the other networks via R2, so when we see the routing table of R4 with "show ip  bgp" command.

2.2.2.2 is the R2's loopback address and 4.4.4.4 is the R4's loopback address.As we observe R4 can reach all the networks of 10.2.0.0/30,119.227.0.0/30,128.0.0.0/30 via 2.2.2.2 and 10.0.0.0/30 is a local network to R4

Now i will the configure the route filtering on R2.Here my policy is to prevent R4 to learn about 10.2.0.0/30 network.so my configuration on R2 as follows.

First create an access-list in global configuration mode which should match 10.2.0.0/30 network

access-list 1 permit 10.2.0.0 0.0.0.3

Then create an route-map with name "DENY" with "deny" clause and sequence number "10" which deny's the 10.2.0.0/30 network.

route-map DENY deny 10
match ip address 1

now to accept the remaining routes, create a permit clause with same name with different sequence number

route-map DENY permit 15


Apply this route-map in R2's BGP configuration as

 neighbor 4.4.4.4 route-map DENY out

i configured the route-map for neighbor 4.4.4.4 as "out" because the routes are advertising by R2 to R4

now most important command when applying route filtering in BGP  is
clear ip bgp 4.4.4.4 if we don't clear the bgp process for R4 the route filtering configuration wont take effect in BGP

If we observe the routing table of R4














the route for 10.2.0.0/30 is filtered and remaining are allowed.

This can be done with prefix-list also so i am going to post that in other post with explanation of route redistribution when different routing protocols are used in the network.