19 June, 2013

Basic BGP N:1

Implementing Basic BGP
R5#configure terminal
R5(config)#router bgp 6500
R5(config-router)#neighbor 10.1.45.4 remote-as 5500


R5(config-router)#do show ip bgp summary
BGP router identifier 10.1.45.5, local AS number 6500
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.45.4       4  5500       0       0        0    0    0 never    Active

Configure R4

R4#configure terminal
R4(config)#router bgp 5500
R4(config-router)#neighbor 10.1.45.5 remote-as 6500

 *Mar  1 00:17:21.003: %BGP-5-ADJCHANGE: neighbor 10.1.45.5 Up

R4(config-router)#do show ip bgp summary
BGP router identifier 4.4.4.4, local AS number 5500
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.45.5       4  6500       4       4        1    0    0 00:01:33        0

### How To Established Neighborship Between R1 and R4

Create Loopback Interfaces and Add those into OSPF

R1#Configure terminal
R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.255
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R1(config-router)#end
R1#show ip route ospf | inc 4.4.4.4
O       4.4.4.4 [110/129] via 10.1.13.3, 00:29:18, Serial1/0

R4#Configure terminal
R4(config)#interface loopback 0
R4(config-if)#ip address 4.4.4.4 255.255.255.255
R4(config-if)#exit
R4(config)#router ospf 1
R4(config-router)#network 4.4.4.4 0.0.0.0 area 0
R4(config-router)#end
R4#show ip route ospf | inc 1.1.1.1
O       1.1.1.1 [110/129] via 10.1.34.3, 00:28:49, Serial1/1

### Configure BGP

R4#configure terminal
R4(config)#router bgp 5500
R4(config-router)#neighbor 1.1.1.1 remote-as 5500
R4(config-router)#neighbor 1.1.1.1 update-source loopback 0

*Mar  1 00:38:21.699: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up

R1#configure terminal
R1(config)#router bgp 5500
R1(config-router)#neighbor 4.4.4.4 remote-as 5500
R1(config-router)#neighbor 4.4.4.4 update-source loopback 0

*Mar  1 00:45:39.115: %BGP-5-ADJCHANGE: neighbor 4.4.4.4 Up

### Two Ways To Get Network Into BGP: 

*Network Command 

*Redistribution

### Redistribute Routes From R5 

R5#show ip interface brief | include Loopback
Loopback1                  200.1.1.1       YES manual up                    up
Loopback2                  200.1.2.1       YES manual up                    up
Loopback3                  200.1.3.1       YES manual up                    up
Loopback4                  200.1.4.1       YES manual up                    up
Loopback5                  200.1.5.1       YES manual up                    up
Loopback6                  200.1.6.1       YES manual up                    up
Loopback50                 50.1.1.1        YES manual up                    up

Advertise 50.1.1.0/24 Network Using Network Command

R5#configure terminal
R5(config)#router bgp 6500
R5(config)#do show ip interface brief | inc 50.1.1.1
Loopback50                 50.1.1.1        YES manual up                    up

R5(config)#do show ip interface loopback 50 | inc Internet address
  Internet address is 50.1.1.1/24

R5(config-router)#network 50.1.1.0 mask 255.255.255.0
R5(config-router)#^Z
R5#show ip bgp
BGP table version is 2, local router ID is 10.1.45.5
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
*> 50.1.1.0/24      0.0.0.0                  0         32768 i

###Verify On R4 

R4#show ip route 50.1.1.1
Routing entry for 50.1.1.0/24
  Known via "bgp 5500", distance 20, metric 0
  Tag 6500, type external
  Last update from 10.1.45.5 00:06:00 ago
  Routing Descriptor Blocks:
  * 10.1.45.5, from 10.1.45.5, 00:06:00 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 6500

R4#show ip route | include 50.1.1.0
B       50.1.1.0 [20/0] via 10.1.45.5, 00:07:56

### Redistribute Into BGP (Redistribute Only 200.1.1-4.0/24 Routes)

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

Create Route-Map

R5(config)#route-map FILTER-20
R5(config-route-map)#match ip address 20
R5(config-route-map)#^Z

