3-4-2. Cisco dual BGP with Community string (Load-Balancing)

BGP sample configuration 3-4-2

Cisco dual BGP with Community string (Load-Balancing)

   
  • ISPs : 1
  • WAN links : 2
  • CPE : 1
  • PE : 2
  • Device : Cisco router with LAN/WAN ports.
  • WAN1 / Serial IP : 12.1.3.0/30 (mask 255.255.255.252)
  • WAN2 / Serial IP : 12.1.4.0/30 (mask 255.255.255.252)
  • Destination IP : 100.100.100.100 and 200.200.200.200
  • LAN / Ethernet IP : 10.1.0.1/24 and 10.1.0.129/25(Secondary)
  • Receiving Route : No 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 both links. It is controlled by simple default route statement in this scenario. Outbound traffic won’t be divided in exact 50/50. Because traffic will route to the link per destination(default) based, but not per packet. Don’t worry, overall it make a balancing traffic. Most of ISPs are not supporting per packet option due to it is CPU intensive command(they said). 
 
Inbound traffic on CPE
In this case we assumed that LAN side IP is fully used(/24). We will split it in half and announce it to Internet thru one of WANs.   We will announce /24 thru WAN1 and announce second half of /24, which is /25 block thru other WAN. So traffic targeted to first half of /24 will come thru WAN1 and other traffic will come thru WAN 2.

[CPE/Customer Cisco Router]

Current configuration:
!
version 12.x
!
hostname CPE
!
interface Ethernet0
description to Internal network
ip address 10.1.0.1 255.255.255.0
ip address 10.1.0.129 255.255.255.128 secondary
no ip directed-broadcast
no ip mroute-cache
!
interface Serial0
description to ISP A – WAN 1
ip address 12.1.3.1 255.255.255.252
no ip directed-broadcast
no ip mroute-cache
no fair-queue
!
interface Serial1
description to ISP A – WAN 2
ip address 12.1.4.1 255.255.255.252
no ip directed-broadcast
no ip mroute-cache
no fair-queue
!
router bgp 10
no auto-summary
network 10.1.0.0 mask 255.255.255.0
network 10.1.0.128 mask 255.255.255.128
neighbor 12.1.3.2 remote-as 20
neighbor 12.1.3.2 version 4
neighbor 12.1.3.2 prefix-list 1 out
neighbor 12.1.3.2 filter-list 10 out <– To prevent announcing routes that is learning from other link or ISP
neighbor 12.1.4.2 remote-as 20
neighbor 12.1.4.2 version 4
neighbor 12.1.4.2 send-community
neighbor 12.1.3.2 filter-list 10 out <– To prevent announcing routes that is learning from other link or ISP
neighbor 12.1.4.2 route-map outbound out
!
ip classless
!
ip route 0.0.0.0 0.0.0.0 Serial0
ip route 0.0.0.0 0.0.0.0 Serial1
ip as-path access-list 10 permit ^$
!
ip prefix-list 1 seq 5 permit 10.1.0.0/24
route-map outbound permit 10
set community 20:80
!
!
line con 0
line aux 0
line vty 0 4
login
!
end

  

[PE1 / ISP Cisco Router]

Current configuration:
!
version 12.x
!
hostname PE
!
!
interface Serial0
description to WAN 1
ip address 12.1.3.2 255.255.255.252
no ip directed-broadcast
no ip mroute-cache
no fair-queue
!
 

router bgp 20
no auto-summary
neighbor 12.1.3.1 remote-as 10
neighbor 12.1.3.1 version 4

neighbor 12.1.3.1 distribute-list 2 out
neighbor 12.1.3.1 route-map customer in
!
ip community-list 1 permit 20:1
ip community-list 2 permit 20:2
ip community-list 3 permit 20:3
ip community-list 4 permit 20:80
ip community-list 4 permit 20:120
ip classless
!
access-list 2 deny   any
route-map customer permit 10
 match community 1
 set as-path prepend 20
