BGP - Longer AS-path

In this post I will talk about BGP and the advertisement of routes. You can see the diagram used for this network below.

HSRP

Router PE_AS2 and CE1_AS3 peer
Router PE_AS2 and REMOTE_CE peer
Router REMOTE_CE and CE2_AS3 peer
Router CE2_AS3 and CE1_AS3 peer

On router PE_AS2 I will configure two loopback ip-addresses and advertise them in BGP.
You can see the configuration of the routers below :

What I want to show is the way the loopback addresses of router PE_AS2 get advertised throughout the network. Especially how router CE1_AS3 receives the routes from router PE_AS2 and from router CE2_AS3 when the connection between router PE_AS2 to CE1_AS3 breaks down.

PE_AS2 :


hostname PE_AS2
!
interface Loopback1
 ip address 1.1.1.1 255.255.255.255
!
interface Loopback2
 ip address 2.2.2.2 255.255.255.255

!
interface FastEthernet0/0
 description connection to CE1 Fa0/0
 ip address 10.0.0.2 255.255.255.0
 duplex auto
 speed auto
 no shut
!
interface FastEthernet1/0
 description connection to RemoteCE Fa0/0
 ip address 30.0.0.1 255.255.255.0
 duplex auto
 speed auto
no shut
!
router bgp 2
 no synchronization
 bgp log-neighbor-changes
 network 1.1.1.1 mask 255.255.255.255
 network 2.2.2.2 mask 255.255.255.255
 timers bgp 10 30
 neighbor 10.0.0.1 remote-as 3
 neighbor 30.0.0.2 remote-as 1
 no auto-summary
    

RemoteCE :


hostname RemoteCE
!
interface FastEthernet0/0
 description connection to PE Fa1/0
 ip address 30.0.0.2 255.255.255.0
 duplex auto
 speed auto
no shut
!
interface FastEthernet1/0
 description connection to CE2 Fa0/0
 ip address 20.0.0.1 255.255.255.0
 duplex auto
 speed auto
no shut
!
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 timers bgp 10 30
 neighbor 20.0.0.2 remote-as 3
 neighbor 30.0.0.1 remote-as 2
 no auto-summary
    

CE2_AS3 :


hostname CE2_AS3
!
interface FastEthernet0/0
 description connection to RemoteCE Fa0/1
 ip address 20.0.0.2 255.255.255.0
 duplex auto
 speed auto
no shut
!
interface FastEthernet1/0
 description connection to CE1 Fa0/1
 ip address 192.168.0.2 255.255.255.0
 duplex auto
 speed auto
no shut
!
router bgp 3
 no synchronization
 bgp log-neighbor-changes
 timers bgp 10 30
 neighbor 20.0.0.1 remote-as 1
 neighbor 192.168.0.1 remote-as 3
 neighbor 192.168.0.1 next-hop-self
 no auto-summary
    

CE1_AS3 :


hostname CE1_AS3
!
interface FastEthernet0/0
 description connection to PE Fa0/0
 ip address 10.0.0.1 255.255.255.0
 no shut
 duplex auto
 speed auto
!
interface FastEthernet1/0
 description connection to CE2 Fa1/0
 ip address 192.168.0.1 255.255.255.0
 duplex auto
 speed auto
no shut
!
router bgp 3
 no synchronization
 bgp log-neighbor-changes
 timers bgp 10 30
 neighbor 10.0.0.2 remote-as 2
 neighbor 192.168.0.2 remote-as 3
 neighbor 192.168.0.2 next-hop-self
 no auto-summary
    

As you can see the only networks advertised in this example are the loopback ip-addresses of PE_AS2. Now let’s take a look in router CE1_AS3 bgp table :

CE1_AS3 :


CE1_AS3#sh ip bgp sum
BGP router identifier 192.168.0.1, local AS number 3
BGP table version is 5, main routing table version 5
2 network entries using 234 bytes of memory
2 path entries using 104 bytes of memory
2/1 BGP path/bestpath attribute entries using 248 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 610 total bytes of memory
BGP activity 2/0 prefixes, 4/2 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.0.0.2        4     2      69      70        5    0    0 00:10:51        2
192.168.0.2     4     3      70      69        5    0    0 00:10:55        0
CE1_AS3#sh ip bgp
BGP table version is 5, local router ID is 192.168.0.1
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
*> 1.1.1.1/32       10.0.0.2                 0             0 2 i
*> 2.2.2.2/32       10.0.0.2                 0             0 2 i
    

As you can see router CE1_AS3 learns only routes via PE_AS3 although it also has a peering with router CE2_AS3. Now let’s look at router’s CE2_AS3 bgp table :

CE2_AS3 :


CE2_AS3#sh ip bgp sum
BGP router identifier 192.168.0.2, local AS number 3
BGP table version is 5, main routing table version 5
2 network entries using 234 bytes of memory
4 path entries using 208 bytes of memory
3/1 BGP path/bestpath attribute entries using 372 bytes of memory
2 BGP AS-PATH entries using 48 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 862 total bytes of memory
BGP activity 2/0 prefixes, 4/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
20.0.0.1        4     1      91      91        5    0    0 00:14:33        2
192.168.0.1     4     3      89      90        5    0    0 00:14:13        2
CE2_AS3#sh ip bgp
BGP table version is 5, local router ID is 192.168.0.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
*>i1.1.1.1/32       192.168.0.1              0    100      0 2 i
*                   20.0.0.1                               0 1 2 i
*>i2.2.2.2/32       192.168.0.1              0    100      0 2 i
*                   20.0.0.1                               0 1 2 i
    

When we look at what router CE2_AS3 advertises onto his neighbor CE1_AS3 we get :

CE2_AS3 :


CE2_AS3#sh ip bgp nei 192.168.0.1 adv

Total number of prefixes 0
    

So what we can conclude here is that when a router like router CE1_AS3 in this case receives the same routes from two peers but from one peer with a longer AS-path it doesn’t advertise it on to the peer which advertises it with a shorter AS-path (like CE1_AS3 in this case).

Leave a comment

Your comment