4-6-1. Cisco dual BGP with Conditional Announcement

BGP sample configuration 4-6-1

Cisco dual BGP with Conditional Announcement

   
  • ISPs : 2
  • WAN links : 2
  • CPE : 1
  • GW(PE) : 2
  • Device : Cisco router with LAN/WAN ports.
  • WAN1 / Serial IP : 10.20.1.0/30 (mask 255.255.255.252)
  • WAN2 / Serial IP : 10.30.1.0/30 (mask 255.255.255.252)
  • Customer LAN IP : 100.100.100.0/24 and 200.200.200.0/24
  • Receiving Route : Default route
  • Memory : Full route(recommend 512M), partial route
    (recommend 128-256M)
  • LAN : ISP_"A" (AS20), ISP_"B"(AS30) and Customer (AS10)

 

BGP sample configuration 4-6-1

 [Traffic flow]

Outbound traffic on CPE

All outbound traffic will go out thru WAN link with ISP_"A"(PE) due to we have tagged local-pref 120 on default route from GW(PE) router. WAN link with ISP_"B"(PE) will be less preferred due to local-pref 100(default) until the WAN link down.
 

Inbound traffic on CPE

Customer routes will be only announced thru WAN link with ISP_"A"(PE) by controlling conditional BGP announcement algorithm. 2nd BGP session with standby WAN link(ISP_"B" will not advertise customer routes unless primary WAN link is down that means Serial IP address/ 10.20.1.0/30 will be dropped from BGP table. As long as the route is disappeared from the BGP table, 2nd BGP will start announcing customer routes, 100.100.100.0/24 and 200.200.200.0/24.

topology_BGP4.png

[CPE/Customer Cisco Router]

version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname CPE
!
ip cef
no ip domain lookup
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial1/0
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/1
 ip address 10.20.1.1 255.255.255.252
 load-interval 30
 serial restart-delay 0
!
interface Serial1/2
 ip address 10.30.1.1 255.255.255.252
 load-interval 30
 serial restart-delay 0
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
!
interface FastEthernet2/0
 ip address 200.200.200.1 255.255.255.0 secondary
 ip address 100.100.100.1 255.255.255.0
 duplex auto
 speed auto
!
router bgp 10
 no synchronization
 bgp log-neighbor-changes
 redistribute connected
 neighbor 10.20.1.2 remote-as 20 <——————— BGP neighbor to ISP_"A"
 neighbor 10.20.1.2 prefix-list to-ISP out <———— Allow only IP block needs to be advertised to ISP
 neighbor 10.20.1.2 route-map primary-out in <—- Outbound traffic control
 neighbor 10.30.1.2 remote-as 30 <——————— BGP neighbor to ISP_"B"
 neighbor 10.30.1.2 prefix-list to-ISP out <———— Allow only IP block needs to be advertised to ISP
 neighbor 10.30.1.2 advertise-map advertise non-exist-map no-route <——- Inbound traffic control
 no auto-summary
!
ip http server
no ip http secure-server
ip forward-protocol nd
!
ip prefix-list prefix-1 seq 5 permit 100.100.100.0/24
!
ip prefix-list prefix-2 seq 5 permit 200.200.200.0/24
!
ip prefix-list to-ISP seq 5 permit 100.100.100.0/24
ip prefix-list to-ISP seq 10 permit 200.200.200.0/24
!
ip prefix-list wan_1 seq 5 permit 10.20.1.0/30 <——- IP address of WAN link with ISP_"A"
!
route-map primary-out permit 10
 set local-preference 120 <———————- Outbound traffic control

!
route-map no-route permit 10
 match ip address prefix-list wan_1

!
route-map advertise permit 10
 match ip address prefix-list to-ISP

!
control-plane
!
line con 0
 exec-timeout 0 0
 logging synchronous
line aux 0
line vty 0 4
 login
!
end

 [ISP_"A" GW(PE) / ISP Cisco Router]

version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname ISP_A
!
no aaa new-model
memory-size iomem 5
!
ip cef
no ip domain lookup
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial1/0
 ip address 10.20.1.2 255.255.255.252
 serial restart-delay 0
!
interface Serial1/1
 ip address 20.20.1.1 255.255.255.252
 serial restart-delay 0
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
!
router bgp 20
 no synchronization
 bgp log-neighbor-changes
 redistribute connected
 neighbor 10.20.1.1 remote-as 10 <——————– BGP neighbor to Customer
 neighbor 10.20.1.1 default-originate <—————- Sending default route
 neighbor 10.20.1.1 route-map no-routes out <—- Sending no BGP table
 neighbor 20.20.1.2 remote-as 20
 no auto-summary
!
ip http server
no ip http secure-server
ip forward-protocol nd
!
route-map no-routes deny 10 <————————— Sending no BGP table
!
control-plane
!
line con 0
 exec-timeout 0 0
 logging synchronous
line aux 0
line vty 0 4
 login
!
end

[ISP_"B GW(PE) / ISP Cisco Router]

version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname ISP_B
!
ip cef
no ip domain lookup
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial1/0
 ip address 10.30.1.2 255.255.255.252
 serial restart-delay 0
!
interface Serial1/1
 ip address 30.30.1.1 255.255.255.252
 serial restart-delay 0
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
!
router bgp 30
 no synchronization
 bgp log-neighbor-changes
 redistribute connected
 neighbor 10.30.1.1 remote-as 10 <——————– BGP neighbor to Customer
 neighbor 10.30.1.1 default-originate <—————- Sending default route
 neighbor 10.30.1.1 route-map no-routes out <—- Sending no BGP table
 neighbor 30.30.1.2 remote-as 30
 no auto-summary
!
ip http server
no ip http secure-server
ip forward-protocol nd
!
route-map no-routes deny 10 <————————— Sending no BGP table
!
control-plane
!
line con 0
 exec-timeout 0 0
 logging synchronous
line aux 0
line vty 0 4
 login
!
end 

[Dynamips testing]

Download and test it yourself with below Dynamips configuration files.

  Dynamips NET file

  Router configuration files

 

[Verifing output]


CPE#sh ip bgp 0.0.0.0
BGP routing table entry for 0.0.0.0/0, version 28
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  20
    10.20.1.2 from 10.20.1.2 (20.20.1.1)
      Origin IGP, metric 0, localpref 120, valid, external, best
  30
    10.30.1.2 from 10.30.1.2 (30.30.1.1)
      Origin IGP, metric 0, localpref 100, valid, external

CPE#sh ip bgp nei 10.20.1.2 ad
BGP table version is 30, local router ID is 100.100.100.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
*> 100.100.100.0/24 0.0.0.0                  0         32768 ?
*> 200.200.200.0    0.0.0.0                  0         32768 ?

Total number of prefixes 2

CPE#sh ip bgp nei 10.20.1.2 ro
BGP table version is 30, local router ID is 100.100.100.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
*> 0.0.0.0          10.20.1.2                0    120      0 20 i

Total number of prefixes 1
CPE#sh ip bgp nei 10.30.1.2 ad

Total number of prefixes 0

CPE#sh ip bgp nei 10.30.1.2 ro
BGP table version is 30, local router ID is 100.100.100.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
*  0.0.0.0          10.30.1.2                0             0 30 i

Total number of prefixes 1
CPE#

ISP_A#sh ip bgp nei 10.20.1.1 ro
BGP table version is 45, local router ID is 20.20.1.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
*> 100.100.100.0/24 10.20.1.1                0             0 10 ?
*> 200.200.200.0    10.20.1.1                0             0 10 ?

Total number of prefixes 2
ISP_A#

ISP_B#sh ip bgp neighbors 10.30.1.1 ro

Total number of prefixes 0
ISP_B#

TR_A#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 42
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1
  10
    10.20.1.1 from 20.20.1.1 (20.20.1.1)
      Origin incomplete, metric 0, localpref 100, valid, internal, best
TR_A#

TR_B#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 50
Paths: (2 available, best #2, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1          2
  50 20 10
    30.50.1.2 from 30.50.1.2 (30.50.1.2)
      Origin incomplete, localpref 100, valid, external
  20 10
    20.30.1.1 from 20.30.1.1 (20.50.1.1)
      Origin incomplete, localpref 100, valid, external, best
TR_B#

Internet#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 49
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1
  20 10
    20.50.1.1 from 20.50.1.1 (20.50.1.1)
      Origin incomplete, localpref 100, valid, external, best
  30 20 10
    30.50.1.1 from 30.50.1.1 (30.50.1.1)
      Origin incomplete, localpref 100, valid, external

Internet#tr 100.100.100.2
Type escape sequence to abort.
Tracing the route to 100.100.100.2

  1 20.50.1.1 32 msec 56 msec 48 msec
  2 20.20.1.1 [AS 20] 20 msec 52 msec 36 msec
  3 10.20.1.1 [AS 20] 16 msec 36 msec 60 msec
  4 100.100.100.2 [AS 10] 60 msec 88 msec *
Internet#

When WAN Link 1 is down, see below routing changes.  It will take a time to complete conversion

CPE#sh ip bgp 0.0.0.0
BGP routing table entry for 0.0.0.0/0, version 31
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  30
    10.30.1.2 from 10.30.1.2 (30.30.1.1)
      Origin IGP, metric 0, localpref 100, valid, external, best

CPE#sh ip bgp nei 10.30.1.2 ad
BGP table version is 34, local router ID is 100.100.100.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
*> 100.100.100.0/24 0.0.0.0                  0         32768 ?
*> 200.200.200.0    0.0.0.0                  0         32768 ?

Total number of prefixes 2

CPE#sh ip bgp nei 10.30.1.2 ro
BGP table version is 34, local router ID is 100.100.100.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
*> 0.0.0.0          10.30.1.2                0             0 30 i

Total number of prefixes 1
CPE#


ISP_B#sh ip bgp neighbors 10.30.1.1 ro

BGP table version is 65, local router ID is 30.30.1.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
*> 100.100.100.0/24 10.30.1.1                0             0 10 ?
*> 200.200.200.0    10.30.1.1                0             0 10 ?

Total number of prefixes 2
ISP_B#


TR_A#sh ip bgp 100.100.100.0

BGP routing table entry for 100.100.100.0/24, version 42
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1
  10
    10.20.1.1 from 20.20.1.1 (20.20.1.1)
      Origin incomplete, metric 0, localpref 100, valid, internal, best

TR_A#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 48
Paths: (2 available, best #2, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1          2
  50 30 10
    20.50.1.2 from 20.50.1.2 (30.50.1.2)
      Origin incomplete, localpref 100, valid, external
  30 10
    20.30.1.2 from 20.30.1.2 (30.50.1.1)
      Origin incomplete, localpref 100, valid, external, best
TR_A#

TR_B#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 58
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     2
  10
    10.30.1.1 from 30.30.1.1 (30.30.1.1)
      Origin incomplete, metric 0, localpref 100, valid, internal, best
TR_B#

Internet#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 57
Paths: (2 available, best #2, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1
  20 30 10
    20.50.1.1 from 20.50.1.1 (20.50.1.1)
      Origin incomplete, localpref 100, valid, external
  30 10
    30.50.1.1 from 30.50.1.1 (30.50.1.1)
      Origin incomplete, localpref 100, valid, external, best

Internet#tr 100.100.100.2
Type escape sequence to abort.
Tracing the route to 100.100.100.2

  1 30.50.1.1 44 msec 44 msec 32 msec
  2 30.30.1.1 [AS 30] 20 msec 60 msec 60 msec
  3 10.30.1.1 [AS 30] 24 msec 80 msec 28 msec
  4  *
    100.100.100.2 [AS 10] 68 msec 104 msec
Internet#

If you have any questions, feel free to send email us at [email protected]. If you are looking for professional grade service, you might want to try our "BGP experts service". What is "BGP Experts service"? Click "BGP Experts" from the top menu option. You will find out what the "BGP Experts" and what we are doing here for.


Author: Chris Yoon

IT professional