3-6-1. Cisco Dual BGP with Conditional Announcement

BGP sample configuration 3-4-2

Cisco Dual BGP with Conditional Announcement

   
  • ISPs : 1
  • WAN links : 2
  • CPE : 1
  • GW : 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.20.2.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 (AS20) and Customer (AS10)

 

BGP sample configuration 3-4-2

[Traffic flow]

Outbound traffic on CPE

All outbound traffic will go out thru WAN link with GW1(PE1) due to we have tagged local-pref 120 on default route from GW1(PE1) router. WAN link with GW2(PE2) 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 GW1(PE1) by controlling conditional BGP announcement algorithm. 2nd BGP session with standby WAN link 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.

[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
!
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
 serial restart-delay 0
!
interface Serial1/2
 ip address 10.20.2.1 255.255.255.252
 serial restart-delay 0
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
!
interface FastEthernet2/0
 ip address 100.100.100.1 255.255.255.0 secondary
 ip address 200.200.200.1 255.255.255.0
 duplex auto
 speed auto
!
router bgp 10
 no synchronization
 bgp log-neighbor-changes
 network 10.20.1.0 mask 255.255.255.252
 network 100.100.100.0 mask 255.255.255.0
 network 200.200.200.0
 neighbor 10.20.1.2 remote-as 20 <——————— BGP neighbor to WAN Link_1
 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.20.2.2 remote-as 20 <——————— BGP neighbor to WAN Link_2

 neighbor 10.20.2.2 prefix-list to-ISP out <———— Allow only IP block needs to be advertised to ISP
 neighbor 10.20.2.2 advertise-map advertise non-exist-map non-route <——- Inbound traffic control
 no auto-summary
!
ip http server
no ip http secure-server
ip forward-protocol nd
!
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
!
access-list 1 permit 100.100.100.0 0.0.0.255
access-list 1 permit 200.200.200.0 0.0.0.255
access-list 2 permit 10.20.1.0 0.0.0.3 <——- IP address of WAN link_1
!
route-map primary-out permit 10
 set local-preference 120
!
route-map non-route permit 10
 match ip address 2
!
route-map advertise permit 10
 match ip address 1
!
control-plane
!
line con 0
line aux 0
line vty 0 4
 login
!
end

 [GW1 / ISP Cisco Router]

version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname GW1
!
ip cef
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
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 1.3.1.1 255.255.255.252
 serial restart-delay 0
!
interface Serial1/2
 ip address 1.4.1.1 255.255.255.252
 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 1.3.1.2 remote-as 20
 neighbor 1.4.1.2 remote-as 20
 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
 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

[GW2 / ISP Cisco Router]

version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname GW2
!
ip cef
no ip domain lookup
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
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.2.2 255.255.255.252
 serial restart-delay 0
!
interface Serial1/1
 ip address 2.4.1.1 255.255.255.252
 serial restart-delay 0
!
interface Serial1/2
 ip address 2.3.1.1 255.255.255.252
 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 2.3.1.2 remote-as 20
 neighbor 2.4.1.2 remote-as 20
 neighbor 10.20.2.1 remote-as 10 <——————– BGP neighbor to Customer

 neighbor 10.20.2.1 default-originate <—————- Sending default route
 neighbor 10.20.2.1 route-map no-routes out <—- Sending no BGP table
 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 neighbors 10.20.1.2 ad
BGP table version is 17, local router ID is 200.200.200.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 i
*> 200.200.200.0    0.0.0.0                  0         32768 i

Total number of prefixes 2

CPE#sh ip bgp neighbors 10.20.1.2 ro
BGP table version is 17, local router ID is 200.200.200.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 neighbors 10.20.2.2 ad

Total number of prefixes 0

CPE#sh ip bgp neighbors 10.20.2.2 ro
BGP table version is 17, local router ID is 200.200.200.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.2.2                0             0 20 i

Total number of prefixes 1
CPE#

GW1#sh ip bgp neighbors 10.20.1.1 ro
BGP table version is 33, local router ID is 1.1.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 i
*> 200.200.200.0    10.20.1.1                0             0 10 i

Total number of prefixes 2
GW1#

GW2#sh ip bgp nei 10.20.2.1 ro

Total number of prefixes 0
GW2#


XR1#sh ip bgp 100.100.100.0

BGP routing table entry for 100.100.100.0/24, version 51
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  10
    10.20.1.1 from 1.3.1.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best
XR1#

XR2#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 52
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  10
    10.20.1.1 from 1.4.1.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best
XR2#

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

CPE#sh ip bgp neighbors 10.20.2.2 ad

BGP table version is 21, local router ID is 200.200.200.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 i
*> 200.200.200.0    0.0.0.0                  0         32768 i

Total number of prefixes 2

CPE#sh ip bgp neighbors 10.20.2.2 ro
BGP table version is 21, local router ID is 200.200.200.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.2.2                0             0 20 i

Total number of prefixes 1
CPE#

BGP table version is 41, 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
*> 100.100.100.0/24 10.20.2.1                0             0 10 i
*> 200.200.200.0    10.20.2.1                0             0 10 i

Total number of prefixes 2
GW2#

XR1#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 56
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  10
    10.20.2.1 from 2.3.1.1 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal, best
XR1#

XR2#sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 57
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  10
    10.20.2.1 from 2.4.1.1 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal, best
XR2#

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

  1 2.3.1.1 36 msec 52 msec 40 msec
  2 10.20.2.1 20 msec 52 msec 32 msec
  3  *
    100.100.100.2 [AS 10] 32 msec
XR1#

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

  1 2.4.1.1 28 msec 32 msec 68 msec
  2 10.20.2.1 16 msec 4 msec 56 msec
  3  *  *
    100.100.100.2 [AS 10] 84 msec
XR2#

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