Sunday, August 7, 2011

Configuring BGP - Single Homed Design

BGP is a highly complex routing protocol -- so complex that there are exams dedicated to just this protocol. Therefore, I will not dwell on the details and the inner workings of BGP, however I will give you a brief how-to implement a "Single Homed" BGP design


When it comes to BGP designs they are four basic ones: single homed, dual homed, single multihomed and dual mutihomed. In this blogtorial we are going to see how to implement a "Single homed" BGP design


Here is the topology which I will be using and we will be building upon this topology on future BGP blogtorials so let's get started. 
Relevant configurations are posted below.

R3 is in our enterprise core and has OSPF as its IGP. In a hierarchical model, Enterprise core will usually connect to the distribution layer which will then connect to the access layer. Core layer should have fast transport, fault tolerance, low latency, and high reliability. Below are the relevant configurations for R3. 

R3#conf t
R3(config)#int fast1/0
R3(config-if)#ip add 10.1.1.3 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#network 10.1.1.0 0.0.0.255 area 0
R3(config-router)#exit
R3(config)#exit
R3#

R1 is in our enterprise edge and has OSPF for IGP and BGP for EGP. In a hierarchical model, Enterprise edge should contain E-commerce, DMZ, WAN, and Remote Access VPN. Enterprise edge should also be the default gateway for the enterprise core. Enterprise edge is where you would deploy single/dual homed and single/dual multihomed designs. Below are the relevant configurations for R1.

R1>en
R1#conf t
R1(config)#int fast1/0
R1(config-if)#ip add 10.1.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#int g2/0
R1(config-if)#ip add 10.0.0.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#network 10.1.1.0 0.0.0.255 area 0
R1(config-router)#default-information originate
R1(config-router)#exit
R1(config)#router bgp 22222
R1(config-router)#neighbor 10.0.0.2 remote-as 11111
R1(config-router)#network 22.22.22.0 mask 255.255.255.0
R1(config-router)#exit
R1(config)#ip route 22.22.22.0 255.255.255.0 null 0
R1(config)#exit
R1#


R2 is in the service provider edge. R2 has a couple of static routes to advertise into BGP and is advertising a default route to R1 which will then get propagated throughout the enterprise core. Below are the relevant configurations from R2. 


R2>en
R2#conf t
R2(config)#int g1/0
R2(config-if)#ip add
R2(config-if)#ip address 10.0.0.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#ip route 0.0.0.0 0.0.0.0 null 0
R2(config)#ip route 5.5.5.0 255.255.255.0  null 0
R2(config)#router bgp 11111
R2(config-router)#network 5.5.5.0 mask 255.255.255.0
R2(config-router)#neighbor 10.0.0.1 remote-as 22222
R2(config-router)#neighbor 10.0.0.1 default-originate ** advertise a default route to the peer **
R2(config-router)#exit
R2(config)#exit
R2#

Few show commands from the routers to verify BGP and connectivity. 



R2#sh ip bgp summary


Neighbor        V          AS                   MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.0.0.1          4         22222                      35      36              4          0     0        00:32:32        1


R1#sh ip route
<-- output shortened -->
     5.0.0.0/24 is subnetted, 1 subnets
B       5.5.5.0 [20/0] via 10.0.0.2, 00:32:08 ** BGP learned route ** 
     22.0.0.0/24 is subnetted, 1 subnets
S       22.22.22.0 is directly connected, Null0 ** static route to inject into BGP **
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.1.0 is directly connected, FastEthernet1/0
C       10.0.0.0 is directly connected, GigabitEthernet2/0
B*   0.0.0.0/0 [20/0] via 10.0.0.2, 00:32:08 ** default route from BGP because of the default originate command in R2 ** 


R1#sh ip bgp
<-- output shortened --> 
   Network          Next Hop            Metric LocPrf Weight Path
*> 0.0.0.0          10.0.0.2                 0             0 11111 i
*> 5.5.5.0/24       10.0.0.2                 0             0 11111 i
*> 22.22.22.0/24    0.0.0.0                  0         32768 i

R3#sh ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
10.1.1.1          1   FULL/BDR        00:00:36    10.1.1.1        FastEthernet1/0

R3#sh ip route
<-- output shortened -->
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, FastEthernet1/0
O*E2 0.0.0.0/0 [110/1] via 10.1.1.1, 00:33:59, FastEthernet1/0 ** default route injected by R1 ** 

As you can see R1 is BGP (Single homed) with R2 advertising a /24 (22.22.22.0/24) and R1 is advertising a default to the enterprise core (R3).

Stay tuned for single multihomed (single router in the enterprise edge connected to 2 different ISPs), dual single homed (dual routers in the enterprise edge connected to 1 ISP) and dual multihomed (dual routers in the enterprise edge connected to 2 different ISPs). 

As always, please subscribe if you like my posts by clicking on "Join this site".