Sayed Hamza
BGP (Border Gateway Protocol)
Border Gateway Protocol (BGP) is a routing protocol used to exchange
routing and reach-ability information between routers in different
autonomous systems (AS) on the Internet. In other words, BGP is used
to connect different networks, such as those of different service
providers, and allow for the exchange of data between these networks.
In a Cisco network, BGP is often used as an exterior gateway protocol
(EGP) to exchange routing information with other routers in different
ASs. BGP peers (also known as BGP neighbors) are established
between routers to exchange routing information.
BGP uses a path-vector algorithm to determine the best path to a
destination network, taking into account factors such as network metrics,
policies, and rules configured by network administrators. BGP can also
support multiple paths to the same destination network, providing
redundancy and load balancing.
One of the key features of BGP is its ability to support route aggregation,
where multiple routes are combined into a single, more specific route,
reducing the size of the routing tables and improving performance.
Software/Network Engineer Whatsapp:+923059299396
Sayed Hamza
In summary, BGP is a key component of the Internet routing
infrastructure, providing a scalable and flexible solution for exchanging
routing information between different ASs and connecting networks on
a global scale.
EBGP: External BGP
IBGP: Internal BGP
External BGP (EBGP) is used to exchange routing information between
different autonomous systems (AS). In other words, EBGP is used to
connect different networks, such as those of different service providers,
and allow for the exchange of data between these networks.
Software/Network Engineer Whatsapp:+923059299396
Sayed Hamza
Internal BGP (IBGP) is used to exchange routing information within a
single autonomous system (AS). IBGP is typically used to distribute routing
information between routers within a network, ensuring that all routers have
a consistent view of the network and can make informed routing decisions.
By default, Administrative Distance of EBGP is 20 and IBGP is 200
BGP is Policy Based Routing (PBR) protocol
It has built-in PBR mechanism; other protocol doesn’t have this
feature at all
BGP is used in multi-homed systems
Works on TCP port 179 (connections are important in TCP)
In BGP, indirectly connected networks can also be advertised (we
can Advertise indirectly connected network in IBGP but EGBP we
need Directly Connect Interface for Advertisement).
BGP is configured on border routers. Any other routing protocol
like RIP, OSPF is configured on all other routers in an
autonomous system.
BGP have two Tables.
1. Routing Table
2. Layer 4 Table (BGP Table)
Software/Network Engineer Whatsapp:+923059299396
S
Basic Lab of BGP (Between 2 Different Autonomous Systems) EBGP LAB 1
Assign IP Address on Routers
R1(config)#int s 0/0
R1(config-if)#ip add 1.0.0.1
255.0.0.0 R1(config-
if)#encapsulation ppp
R1(config-if)#bandwidth
1000
R1(config-if)#clock rate
64000 R1(config-if)#no
shutdown R1(config-
if)#exit
R1(config)#int f 0/0
R1(config-if)#ip add 200.100.50.1 255.255.255.0
R1(config-if)#no shutdown
Software/Network Engineer Whatsapp:+923059299396
S
R1(config-if)#exit
R2(config)#int s 0/0
R2(config-if)#ip add 1.0.0.2
255.0.0.0 R2(config-
if)#encapsulation ppp
R2(config-if)#bandwidth
1000 R2(config-if)#no
shutdown
R2(config-if)#exit
R2(config)#int fastEthernet 0/0
R2(config-if)#ip address 200.100.100.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
Software/Network Engineer Whatsapp:+923059299396
A(config)#router bgp 10
A(config-router)#neighbor 1.0.0.2 remote-as 20
A(config-router)#network 200.100.50.0
A(config-router)#end
Router B Configuration
B(config)#router bgp 20
B(config-router)#neighbor 1.0.0.1 remote-as 10
B(config-router)#network 200.100.100.0
B(config-router)#end
Verification (Show IP BGP Summery Means Neighbor Information)
B#show ip bgp summary
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down
State/PfxRcd
1.0.0.1 4 10 3 2 3 0 0 00:00:28 4
Show IP GBP Means Network
information B#show ip bgp
Network Next Metric LocPrf Weight Path
Hop
*> 200.100.50.0/24 1.0.0.1 0 0 0 10 i
*> 0.0.0.0 0 0 32768 i
200.100.100.0/24
Software/Network Engineer Whatsapp:+923059299396
* Means its valid
route
> Means its best
route
B#show ip route
1.0.0.0/8 is variably subnetted, 2 subnets, 2
masks C 1.0.0.0/8 is directly connected,
Serial0/0
C 1.0.0.1/32 is directly connected, Serial0/0
B 200.100.50.0/24 [20/0] via 1.0.0.1, 02:06:44
C 200.100.100.0/24 is directly connected, FastEthernet0/0
B#ping 200.100.50.2
!!!!!
B#ping 200.100.50.3
!!!!!
Software/Network Engineer Whatsapp:+923059299396
Assign IP Address on Routers
R1(config)#int s 0/0
R1(config-if)#ip add 1.0.0.1
255.0.0.0 R1(config-
if)#encapsulation ppp
R1(config-if)#bandwidth
1000
R1(config-if)#clock rate
64000 R1(config-if)#no
shutdown R1(config-
if)#exit
R1(config)#int f 0/0
R1(config-if)#ip add 200.100.50.1 255.255.255.0
Software/Network Engineer Whatsapp:+923059299396
R1(config-if)#no shutdown
R1(config-if)#exit
R2(config)#int s 0/0
R2(config-if)#ip add 1.0.0.2
255.0.0.0 R2(config-
if)#encapsulation ppp
R2(config-if)#bandwidth
1000 R2(config-if)#no
shutdown
R2(config-if)#exit
R2(config)#int fastEthernet 0/0
R2(config-if)#ip address 200.100.100.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
Software/Network Engineer Whatsapp:+923059299396
R1(config)#router bgp 10
R1(config-router)#neighbor 1.0.0.2 remote-as 10
R1(config-router)#network 200.100.50.0 mask 255.255.255.0
R1(config-router)#exit
BGP Configuration on Router B
R2(config)#router bgp 10
R2(config-router)#neighbor 1.0.0.1 remote-as 10
R2(config-router)#network 200.100.100.0 mask 255.255.255.0
R2(config-router)#exit
Verification
R2#show ip bgp summary
BGP router identifier 200.100.100.1, local AS
number 10 BGP table version is 3, main routing
table version 3
2 network entries using 240 bytes of
memory 2 path entries using 104
bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes
of memory 0 BGP route-map cache entries using 0
bytes of memory
Software/Network Engineer Whatsapp:+923059299396
0 BGP filter-list cache entries using 0 bytes of memory
Bitfield cache entries: current 1 (at peak 1) using 32
bytes of memory BGP using 748 total bytes of memory
BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down
State/PfxRcd
1.0.0.1 4 10 7 7 3 0 0 00:03:10 1
R2#
R2#show ip bgp
BGP table version is 3, local router ID is 200.100.100.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
*>i200.100.50.0 1.0.0.1 0 100 0 i
*> 200.100.100.0 0.0.0.0 0 32768 i
R2#
R2#show ip route
Software/Network Engineer Whatsapp:+923059299396
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.0.0.1/32 is directly connected, Serial0/0
C 1.0.0.0/8 is directly connected, Serial0/0
B 200.100.50.0/24 [200/0] via 1.0.0.1, 00:11:59
C 200.100.100.0/24 is directly connected,
FastEthernet0/0 R2#
Software/Network Engineer Whatsapp:+923059299396
Assign IP Address on Routers
R1(config)#int s 0/0
R1(config-if)#ip add 1.0.0.1
255.0.0.0 R1(config-
if)#encapsulation ppp
R1(config-if)#bandwidth
1000
R1(config-if)#clock rate
64000 R1(config-if)#no
shutdown R1(config-
if)#exit
R1(config)#int f 0/0
R1(config-if)#ip add 200.100.50.1 255.255.255.0
R1(config-if)#no shutdown
Software/Network Engineer Whatsapp:+923059299396
R1(config-if)#exit
R1(config)#int loopback 0
R1(config-if)#ip add 11.1.1.1 255.255.255.0
R1(config)#int loopback 1
R1(config-if)#ip add 44.4.4.4 255.255.255.0
Software/Network Engineer Whatsapp:+923059299396
R2(config-if)#ip add 1.0.0.2
255.0.0.0 R2(config-
if)#encapsulation ppp
R2(config-if)#bandwidth
1000 R2(config-if)#no
shutdown
R2(config-if)#exit
R2(config)#int fastEthernet 0/0
R2(config-if)#ip address 200.100.100.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#int loopback 0
R2(config-if)#ip add 22.2.2.2 255.255.255.0
R2(config)#int loopback 1
R2(config-if)#ip add 33.3.3.3 255.255.255.0
BGP Configuration on Router A
R1(config)#router bgp 10
R1(config-router)#neighbor 1.0.0.2 remote-as 10
R1(config-router)#network 200.100.50.0 mask 255.255.255.0
Software/Network Engineer Whatsapp:+923059299396
R1(config-router)#network 11.1.1.0 mask 255.255.255.0
R1(config-router)#network 44.4.4.0 mask 255.255.255.0
BGP Configuration on Router B
R2(config)#router bgp 10
R2(config-router)#neighbor 1.0.0.1 remote-as 10
R2(config-router)#network 200.100.100.0 mask 255.255.255.0
R2(config-router)#network 22.2.2.0 mask 255.255.255.0
R2(config-router)#network 33.3.3.0 mask 255.255.255.0
Verification
R2#show ip bgp summary
BGP router identifier 33.3.3.3, local AS number 10
BGP table version is 7, main routing table version 7
6 network entries using 720 bytes of memory
6 path entries using 312 bytes of memory
3/2 BGP path/bestpath attribute entries using 372 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
Bitfield cache entries: current 1 (at peak 1) using 32 bytes of memory
BGP using 1436 total bytes of memory
BGP activity 6/0 prefixes, 6/0 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down
Software/Network Engineer Whatsapp:+923059299396
State/PfxRcd
1.0.0.1 4 10 5 5 7 0 0 00:01:11 3
R2#
Software/Network Engineer Whatsapp:+923059299396
BGP table version is 7, local router ID is 33.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 LocP Weig Pat
rf ht h
*>i11.1.1.0/24 1.0.0.1 0 100 0i
*> 22.2.2.0/24 0.0.0.0 0 32768 i
*> 33.3.3.0/24 0.0.0.0 0 32768 i
*>i44.4.4.0/24 1.0.0.1 0 100 0i
*>i200.100.50.0 1.0.0.1 0 100 0i
*> 200.100.100.0 0.0.0.0 0 32768 i
R2#
R2#show ip
route
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.0.0.1/32 is directly connected, Serial0/0
C 1.0.0.0/8 is directly connected, Serial0/0
33.0.0.0/24 is subnetted, 1 subnets
C 33.3.3.0 is directly connected, Loopback1
Software/Network Engineer Whatsapp:+923059299396
B 200.100.50.0/24 [200/0] via 1.0.0.1, 00:01:02
C 200.100.100.0/24 is directly connected,
FastEthernet0/0 22.0.0.0/24 is subnetted, 1 subnets
C 22.2.2.0 is directly connected,
Loopback0 11.0.0.0/24 is subnetted, 1
subnets
B 11.1.1.0 [200/0] via 1.0.0.1, 00:01:03
44.0.0.0/24 is subnetted, 1 subnets
B 44.4.4.0 [200/0] via 1.0.0.1, 00:01:03
R2#
R2#ping 44.4.4.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 44.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/12 ms
R2#
R2#ping 11.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 11.1.1.1, timeout is 2 seconds:
!!!!!
Software/Network Engineer Whatsapp:+923059299396
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/12 ms
R2#
R2#ping 200.100.50.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.100.50.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/16 ms
R2#
Software/Network Engineer Whatsapp:+923059299396