Skip to main content

Prefix list




In this scenario I want to filter 192.168.3.x /25 , /26, /27 networks form R1 route update.
I can use access list but I need to set the rules for every network. In prefix list it will easy to filter.

R2(config-router)#do sh ip bgp
BGP table version is 8, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 192.168.1.0      10.10.10.1               0             0 1 i
*> 192.168.2.0      10.10.10.1               0             0 1 i
*> 192.168.3.0/25   10.10.10.1               0             0 1 i
*> 192.168.3.128/26 10.10.10.1               0             0 1 i
*> 192.168.3.192/27 10.10.10.1               0             0 1 i
*> 192.168.4.0/25   10.10.10.1               0             0 1 i
*> 192.168.4.128/26 10.10.10.1               0             0 1 i


When we want to exclude the all of 192.168.3.0 networks, first we need to set the deny rule and permit rule for other networks. If we don't set permit rule all network will be excluded because we need to notice all deny rule is always under the rule.

First we apply the prefix list.

ip prefix-list NEI_1 seq 5 deny 192.168.3.0/24 ge 25 le 27
ip prefix-list NEI_1 seq 10 permit 0.0.0.0/0 le 32

And apply the prefix list to BGP.

router bgp 2
 no synchronization
 bgp router-id 2.2.2.2
 bgp log-neighbor-changes
 neighbor 10.10.10.1 remote-as 1
 neighbor 10.10.10.1 prefix-list NEI_1 in
 no auto-summary

Now we can check BGP network, 192.168.3.0 network is gone.

R2#sh ip bgp

   Network          Next Hop            Metric LocPrf Weight Path
*> 192.168.1.0      10.10.10.1               0             0 1 i
*> 192.168.2.0      10.10.10.1               0             0 1 i
*> 192.168.4.0/25   10.10.10.1               0             0 1 i
*> 192.168.4.128/26 10.10.10.1               0             0 1 i

If we want to set the prefix list 192.168.x.x/16 and filter all /25 network.
we can play the range setup from ge to le. 'ge' for minimum and 'le' for maximum.

ip prefix-list NEI_1 seq 5 deny 192.168.3.0/16 ge 25 le 25

Now all of /25 network have been removed from routing table.

R2#sh ip bgp

   Network          Next Hop            Metric LocPrf Weight Path
*> 192.168.1.0      10.10.10.1               0             0 1 i
*> 192.168.2.0      10.10.10.1               0             0 1 i
*> 192.168.3.128/26 10.10.10.1               0             0 1 i
*> 192.168.3.192/27 10.10.10.1               0             0 1 i
*> 192.168.4.128/26 10.10.10.1               0             0 1 i



R2#sh ip route bgp
     192.168.4.0/26 is subnetted, 1 subnets
B       192.168.4.128 [20/0] via 10.10.10.1, 00:00:57
B    192.168.1.0/24 [20/0] via 10.10.10.1, 00:00:57
B    192.168.2.0/24 [20/0] via 10.10.10.1, 00:00:57
     192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
B       192.168.3.192/27 [20/0] via 10.10.10.1, 00:00:57
B       192.168.3.128/26 [20/0] via 10.10.10.1, 00:00:57


Comments

Popular posts from this blog

Nested Route Reflection Cluster

Figure 1.1 R1 router bgp 65000  bgp cluster-id 10  neighbor 2.2.2.2 remote-as 65000  neighbor 2.2.2.2 update-source Loopback0  neighbor 2.2.2.2 route-reflector-client  neighbor 3.3.3.3 remote-as 65000  neighbor 3.3.3.3 update-source Loopback0  neighbor 3.3.3.3 route-reflector-client R2 router bgp 65000  bgp cluster-id 20  net 22.22.22.0 mask 255.255.255.0  neighbor 1.1.1.1 remote-as 65000  neighbor 1.1.1.1 update-source Loopback0  neighbor 4.4.4.4 remote-as 65000  neighbor 4.4.4.4 update-source Loopback0  neighbor 4.4.4.4 route-reflector-client R3 router bgp 65000  bgp cluster-id 30  net 33.33.33.0 mask 255.255.255.0  neighbor 1.1.1.1 remote-as 65000  neighbor 1.1.1.1 update-source Loopback0  neighbor 5.5.5.5 remote-as 65000  neighbor 5.5.5.5 update-source Loopback0  neighbor 5.5.5.5 route-reflector-client R4 router bgp 65000 ...

VRF lite at Enterprise

In this scenario we have two internet line and separate the user group for internet using. I want to setup  NET_G1 group use internet line 1 and NET_G2 group use internet line 2. At NET_G1 sale and MKT department are included and at NET_G2 HR and IT are included. First step create the vrf. R1/R4/R5 ip vrf NET_G1 ip vrf NET_G2 Second step -set the interfaces belong to vrf. R1 ip vrf NET_G1 ip vrf NET_G2 int f0/0 ip vrf forwarding NET_G1 ip add 10.10.10.2 255.255.255.252 description Internet 1 no sh int f1/0 no sh ip vrf forwading NET_G2 ip add 172.16.12.2 255.255.255.252 description Internet 2 no sh int f2/0 no sh int f2/0.10 encapsulation dot1q 10 ip vrf for NET_G1 ip add 192.168.14.1 255.255.255.252 int f2/0.20 encapsulation dot1q 20 ip vrf for NET_G2 ip add 192.168.14.1 255.255.255.252 int f3/0 no sh int f3/0.10 encapsulation dot1q 10 ip vrf for NET_G1 ip add 192.168.15.1 255.255.255.252 int f3/0.20 encapsulation dot1q 20 ...