BGP sample configuration Case 1-3

Here is a sample eBGP configuration with AS-path prepend option for someone has a single connection with an ISP or remote site. This article will show how to apply AS-path prepend option on your router. If you want to see more complex examples(with multiple ISP connections), check alist of BGP sample configuration page. This configuration has been tested and verified at our lab. If you have any questions and problems, try our web BGP tutorial page first. And If you still need further assistance, please feel free to contact us by email.

List of BGP Sample Configurations

? Basic eBGP configuration with AS-path prepend

  

[Assumption]

1. Device : Cisco router with LAN/WAN ports.
2.
IOS version : Latest or at least BGP support
3. WAN encapsulation : HDLC
4. WAN / Serial IP : 1.1.1.1/30 (mask 255.255.255.252) – assumed public IP here.
5. LAN / Ethernet IP : 10.10.10.1/24 (mask 255.255.255.0) – assumed public IP here.
6. Receiving route : Default route + full route from ISP
7. Memory : Full route(recommend 512M), partial route(recommend 128-256M)
8. ASN : If you don’t have one, then apply one.

US(ARIN.com), ASIA(APNIC.com), Europe(RIPE.net) and South America(Lacnic.net)
If your all upstream connections are subscribed with only one ISP, contact the ISP to rent free ASN. Again, you won’t use the rental ANS for other ISP connection.

9. IGP : None

 

[Router 1/Customer]

Current configuration:
!
version 12.x
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
service udp-small-servers
service tcp-small-servers
!
hostname Router1
!
enable secret 5 Pl$RwwQMKXmRs8oFcaCCvLxX$1$VG/
!
ip subnet-zero
ip name-server x.x.x.x
ip name-server y.y.y.y
ip name-server z.z.z.z
!
!
interface Ethernet0
description to Internal network
ip address 10.10.10.1 255.255.255.0
no ip directed-broadcast
no ip mroute-cache
!
interface Serial0
description to ISP
ip address 1.1.1.1 255.255.255.252
no ip directed-broadcast
no ip mroute-cache
no fair-queue
!
interface Serial1
no ip mroute-cache
no ip directed-broadcast
shutdown
!
router bgp 100
no auto-summary
redistribute connected
neighbor 1.1.1.2 remote-as 200 <—- 200 is ISP’s ASN

neighbor 1.1.1.2 version 4
neighbor 1.1.1.2 route-map To_ISP out

!
ip classless
ip route 0.0.0.0 0.0.0.0 Serial0 <—– Default route, if partial routes are receiving from ISP, you must have this default route statement. You can request ISP to send default route through BGP.
!
ip prefix-list 1 description announcing routes to ISP
ip prefix-list 1 seq 5 permit 10.10.10.0/24 le 32
!
route-map To_ISP permit 10
match ip address prefix-list 1
set as-path prepend 100 100 100 <—- AS prepended three times
!
line con 0
line aux 0
line vty 0 4
login
!
end

[Router 2/ISP]

Current configuration:
!
version 12.x
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
service udp-small-servers
service tcp-small-servers
!
hostname Router2
!
enable secret 5 Pl$RwwQMKXmRs8oFcaCCvLxX$1$VG/
!
ip subnet-zero
ip name-server x.x.x.x
ip name-server y.y.y.y
ip name-server z.z.z.z
!
!
interface POS1/0
description to Uplink
ip address x.x.x.x 255.255.255.252
no ip directed-broadcast
no ip mroute-cache
!
:
:
:
!
interface Serial0
description to ISP
ip address 1.1.1.2 255.255.255.252
no ip directed-broadcast
no ip mroute-cache
no fair-queue
!
interface Serial1
no ip mroute-cache
no ip directed-broadcast
shutdown
!
router bgp 200
neighbor 1.1.1.1 remote-as 100 <—- 100 is other side’s ASN
neighbor 1.1.1.1 version 4
neighbor 1.1.1.1 default-originate <—- Sending default route to customer through BGP.
neighbor 1.1.1.1 prefix-list 2 in

!
ip classless
!
ip prefix-list 2 description from customer or peer
ip prefix-list 2 seq 5 permit 10.10.10.0/24 le 32 <—- Accepting smaller block than /24
!
line con 0
line aux 0
line vty 0 4
login
!
end


[Verified]

Router1# sh ip bgp neighbors 1.1.1.2 ad
BGP table version is 8, local router ID is x.x.x.x
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal
Origin codes: i – IGP, e – EGP, ? – incomplete

Network Next Hop Metric LocPrf Weight Path
*> 10.10.10.0/24 0.0.0.0 0 0 32768 ?
Router1#


Router2#sh ip bgp neighbors 1.1.1.1 ro
BBGP table version is 245, local router ID is x.x.x.x
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal
Origin codes: i – IGP, e – EGP, ? – incomplete

Network Next Hop Metric LocPrf Weight Path
*> 10.10.10.0/24 1.1.1.1 0 0 100 100 100 100 ? <—- AS prepended three times

Total number of prefixes 1


Router1#sh ip bgp neighbors 1.1.1.2 ro <—- Getting default route from ISP
BGP table version is 10, local router ID is x.x.x.x
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal
Origin codes: i – IGP, e – EGP, ? – incomplete

Network NextHop Metric LocPrf Weight Path
*> 0.0.0.0 1.1.1.2 0 200 i

Total number of prefixes 1
Router1#

If you have any questions and problems, try our web BGP tutorial page first. And If you still need further assistance, please feel free to contact us by email

 

 

 

Leave a Reply