BGP Basic Configuration Example [ Step by step]

BGP Basic Configuration Example [ Step by step]


Topology

BGP Configuration


R1 Configuration:

R1#show run

Building configuration...

Current configuration : 799 bytes
version 15.4

hostname R1

interface Loopback0

ip address 1.1.1.1 255.255.255.255

!

interface GigabitEthernet0/0/0

ip address 8.8.8.1 255.255.255.0

duplex auto

speed auto

!

router bgp 65001

bgp log-neighbor-changes

no synchronization

neighbor 8.8.8.2 remote-as 65002

network 8.8.8.0 mask 255.255.255.0

network 1.1.1.1 mask 255.255.255.255



R2 Configuration:

R2#show running-config

Building configuration...

Current configuration : 846 bytes

!

version 15.4

no service timestamps log datetime msec

no service timestamps debug datetime msec

no service password-encryption

!

hostname R2

!

ip cef

no ipv6 cef

spanning-tree mode pvst

interface Loopback0

ip address 2.2.2.2 255.255.255.255

!

interface GigabitEthernet0/0/0

ip address 8.8.8.2 255.255.255.0

duplex auto

speed auto

!

router bgp 65002

bgp log-neighbor-changes

no synchronization

neighbor 8.8.8.1 remote-as 65001

network 2.2.2.2 mask 255.255.255.255

network 8.8.8.0 mask 255.255.255.0

network 15.1.1.0 mask 255.255.255.0


BGP peering Verifications

  • Show ip bgp neighbor:

R1:

R1#show ip bgp neighbors

BGP neighbor is 8.8.8.2, remote AS 65002, external link

BGP version 4, remote router ID 2.2.2.2

BGP state = Established, up for 00:47:17

Last read 00:47:17, last write 00:47:17, hold time is 180, keepalive interval is 60 seconds

Neighbor capabilities:

Route refresh: advertised and received(new)

Address family IPv4 Unicast: advertised and received

Message statistics:

InQ depth is 0

OutQ depth is 0

Sent Rcvd

Opens: 1 1

Notifications: 0 0

Updates: 3 3

Keepalives: 48 48

Route Refresh: 0 0

Total: 52 52

Default minimum time between advertisements runs is 30 seconds

For address family: IPv4 Unicast

BGP table version 6, neighbor version 6/0

Output queue size : 0

Index 1, Offset 0, Mask 0x2

1 update-group member

Sent Rcvd

Prefix activity: ---- ----

Prefixes Current: 3 3 (Consumes 138 bytes)

Prefixes total: 3 3

Implicit Withdraw: 0 0

Explicit Withdraw: 0 0

Used as bestpath: n/a 1

Used as multipath: n/a 0

Outbound Inbound

Local Policy Denied Prefixes: -------- -------

Total: 0 0

Number of NLRIs in the update sent: max 3, min 1

Address tracking is enabled, the RIB does have a route to 8.8.8.2

Connections established 1; dropped 3

Last reset never

Transport(tcp) path-mtu-discovery is enabled

Connection state is ESTAB, I/O status: 1, unread input bytes: 0

Connection is ECN Disabled, Minimum incoming TTL 0, Outgoing TTL 1

Local host: 8.8.8.1, Local port: 179

Foreign host: 8.8.8.2, Foreign port: 1025

Connection tableid (VRF): 0

Enqueued packets for retransmit: 0, input: 0 mis-ordered: 0 (0 bytes)

Event Timers (current time is 0xC69F4):

Timer Starts Wakeups Next

Retrans 0 0 0x0

TimeWait 0 0 0x0

AckHold 51 0 0x0

SendWnd 0 0 0x0

KeepAlive 48 0 0x0

GiveUp 0 0 0x0

PmtuAger 0 0 0x0

DeadWait 0 0 0x0

Linger 0 0 0x0

ProcessQ 0 0 0x0

iss: 2057115318 snduna: 2057115748 sndnxt: 2057115748 sndwnd: 15955

irs: 3480424370 rcvnxt: 3480424751 rcvwnd: 16004 delrcvwnd: 380

SRTT: 259 ms, RTTO: 579 ms, RTV: 320 ms, KRTT: 0 ms

minRTT: 16 ms, maxRTT: 300 ms, ACK hold: 200 ms

Status Flags: passive open, gen tcbs

Option Flags: nagle, path mtu capable

IP Precedence value : 6

Datagrams (max data segment is 1460 bytes):

Rcvd: 52 (out of order: 0), with data: 0, total data bytes: 0

Sent: 49 (retransmit: 0, fastretransmit: 0, partialack: 0, Second Congestion: 0), with data: 3, total data bytes: 72

Packets received in fast path: 0, fast processed: 0, slow path: 0

fast lock acquisition failures: 0, slow path: 0

R2:

R2#show ip bgp neighbors

BGP neighbor is 8.8.8.1, remote AS 65001, external link

BGP version 4, remote router ID 1.1.1.1

BGP state = Established, up for 00:48:42

Last read 00:48:42, last write 00:48:42, hold time is 180, keepalive interval is 60 seconds

Neighbor capabilities:

Route refresh: advertised and received(new)

Address family IPv4 Unicast: advertised and received

Message statistics:

InQ depth is 0

OutQ depth is 0

