Border Gateway Protocol (BGP)

 

BGP for Beginners

 

Introduction

 

Here we start a bgp instance for AS 100, set router-id to the network address we announce (to easily find it in show listing), announce two networks wich are directly attached, describe our neighbors with their ip addresses and AS's, set distance (metric) for routes, learned from bgp to 150.

In fact, this is the local network, with private ip and AS ranges, and bgp is running to backup ospf, which is described below. So, this bgp instance lets ospf routes dominate over bgp.

 

Network Diagram

 

 

Configuration

 
Okapi(config)# router bgp 100
Okapi(config-router)# bgp router-id 100.20.50.1
Okapi(config-router)# network 100.20.50.0/24
Okapi(config-router)# neighbor 100.20.50.2 remote-as 200
Okapi(config-router)# distance bgp 150 150 150

 

 

Peering with Internet Exchange Point

 

Introduction

In this example we want to peer with Internet eXchange point (IX). An Internet exchange point (IX or IXP) is a physical infrastructure that allows different Internet service providers (ISPs) to exchange Internet traffic between their networks (autonomous systems) by means of mutual peering agreements, which allow traffic to be exchanged without cost.

 

Configuration

 
Okapi(config)# router bgp 111
Okapi(config-router)# bgp router-id x.y.122

Announce our networks to the peer:

Okapi(config-router)# network 1.2.3.0/19
Okapi(config-router)# network 2.3.4.0/24

Send only aggregated prefixes:

Okapi(config-router)# aggregate-address 1.2.3.0/19 summary-only
Okapi(config-router)# aggregate-address 2.3.4.0/24 summary-only

Set IX point as neighbor:

Okapi(config-router)# neighbor a.b.c.100 remote-as 666
Okapi(config-router)# neighbor a.b.c.100 description whatever
Okapi(config-router)# neighbor a.b.c.100 weight 2001
Okapi(config-router)# neighbor a.b.c.100 activate
Okapi(config-router)# neighbor a.b.c.100 soft-reconfiguration inbound

Obey to IX rules that make us leave AS-path untouched:

Okapi(config-router)# neighbor a.d.c.100 attribute-unchanged as-path

 

 

Simple Routing Desicion

 

Introduction

We have one BGP router (Router A), two upstreams. We want to prefer routes received from peer Router B no matter what (means AS-patch, better route exists, etc.)

 

Network Diagram

 

Configuration

 
Okapi(config)# router bgp 100
Okapi(config-router)# neighbor 100.20.50.2 description peer RouterB
Okapi(config-router)# neighbor 100.20.50.2 remote-as 200
Okapi(config-router)# neighbor 100.20.50.2 weight 200
Okapi(config-router)# neighbor 200.20.50.2 description peer RouterC
Okapi(config-router)# neighbor 200.20.50.2 remote-as 300
Okapi(config-router)# neighbor 200.20.50.2 weight 200

The configuration above has its bad sides too. Only routes that HAVE NOT been announced by peer Router B and HAVE been announced by peer Router C will get into the routing table. So the following configuration has no sense when accepting full feeds from both peers, as only routes coming from peer Router B will be installed. It is useful when only partial feed is received from peer Router B.

 

 

BGP Routes Filtering

 

Introduction

 

Sometimes we don't want to send or receive BGP routes updates of a particular network to one of its peer. This can be achieve by using BGP routes filtering.

In this example, Router C sends the BGP updates of network 50.10.0.0/16 to Router A. But we don't want to send BGP updates of network 50.10.0.0/16 to Router B, so we define an access-list and apply it to the out going updates to peer Router B.

 

Network Diagram

 

 

 

Configuration

 

Router A

Okapi(config)# access-list 1 deny 50.10.0.0 0.0.255.255 
Okapi(config)# access-list 1 permit 0.0.0.0 255.255.255.255
Okapi(config)# router bgp 100
Okapi(config-router)# network 60.10.0.0/16
Okapi(config-router)# neighbor 100.20.50.2 remote-as 200
Okapi(config-router)# neighbor 200.20.50.2 remote-as 300
Okapi(config-router)# neighbor 100.20.50.2 distribute-list 1 out

 

 