!
route-map customer permit 20
 match community 2
 set as-path prepend 20 20
!
route-map customer permit 30
 match community 3
 set as-path prepend 20 20 20
!
route-map customer permit 40
 match community 4
 set local-preference 80
!
route-map customer permit 50
 match community 5
 set local-preference 120
!
route-map customer permit 60
line con 0
line aux 0
line vty 0 4
login
!
end
[PE2 / ISP Cisco Router]
Current configuration:
!
version 12.x
!
hostname PE
!
!
interface Serial1
description to WAN 2
ip address 12.1.4.2 255.255.255.252
no ip mroute-cache
no ip directed-broadcast
no fair-queue
!
router bgp 20
no auto-summary
neighbor 12.1.4.1 remote-as 10
neighbor 12.1.4.1 version 4
neighbor 12.1.4.1 distribute-list 2 out
neighbor 12.1.3.1 route-map customer in
!
ip classless
!
ip community-list 1 permit 20:1
ip community-list 2 permit 20:2
ip community-list 3 permit 20:3
ip community-list 4 permit 20:80
ip community-list 4 permit 20:120
ip classless
!
access-list 2 deny any
route-map customer permit 10
 match community 1
 set as-path prepend 20
!
route-map customer permit 20
 match community 2
 set as-path prepend 20 20
!
route-map customer permit 30
 match community 3
 set as-path prepend 20 20 20
!
route-map customer permit 40
 match community 4
 set local-preference 80
!
route-map customer permit 50
 match community 5
 set local-preference 120
!
route-map customer permit 60

!
line con 0
line aux 0
line vty 0 4
login
!
end 

[Verifing output]

CPE#show ip bgp
BGP table version is 3, 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
*> 10.1.0.0/24      0.0.0.0                  0         32768 i
*> 10.1.0.128/25    0.0.0.0                  0         32768 i
CPE#

CPE#show ip route
:
:
S*   0.0.0.0/0 is directly connected, Serial3/0
               is directly connected, Serial3/1
 

CPE#
   
 
 
CPE# show ip bgp neighbors 12.1.3.2 ad
BGP table version is 3, 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
*> 10.1.0.0/24      0.0.0.0                  0         32768 i

Total number of prefixes 1
CPE#
 

 
CPE# show ip bgp neighbors 12.1.4.2 ad
BGP table version is 3, 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
*> 10.1.0.0/24      0.0.0.0                  0         32768 i
*> 10.1.0.128/25    0.0.0.0                  0         32768 i

Total number of prefixes 2
CPE#

 
 
CPE# show ip bgp neighbors 12.1.3.2 ro
 
Total number of prefixes 0
CPE#
 
 
CPE# show ip bgp neighbors 12.1.4.2 ro

Total number of prefixes 0
CPE#

 
PE1#show ip bgp nei 12.1.3.1 ro
BGP table version is 78, local router ID is 3.3.3.3
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
*> 10.1.0.0/24      12.1.3.1                 0             0 10 i

Total number of prefixes 1
PE1#

 
 
PE2#show ip bgp nei 12.1.4.1 ro
BGP table version is 129, local router ID is 4.4.4.4
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
*> 10.1.0.0/24      12.1.4.1                 0     80      0 10 i
*> 10.1.0.128/25    12.1.4.1                 0     80      0 10 i

Total number of prefixes 2
PE2#
 

 
Internet#traceroute 10.1.0.1

Type escape sequence to abort.
Tracing the route to 10.1.0.1

  1 PE1 (20.3.5.1) 20 msec 28 msec 28 msec
  2 CPE (12.1.3.1) 56 msec *  64 msec

 

Internet#traceroute 10.1.0.129

Type escape sequence to abort.
Tracing the route to 10.1.0.129

  1 PE2 (20.4.5.1) 16 msec 28 msec 28 msec
  2 CPE (12.1.4.1) 60 msec *  56 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