R5#show route-map
route-map FILTER-20, permit, sequence 10
  Match clauses:
    ip address (access-lists): 20
  Set clauses:
  Policy routing matches: 0 packets, 0 bytes

R5#show access-lists 20
Standard IP access list 20
    10 permit 200.1.1.0
    30 permit 200.1.3.0
    20 permit 200.1.2.0
    40 permit 200.1.4.0

R5#configure terminal
R5(config)#router bgp 6500
R5(config-router)#redistribute connected route-map FILTER-20

(Just Wait BGP Is Very Slow Protocol)

R5#show ip bgp
BGP table version is 6, local router ID is 10.1.45.5
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
*> 50.1.1.0/24      0.0.0.0                  0         32768 i
*> 200.1.1.0        0.0.0.0                  0         32768 ?
*> 200.1.2.0        0.0.0.0                  0         32768 ?
*> 200.1.3.0        0.0.0.0                  0         32768 ?
*> 200.1.4.0        0.0.0.0                  0         32768 ?

Verify On R4 

R4#show ip bgp
BGP table version is 6, local router ID is 4.4.4.4
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
*> 50.1.1.0/24      10.1.45.5                0             0 6500 i
*> 200.1.1.0        10.1.45.5                0             0 6500 ?
*> 200.1.2.0        10.1.45.5                0             0 6500 ?
*> 200.1.3.0        10.1.45.5                0             0 6500 ?
*> 200.1.4.0        10.1.45.5                0             0 6500 ?

R4#show ip route | include 200.1
B    200.1.4.0/24 [20/0] via 10.1.45.5, 00:04:07
B    200.1.1.0/24 [20/0] via 10.1.45.5, 00:04:07
B    200.1.2.0/24 [20/0] via 10.1.45.5, 00:04:07
B    200.1.3.0/24 [20/0] via 10.1.45.5, 00:04:07

### How To Get This BGP Networks into R1 (How To Fix It)

* BGP Synchronization 

-Do not use or advertise a route learned via IBGP until the same
route has been learned from the internal routing protocol

Verify R1 

R1#show ip bgp
BGP table version is 1, 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
* i50.1.1.0/24      10.1.45.5                0    100      0 6500 i
* i200.1.1.0        10.1.45.5                0    100      0 6500 ?
* i200.1.2.0        10.1.45.5                0    100      0 6500 ?
* i200.1.3.0        10.1.45.5                0    100      0 6500 ?
* i200.1.4.0        10.1.45.5                0    100      0 6500 ?

R1#show ip route bgp
(Nothing)

### Fix It

R1#configure terminal
R1(config)#router bgp 5500
R1(config-router)#no synchronization

R4#configure terminal
R4(config)#router bgp 5500
R4(config-router)#no synchronization

On R1 Next-Hop Is 10.1.45.5 (R5) R1 does not know how to reach it

R1#ping 10.1.45.5
.....
Success rate is 0 percent (0/5)

### BGP Next-Hop Processing:

- For EBGP peers: Change next hop address on advertised routes

- For IBGP peers: Do not change next hop address on advertised routes

R4#configure terminal
R4(config)#router bgp 5500
R4(config-router)#neighbor 1.1.1.1 next-hop-self

Verify R1 

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
*>i50.1.1.0/24      4.4.4.4                  0    100      0 6500 i
*>i200.1.1.0        4.4.4.4                  0    100      0 6500 ?
*>i200.1.2.0        4.4.4.4                  0    100      0 6500 ?
*>i200.1.3.0        4.4.4.4                  0    100      0 6500 ?
*>i200.1.4.0        4.4.4.4                  0    100      0 6500 ?

R1#show ip route bgp
B    200.1.4.0/24 [200/0] via 4.4.4.4, 00:01:27
     50.0.0.0/24 is subnetted, 1 subnets
B       50.1.1.0 [200/0] via 4.4.4.4, 00:01:27
B    200.1.1.0/24 [200/0] via 4.4.4.4, 00:01:27
B    200.1.2.0/24 [200/0] via 4.4.4.4, 00:01:27
B    200.1.3.0/24 [200/0] via 4.4.4.4, 00:01:27

Now R1 Knows How to Reach 4.4.4.4 and Syncronization is Turn Off

Done!!!

##########################################################################################################