BGP basic configuration

bgp

This is a test configuration based on an excellent BGP tutorial by Router Gods. http://www.routergods.com

(Router Gods are really excellent. Thanks for the template, guys!)

Step 1:  Configure addresses as shown and then configure internal routing between R3 and R7, using OSPF. All routers have loopbacks of x.x.x.x/24, matching router number. (eg R3 – 3.3.3.3)

router ospf 1
network 0.0.0.0 0.0.0.0 area 0

All routers from R3 to R7 are to be considered an internal network. R1 and R2 are the external network.  R3 is therefore on the edge.

Step 2  Configure fa0/0 on R3 as a passive interface.  You don’t want it to form neighbours with anyone else as it is on the edge.

router ospf 1
passive-interface fa0/0

Step 3 Configure a default gateway on R3 as the edge router:  ip route 0.0.0.0 0.0.0.0 10.10.13.2

Step 4  Make all traffic move to R3 as default using default-information originate command.
R3(config)#router ospf 1
R3(config-router)#default-information originate always

Step 5 Set up a peer from R3 to R1.  R3 ASN is 100. R1 ASN 666

R3(config)#router bgp 100
R3(config-router)#neighbor 10.10.13.2 remote-as 666

R1(config)#router bgp 666
R1(config-router)#neighbor 10.10.13.1 remote-as 100
R1(config-router)#exit
R1(config)#exit
R1#sh ip bgp summary
BGP router identifier 1.1.1.1, local AS number 666
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.10.13.1      4   100       2       2        0    0    0 00:00:01        0

Useful debug:  debug ip tcp transactions

Test:  Shut down and restarted one of the interfaces.  Debug output below, as link is re-established.
*Mar  2 21:51:17.576: Released port 179 in Transport Port Agent for TCP IP type 1 delay 240000
*Mar  2 21:51:17.580: TCB 0x66215C14 destroyed
R1#
*Mar  2 21:51:30.412: TCB66216524 created
*Mar  2 21:51:30.416: Reserved port 179 in Transport Port Agent for TCP IP type 1
*Mar  2 21:51:30.416: TCP0: state was LISTEN -> SYNRCVD [179 -> 10.10.13.1(41764)]
*Mar  2 21:51:30.416: TCP: tcb 66216524 connection to 10.10.13.1:41764, peer MSS 1460, MSS is 516
*Mar  2 21:51:30.420: TCP: sending SYN, seq 3653985059, ack 3463377124
*Mar  2 21:51:30.420: TCP0: Connection to 10.10.13.1:41764, advertising MSS 1460
*Mar  2 21:51:30.456: TCP0: state was SYNRCVD -> ESTAB [179 -> 10.10.13.1(41764)]
*Mar  2 21:51:30.460: TCB66214BC8 callback, connection queue = 1
*Mar  2 21:51:30.460: TCB66214BC8 accepting 66216524 from 10.10.13.1.41764
*Mar  2 21:51:30.472: TCB66214BC8 setting property TCP_IN_TTL (29) 651003A0
*Mar  2 21:51:30.472: TCB66214BC8 setting property TCP_OUT_TTL (30) 651003A0
*Mar  2 21:51:30.472: TCB66216524 setting property TCP_OUT_TTL (30) 66467F2A
*Mar  2 21:51:30.540: %BGP-5-ADJCHANGE: neighbor 10.10.13.1 Up

Step 5.  Peer with loopback addresses if desired.

R1(config)#router bgp 666
R1(config-router)#no neighbor 10.10.13.1 remote-as 100
R1(config-router)#neighbor 3.3.3.3 remote-as 100
R1(config-router)#exit

(You will also need to create static routes between loopbacks.  BGP will generally not work with default routes. You need to configure a static route there and back.)

Because TTL on BGP is normally 1, you need to configure multihop to get to the loopback, on both sides.

R1(config-router)#neighbor 3.3.3.3 ebgp-multihop 3
R1(config-router)#exit

Step 6.  Redistribute routes. As an example, redistribute the OSPF routes on R3 – advertise routes into BGP.  (Pretend that the 10 networks in AS100 are internet routable)
R3(config)#router bgp 100
R3(config-router)#redistribute ospf 1
R3(config-router)#exit

If you look at R1 you can now see new routes injected in to BGP:

R1#sh ip bgp
BGP table version is 14, 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
*> 3.3.3.0/24       3.3.3.3                  0             0 100 ?
*> 4.4.4.4/32       3.3.3.3                 11             0 100 ?
*> 5.5.5.5/32       3.3.3.3                 21             0 100 ?
*> 6.6.6.6/32       3.3.3.3                 22             0 100 ?
*> 7.7.7.7/32       3.3.3.3                 32             0 100 ?
r> 10.10.13.0/24    3.3.3.3                  0             0 100 ?
*> 10.10.34.0/24    3.3.3.3                  0             0 100 ?
*> 10.10.35.0/24    3.3.3.3                  0             0 100 ?
*> 10.10.45.0/24    3.3.3.3                 20             0 100 ?
*> 10.10.67.0/24    3.3.3.3                 31             0 100 ?
*> 192.168.35.0     3.3.3.3                 30             0 100 ?
*> 200.1.1.1/32     3.3.3.3                 32             0 100 ?

Note that the r route is not injected into the table because there is already a connected route.

Step 7. You can configure networks in BGP manually as well. (Put a prefix into BGP)

R1(config-router)#network 66.66.66.0 mask 255.255.255.0
R1(config-router)#exit
R1(config)#

However, this will not appear in the BGP routing table (sh ip bgp) unless it has a route to that host already.)

Step 8  Configure security

R3(config)#router bgp 100
R3(config-router)#neighbor 1.1.1.1 password cisco
R3(config-router)#exit

 

 

 

Leave a comment