Sunday, 14 April 2013

AS-PATH ACCESS-LIST



Default config include bgp nei relationship and prefix advertisement
R1.....................
int s0/1
ip add 20.20.20.1 255.255.255.0
no shut
int  s0/0
ip add 10.10.10.1 255.255.255.0
no shut
int lo 1
ip add 150.150.150.1 255.255.255.0
no shut
int lo 1
ip add 150.150.150.1 255.255.255.0
no shut
exit
router eigrp 1
network 20.20.20.0 0.0.0.255
network 10.10.10.0 0.0.0.255
no auto-summary
exit
router bgp 100
nei 10.10.10.2 remote-as 222
nei 20.20.20.2 remote-as 100
nei 20.20.20.2 next-hop-self
nei 30.30.30.1 remote-as 100
nei 30.30.30.1 next-hop-self
bgp router-id 150.150.150.1
no synchronization
network 150.150.151.0 mask 255.255.255.0

R2..................
int s0/0
ip add 30.30.30.2 255.255.255.0
no shut
int  s0/1
ip add 20.20.20.2 255.255.255.0
no shut
int s0/2
ip add 50.50.50.2 255.255.255.0
no shut
int lo 1
ip add 77.77.77.1 255.255.255.0
no shut
exit
router eigrp 1
network 20.20.20.0 0.0.0.255
network 30.30.30.0 0.0.0.255
network 50.50.50.0 0.0.0.255
no auto-summary
exit
router bgp 100
nei 30.30.30.1 remote-as 100
nei 30.30.30.1 next-hop-self
nei 20.20.20.1 remote-as 100
nei 20.20.20.1 next-hop-self
nei 50.50.50.1 remote-as 111
bgp router-id 77.77.77.1
no synchronization



R3..........................
int s0/0
ip add 40.40.40.1 255.255.255.0
no shut
int s0/1
ip add 30.30.30.1 255.255.255.0
no shut
int lo 1
ip add 99.99.99.1 255.255.255.0
no shut
exit
router eigrp 1
network 30.30.30.0 0.0.0.255
network 40.40.40.0 0.0.0.255
no auto-summary
router bgp 100
nei 40.40.40.2 remote-as 222
nei 30.30.30.2 remote-as 100
nei 30.30.30.2 next-hop-self
nei 20.20.20.1 remote-as 100
nei 20.20.20.1 next-hop-self
bgp router-id 99.99.99.1
no synchronization



ISP1..................................
int s0/0
ip add 50.50.50.1 255.255.255.0
no shut
int lo 1
ip add 200.200.200.1 255.255.255.0
no shut
exit
router bgp 111
nei 50.50.50.2 remote-as 100
bgp router-id 200.200.200.1
no synchronization



ISP2..................
int s0/1
ip add 40.40.40.2 255.255.255.0
no shut
int  s0/0
ip add 10.10.10.2 255.255.255.0
no shut
int lo 1
ip add 100.100.100.1 255.255.255.0
no shut
int lo 2
ip add 100.100.101.1 255.255.255.0
no shut
int lo 3
ip add 100.100.102.1 255.255.255.0
no shut
int lo 4
ip add 100.100.103.1 255.255.255.0
no shut
exit
router bgp 222
nei 10.10.10.1 remote-as 100
nei 40.40.40.1 remote-as 100
bgp router-id 100.100.100.1
no synchronization
network 100.100.100.0 mask 255.255.255.0
network 100.100.101.0 mask 255.255.255.0
network 100.100.102.0 mask 255.255.255.0
network 100.100.103.0 mask 255.255.255.0


Task 1) ISP2 seems to be advertising prefixes that it does not originate making AS 222 a transit autonomous system. Configure ISP2 so that it only advertises its own prefixes.
Based on our topology, this cfg would not tell much because ISP is not connected to any other router asides from R1 and R3. But I would point out this config bcos it is important in production network
ISP2(conf)# ip as-path access-list 1 permit ^*
                     ip as-path access-list 1 deny .*                [not necessary since we have an implicit deny already]
                     router bgp 222
                    nei 10.10.10.1 filter-list 1 out
                    nei 40.40.40.1 filter-list 1 out
                    do clear ip bgp * in
                    do clear ip bgp * out

