Configuring BGP is a little bit different from other protocols, this  BGP configuration sample helps you deeply to understand the BGP configuration. First, you need to make BGP Neighbor Configuration then you must advertise the networks. BGP Configuration Example will be examined with the figure below :

bgp configuration

There are two ways of sending the routes to BGP domain.

  1. Network Command
  2. Redistribution

BGP CONFIGURATION

R5(config)#router bgp 6500
R5(config-router)#network 50.0.0.0

“network 50.1.1.0 mask 255.255.255.0” command could be written instead of “network 50.0.0.0” . Actually “network 50.0.0.0” is not preferred because all networks start with 50.x.x.x is advertised.

R5#show ip bgp
Network    Next Hop
*>; 50.1.1.0/24  0.0.0.0   //  " *>; " refers to best and valid path to the destination network. //
R4# sh ip bgp
Network       Next Hop
*>; 50.1.1.0/24   10.1.45.2

200.1.1.1 – 4 will be advertised but 5-6 won’t be advertised to BGP.  This process will be made by redistribution…

R5(config)#access-list 50 deny 200.1.5.0
R5(config)#access-list 50 deny 200.1.6.0

Access list above could be modified like below too :

R5(config)#access-list 50 permit 200.1.1.0
R5(config)#access-list 50 permit 200.1.2.0
R5(config)#access-list 50 permit 200.1.3.0
R5(config)#access-list 50 permit 200.1.4.0

R5(config)#access-list 50 permit any
R5(config)#route-map FILTER
R5(config-router)#match ip adddress 50
R5(config)#router bgp 6500
R5(config-router)#redistribute connected route-map FILTER     // "connected" includes 10.1.45.2 too, this is gonna be fixed later. //
R5#show ip bgp
   Network
*>;10.0.0.0
*>;50.0.0.0
*>;50.1.1.0/24
*>;200.1.1.0
*>;200.1.2.0
*>;200.1.3.0
*>;200.1.4.0

R5(conf)#router bgp 6500
R5(config-router)#no auto

 

R5#show ip bgp
   Network
10.1.45.0/30
50.1.1.0/24
200.1.1.0
200.1.2.0
200.1.3.0
200.1.4.0
R1#sh ip bgp
            Network                  Next hop
*:        50.1.1.0/24               10.1.45.2
*:        200.1.1.0                 10.1.45.2
*:        200.1.2.0                 10.1.45.2
*:        200.1.3.0                 10.1.45.2
*:        200.1.4.0                 10.1.45.2

Pay attention that   ” * >;  ” is not available , means network is not a best valid.

 

R1(config)#router bgp 6500
R1(config-router)#no sync

“no sync” command : Don’t use or advertise a route which is learnt by IBGP  until same route is learnt by an internal routing protocol ( like OSPF etc. ). If  router – 1 learns 200.1.1.0 network via BGP and if a PC that works behind Router – 1 wants to reach 200.1.1.0 network, packet is dropped at Router-3 because only there are only OSPF routes at Router – 3 routing table.

BGP Synchronization

EBGP Peer : Changes the next hop address on advertised router.

IBGP Peer : Doesn’t change the next hop address on advertised router.

R4(config)# router bgp 6500
R4(config-router)#neighbor 1.1.1.1 next-hop-self
                           R4#sh ip BGP

Next hop
*>:50.1.1.0/24 4.4.4.4
*>:200.1.1.0/24 4.4.4.4
*>:200.1.2.0/24 4.4.4.4
*>:200.1.3.0/24 4.4.4.4
*>:200.1.4.0/24 4.4.4.4