Archive for the ‘BGP’ Category

We have VRF-lite setup on CE with multiple customer on single CE.In this case we are moving wan circuit from old PE to New PE.

After this migration we need to validate and compare route announced from CE to PE and its attributes(SOO,Local pref,Route-target). Number of announced route varies depending upon number of customer connected on CE so manual validation and comparison is tedious task

From router configuration we are creating script to capture pre and post migration logs on PE end by extracting network command used in each vrf BGP address-family on CE.(this step of pre/post check script preparation is done separately with migration config generation)
Below is the sample of the pre and post activity logs.


Announce route POSTTEST
Created GUI using tkinter for ease of use and non python user

Announce route compare GUI
Pre/post activity logs are provided as input to the program and empty excel file already configured with conditional formattingĀ to highlight unique values by comparing odd and even rows also provide as input in the background to the we get the output as excel file with errors highlighted automatically as shown in below excel screenshot.


With help of library textfsm we are able create table from above pre/post text file and with openpyxl we are writing it to excel sheet for comparison.Final output is below.

Link for the code

Annouce route comparision



Posted: June 12, 2017 in BGP, Routing, SDN

BGP SDN enables central control over distributed routing.
This is based on routing protocol BGP and its ability to signal third party next hop using policy based routing.

We are using standard community to set next-hop which will define path to reach destination

This approach is kind of similar to Fibbing: OSPF and SDN (Hybrid model) where we set third party next hop with help of LSA5

All devices are running EBGP with each other via directly connected interface and controller will speak IBGP with every router
Controller can be any device which is capable of speaking BGP . I am using Cisco router and local-as feature to form IBGP with all routers as controller. In below diagram R5 is contoller


When we try to reach IP 100.100.100.l00 from IP we have 1 path available via path R4-R2-R1(marked with blue line)
R1 before

R2 before

R3 before

R4 before

Before Trace

Now with help of controller R5 I am sending prefix to all routers with community set to {4:2 2:3 3:1} and local preference set to 120
we can move the traffic from IP to IP via path R4-R2-R3-R1(marked with red line).

These communities are user defined and locally significant to the router mapped with next hop value
e.g if you want move packet from AS4 to AS2 set community 4:2 (this community is local to R4) in controller and next hop will be set to once R4 receives the update.
similarly to move packet frmo AS2 to AS3 set community 2:3 in controller and next hop will be set to once R4 receives the update.

R1 after

R2 after

R3 after

R4 after

After trace

Please check below link for more information

Different types of tables in BGP

Posted: February 18, 2016 in BGP

There are three types of tables in BGP

Adj-RIBs-In – Unprocessed (without applying any filtering or attribute manipulation )routing information received from neighbor.
Loc-RIB – Best routes selected after applying routing policies on the routes available in Adj-RIBs-In
Adj-RIBs-Out – Routes selected from Loc-RIB after applying outbound routing policies.

Above mentioned tables can be verified using below commands
show ip bgp neighbor x.x.x.x advertise-routes – Adj-RIBs-Out
show ip bgp – Loc-RIB
show ip bgp neighbor x.x.x.x received-routes – Adj-RIBs-In

Need for Route reflectors

Posted: February 12, 2016 in BGP

Simple reason is AS number is used for loop avoidance.

When routes are exchanged between the routers which belongs to the same As , AS_PATH list is not modified (routing update within AS).
So this situation can create routing loop and to avoid this there is BGP split horizon rule

Due to split horizon rule we need to create full mesh of IBGP sessions between the routers within same AS to avoid routing black hole. This full mesh condition is really bad consider example if there is a stub router with single neighbor with single uplink
(If there are N router in the As then we need to create (N*(N-1))/2 sessions)

To avoid such large number of BGP session and conserve useful resources we are using Route reflectors which bypasses Split horizon rule

BGP is path vector protocol

Posted: February 11, 2016 in BGP

BGP is distance vector protocol as BGP router depends on neighbor router to provide routing information about best routes to reach the destination (neighbor is the whole world for BGP routers).

BGP uses a list of AS numbers through which a packet must pass to reach the destination (this AS_PATH list fully describes the path a packet must take to reach destination)

This is the reason why BGP is called path vector protocol

BGP Synchronization and Split horizon rule

Posted: December 23, 2014 in BGP

BGP split horizon rule

Updates received on an EBGP sessin should be forwarded on all IBGP and EBGP sessions

but updates received on an IBGP session sholud be forwarded only to EBGP sessions

BGP synchronization rule

“Do not use or advertise to an external neighbors a route learned by IBGP

until a matching route has been learned from IGP.”