AS-Path Filtering

 

Introduction

Just like Route Filtering, BGP Filtering can be done on the basis of AS Number called Path Filtering. In this example, we don't want to send BGP updates of network 50.10.0.0/16 to Router B, in order to prevent the transmission of any updates originated from AS300 to AS200 define an access-list and apply it to the out going updates to AS 200.

 

Network  Diagram

 

 

 

Configuration

 

Router A

Okapi(config)# router bgp 100
Okapi(config-router)# network 60.10.0.0/16
Okapi(config-router)# neighbor 100.20.50.2 remote-as 200
Okapi(config-router)# neighbor 200.20.50.2 remote-as 300
Okapi(config-router)# neighbor 100.20.50.2 filter-list BLAH out

Configure as-path access-list:

Okapi(config)# ip as-path access-list BLAH deny ^200$
Okapi(config)# ip as-path access-list BLAH permit .*
 
 

Prepending Scenario

We want to apply different prepending to different prefixes.

 

Configuration

Okapi(config)# router bgp 123
Okapi(config-router)# neighbor ...
Okapi(config-router)# neighbor route-map ADVERTS out
Okapi(config-router)# neighbor ...
Okapi(config)# ip prefix-list PL1 seq 10 permit 192.168.1.0/24
Okapi(config)# ip prefix-list PL2 seq 10 permit 192.168.2.0/24
Okapi(config)# route-map ADVERTS permit 10 
Okapi(config-route-map)# match ip address prefix-list PL1
Okapi(config-route-map)# set as-path prepend 123 123
Okapi(config)# route-map ADVERTS permit 20 
Okapi(config-route-map)# match ip address prefix-list PL2
Okapi(config-route-map)# set as-path prepend 123 123 123

In the above example, we apply the ADVERTS route-map to prefixes we announce to the neighbor. The ADVERTS route-map has 2 sections. Anything matching prefix-list PL1 will be padded twice, and anything matching PL2 will be padded 3 times.

 

 

Simple Router Reflector

 

Introduction

The route reflector (RR) offers an alternative to the logical full-mesh requirement of internal border gateway protocol (iBGP). A RR acts as a focal point for iBGP sessions. The purpose of the RR is concentration. Multiple BGP routers can peer with a central point, the RR - acting as a route reflector server - rather than peer with every other router in a full mesh. All the other iBGP routers become route reflector clients.

This example show a simple route reflector configuration for IPv4.

 

Network Diagram

 

 

Configuration

 
Okapi(config)# bgp multiple-instance
Okapi(config)# router bgp 100 view 1
Okapi(config-router)# bgp router-id 10.20.50.1
Okapi(config-router)# neighbor 10.20.50.2 remote-as 64512
Okapi(config-router)# neighbor 10.20.50.2 description iBGP-PEER1
Okapi(config-router)# neighbor 10.20.50.2 route-reflector-client
Okapi(config-router)# neighbor 10.20.50.3 remote-as 64512
Okapi(config-router)# neighbor 10.20.50.3 description iBGP-PEER2
Okapi(config-router)# neighbor 10.20.50.3 route-reflector-client

 

 

Accepting only default route from BGP peer

 

Network Diagram

 

 

Configuration

 

Router A

Configure Prefix-list for default route

Okapi(config)# ip prefix-list DEFGWONLY seq 5 permit 0.0.0.0/0

Apply the Prefix-list:

Okapi(config)# router bgp 100
Okapi(config-router)# neighbor 100.20.50.1 remote-as 200
Okapi(config-router)# neighbor 100.20.50.1 description OurPeer
Okapi(config-router)# neighbor 100.20.50.1 prefix-list DEFGWONLY in
Okapi(config-router)# neighbor 100.20.50.1 soft-reconfiguration inbound
Okapi(config-router)# neighbor 100.20.50.1 activate