Wednesday, April 13, 2011

Lab 106 - BGP Filtering using Prefix-List

Prerequisites: CCNP level skills.

Topology

Pic. 1 - Topology Diagram.
Icons designed by: Andrzej Szoblik - http://www.newo.pl

Task 1
On R5 create int loopback555 with the following ip addresses:

interface Loopback555
 ip address 55.5.0.1 255.255.255.0 secondary
 ip address 55.5.1.1 255.255.255.0 secondary
 ip address 55.5.2.1 255.255.255.0 secondary
 ip address 55.5.3.1 255.255.255.0 secondary
 ip address 200.5.5.1 255.255.255.224 secondary
 ip address 200.5.5.33 255.255.255.224 secondary
 ip address 200.55.55.1 255.255.255.248 secondary
 ip address 5.5.0.1 255.255.0.0
!
router bgp 50
 bgp router-id 5.5.5.5
 bgp log-neighbor-changes
 network 5.5.0.0 mask 255.255.0.0
 network 10.55.20.0 mask 255.255.255.240
 network 10.55.20.16 mask 255.255.255.240
 network 10.55.55.0 mask 255.255.255.240
 network 10.55.55.16 mask 255.255.255.240
 network 55.5.0.0 mask 255.255.255.0
 network 55.5.1.0 mask 255.255.255.0
 network 55.5.2.0 mask 255.255.255.0
 network 55.5.3.0 mask 255.255.255.0
 network 172.16.105.0 mask 255.255.255.0
 network 200.5.5.0 mask 255.255.255.224
 network 200.5.5.32 mask 255.255.255.224
 network 200.55.55.0 mask 255.255.255.248
 neighbor 10.1.35.3 remote-as 30


Advertise all those addresses into BGP.

On R4 check what prefixes are originated by AS 50.

Task 2
On R4 filter out the following:
  • Class A prefixes shorter than /24
  • Class C prefixes longer than /27
Use prefix-list to accomplish this.

    Solution

    Task 1
    On R4 check what prefixes are originated by AS 50.

    The command to use: show ip bgp regexp _50$

    Pic. 2 - BGP Table on R4
    (prefixes originated by AS 50)

    Task 2
    On R4 filter out the following:
    • Class A prefixes shorter than /24
    • Class C prefixes longer than /27
    Use prefix-list to accomplish this.

    The following should be filtered out:
    Class A prefixes shorter than /24 = 5.5.0.0/16
    Class C prefixes longer than /27 = 200.55.55.0/29

    R4 Configuration:
    !
    ip prefix-list MATCH_TASK_2 seq 5 deny 0.0.0.0/1 le 23
    ip prefix-list MATCH_TASK_2 seq 10 deny 192.0.0.0/3 ge 28
    ip prefix-list MATCH_TASK_2 seq 15 permit 0.0.0.0/0 le 32
    !
    router bgp 124
     no synchronization
     bgp router-id 172.16.104.4
     bgp log-neighbor-changes
     network 172.16.104.0 mask 255.255.255.0
     network 172.16.144.0 mask 255.255.255.0
     neighbor 10.1.14.1 remote-as 124
     neighbor 10.1.14.1 route-reflector-client
     neighbor 10.1.14.1 prefix-list MATCH_TASK_2 in
     neighbor 10.1.24.2 remote-as 124
     neighbor 10.1.24.2 route-reflector-client
     neighbor 10.1.24.2 prefix-list MATCH_TASK_2 in
     no auto-summary
    !

    Verification:
    Pic. 3 - BGP Table on R4
    (prefixes originated by AS 50)

    The following prefixes have been filtered out:
    Class A prefixes shorter than /24 = 5.5.0.0/16
    Class C prefixes longer than /27 = 200.55.55.0/29