Sent Rcvd

Opens: 1 1

Notifications: 0 0

Updates: 3 3

Keepalives: 49 49

Route Refresh: 0 1

Total: 53 54

Default minimum time between advertisements runs is 30 seconds

For address family: IPv4 Unicast

BGP table version 6, neighbor version 6/0

Output queue size : 0

Index 1, Offset 0, Mask 0x2

1 update-group member

Sent Rcvd

Prefix activity: ---- ----

Prefixes Current: 3 2 (Consumes 115 bytes)

Prefixes total: 3 2

Implicit Withdraw: 0 0

Explicit Withdraw: 0 0

Used as bestpath: n/a 1

Used as multipath: n/a 0

Outbound Inbound

Local Policy Denied Prefixes: -------- -------

Total: 0 0

Number of NLRIs in the update sent: max 3, min 1

Address tracking is enabled, the RIB does have a route to 8.8.8.1

Connections established 1; dropped 0

Last reset never

Transport(tcp) path-mtu-discovery is enabled

Connection state is ESTAB, I/O status: 1, unread input bytes: 0

Connection is ECN Disabled, Minimum incoming TTL 0, Outgoing TTL 1

Local host: 8.8.8.2, Local port: 1025

Foreign host: 8.8.8.1, Foreign port: 179

Connection tableid (VRF): 0

Enqueued packets for retransmit: 0, input: 0 mis-ordered: 0 (0 bytes)

Event Timers (current time is 0xC69F4):

Timer Starts Wakeups Next

Retrans 0 0 0x0

TimeWait 0 0 0x0

AckHold 52 0 0x0

SendWnd 0 0 0x0

KeepAlive 49 0 0x0

GiveUp 0 0 0x0

PmtuAger 0 0 0x0

DeadWait 0 0 0x0

Linger 0 0 0x0

ProcessQ 0 0 0x0

iss: 2057115318 snduna: 2057115748 sndnxt: 2057115748 sndwnd: 15955

irs: 3480424370 rcvnxt: 3480424751 rcvwnd: 16004 delrcvwnd: 380

SRTT: 259 ms, RTTO: 579 ms, RTV: 320 ms, KRTT: 0 ms

minRTT: 16 ms, maxRTT: 300 ms, ACK hold: 200 ms

Status Flags: passive open, gen tcbs

Option Flags: nagle, path mtu capable

IP Precedence value : 6

Datagrams (max data segment is 1460 bytes):

Rcvd: 53 (out of order: 0), with data: 1, total data bytes: 24

Sent: 50 (retransmit: 0, fastretransmit: 0, partialack: 0, Second Congestion: 0), with data: 3, total data bytes: 72

Packets received in fast path: 0, fast processed: 0, slow path: 0

fast lock acquisition failures: 0, slow path: 0

R2#


  • Show ip BGP
R1#show ip bgp

BGP table version is 6, 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

*> 1.1.1.1/32 0.0.0.0 0 0 32768 i

*> 2.2.2.2/32 8.8.8.2 0 0 0 65002 i

*> 8.8.8.0/24 0.0.0.0 0 0 32768 i

* 8.8.8.2 0 0 0 65002 i

*> 15.1.1.0/24 8.8.8.2 0 0 0 65002 i

R1#


------------------------------------------------------------------------


R2#show ip bgp

BGP table version is 8, local router ID is 2.2.2.2

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

*> 1.1.1.1/32 8.8.8.1 0 0 0 65001 i

*> 2.2.2.2/32 0.0.0.0 0 0 32768 i

*> 8.8.8.0/24 0.0.0.0 0 0 32768 i

* 8.8.8.1 0 0 0 65001 i

*> 15.1.1.0/24 0.0.0.0 0 0 32768 i


  • Show ip route:
R1#show ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

Gateway of last resort is not set

1.0.0.0/32 is subnetted, 1 subnets

C 1.1.1.1/32 is directly connected, Loopback0

2.0.0.0/32 is subnetted, 1 subnets

B 2.2.2.2/32 [20/0] via 8.8.8.2, 00:00:00

8.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C 8.8.8.0/24 is directly connected, GigabitEthernet0/0/0

L 8.8.8.1/32 is directly connected, GigabitEthernet0/0/0

15.0.0.0/24 is subnetted, 1 subnets

B 15.1.1.0/24 [20/0] via 8.8.8.2, 00:00:00

                        ------------------------------



R2# show ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

Gateway of last resort is not set

1.0.0.0/32 is subnetted, 1 subnets

B 1.1.1.1/32 [20/0] via 8.8.8.1, 00:00:00

2.0.0.0/32 is subnetted, 1 subnets

C 2.2.2.2/32 is directly connected, Loopback0

8.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C 8.8.8.0/24 is directly connected, GigabitEthernet0/0/0

L 8.8.8.2/32 is directly connected, GigabitEthernet0/0/0

15.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C 15.1.1.0/24 is directly connected, GigabitEthernet0/0/1

L 15.1.1.1/32 is directly connected, GigabitEthernet0/0/1

Bilel-A

Enthusiastic Network Engineer specializing in Cisco ACI, passionate about solving challenges. A lifelong learner who loves gaining and sharing knowledge. Profile: https://www.linkedin.com/in/bilel-ameur-71116b2b5
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x