Toview changes made ,

                ISP2# sh ip bgp nei 10.10.10.1 advertised-route
               
(Recall I said earlier that this does not make a difference to what we av before)
   Network          Next Hop            Metric LocPrf Weight       Path
*> 100.100.100.0/24 0.0.0.0                                         0              32768 i
*> 100.100.101.0/24 0.0.0.0                                          0             32768 i
*> 100.100.102.0/24 0.0.0.0                                         0              32768 i
*> 100.100.103.0/24 0.0.0.0                                          0              32768 i



Task 2) On ISP1 filter out all prefixes originated by AS 222
Currently, on ISP1 bgp table
ISP1# sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 100.100.100.0/24 50.50.50.2                             0 100 222 i
*> 100.100.101.0/24 50.50.50.2                             0 100 222 i
*> 100.100.102.0/24 50.50.50.2                             0 100 222 i
*> 100.100.103.0/24 50.50.50.2                             0 100 222 i
*> 150.150.151.0/24 50.50.50.2                             0 100 i

ISP1(conf)# ip as-path access-list 1 deny _200$
                      ip as-path access-list 1 permit .*
                     router bgp 111
                      nei 50.50.50.2 filter-list 1 in
                      do clear ip bgp 50.50.50.2 in
                      do clear ip bgp 50.50.50.2 out

Now lets see the changes made
                ISP1# sh ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 150.150.151.0/24 50.50.50.2                             0 100 i

                ISP1# sh ip bgp filter-list 1            [to view bgp table with repect to the as-path filter-list]
   Network          Next Hop            Metric LocPrf Weight Path
*> 150.150.151.0/24 50.50.50.2                             0 100 i

ISP1# sh ip bgp nei 50.50.50.2 received-route
   Network          Next Hop            Metric LocPrf Weight Path
*  100.100.100.0/24 50.50.50.2                             0     100 222 i
*  100.100.101.0/24 50.50.50.2                             0     100 222 i
*  100.100.102.0/24 50.50.50.2                             0     100 222 i
*  100.100.103.0/24 50.50.50.2                             0     100 222 i
*> 150.150.151.0/24 50.50.50.2                             0   100 i

ISP1# sh ip bgp nei 50.50.50.2 route
   Network          Next Hop            Metric LocPrf Weight Path
*> 150.150.151.0/24 50.50.50.2                             0   100 i





Task 3) cfg AS 100 such that return path from AS 222 prefer R1
Currently on ISP2, bgp table is
   Network                           Next Hop            Metric                   LocPrf                   Weight                                 Path
*  99.99.99.0/24                 10.10.10.1                                                                           0                              100 i
*>                                           40.40.40.1               0                                                          0                              100 i
*> 100.100.100.0/24        0.0.0.0                  0                                                              32768                    i
*> 100.100.101.0/24        0.0.0.0                  0                                                              32768                    i
*> 100.100.102.0/24        0.0.0.0                  0                                                              32768                    i
*> 100.100.103.0/24        0.0.0.0                  0                                                               32768                   i
*  150.150.151.0/24         40.40.40.1                                                            0                              100 i
*>                                           10.10.10.1               0                                                          0                              100 i
*  200.200.200.0                40.40.40.1                                                                            0                              100 111 i
*>                                           10.10.10.1                                                                            0                              100 111 i

R3(conf)#            route-map n permit 10
                                set as-path prepend 100 100
                                exit
                                router bgp 100
                                neighbor 40.40.40.2 remote-as 222
                                neighbor 40.40.40.2 route-map n out
                                do clear ip bgp in 40.40.40.2
                                do clear ip bgp out 40.40.40.2
To view changes made,
ISP2#sh ip bgp
   Network                           Next Hop            Metric                   LocPrf                   Weight                                 Path
*  150.150.151.0/24         40.40.40.1                                                                            0                              100 100 100 i
*>                                           10.10.10.1               0                                                          0                              100 i
*  200.200.200.0                40.40.40.1                                                                            0              100 100 100 111 i
*>                                           10.10.10.1                                                                            0                              100 111 i
*> 99.99.99.0/24               10.10.10.1                                                                            0                              100 i
*                                             40.40.40.1               0                                                           0                             100 100 100 i

We can observer that AS 222 now prefers 10.10.10.1(R1) to reach AS 100










No comments:

Post a Comment