So lets get this party started with the dry stuff we all love, theory and concepts.
BGP uses the “network” command in router configuration, which is basically the same as a network statement for OSPF or EIGRP, except for a couple differences you will see during configuration.
The real differences however are in how IGP’s (Interior Gateway Protocols) differ from EGP’s (Exterior Gateway Protocols), as IGP’s uses the “network” statements to identify interfaces participating in the protocol, BGP uses this command to identify a network itself to be advertised by BGP – So long as the local router has the network in its IP route table!
The network specified in the BGP configuration must be an exact match of the network in the local route table for the network command to work (including the mask), though you do NOT need to include the mask, however it is highly recommended to use a subnet mask in the network statements or you will only have classful networks.
A side note to this, if in the TSHOOT / ROUTE / on the job, if you are seeing BGP issues the first place to start looking is to confirm that BGP network statements include the mask.
You may see some extra static routes I intend to use for future studies, but I will not be using the 4.4.4.4 route this lab, I’ll start with configuration between R1 and R5:
R5#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R5(config)#router bgp 500
R5(config-router)#network 5.5.5.5 ?
backdoor Specify a BGP backdoor route
mask Network mask
route-map Route-map to modify the attributes
<cr>
R5(config-router)#network 5.5.5.5 mask ?
A.B.C.D Network mask
R5(config-router)#network 5.5.5.5 mask 255.255.255.255 ?
backdoor Specify a BGP backdoor route
route-map Route-map to modify the attributes
<cr>
R5(config-router)#network 5.5.5.5 mask 255.255.255.255
R5(config-router)#
Step 1 accomplished, I wanted to point out a few things here in this initial input that I won’t be displaying in every output. There is the “route-map” option for “attributes” which are going to be covered probably painfully, along with the term “mask” meaning a regular (non-wildcard) subnet mask, and finally the <cr> indicating you don’t need to put a mask on it (but it will be advertised classfully as 1.0.0.0/8 network).
Then you will have to wear the dunce hat for the rest of the labbing session, so I put the mask on there, and I didn’t think I’d get output right away but HERE IS THE GOLDEN SHOW COMMAND FOR BGP ROUTE ADVERTISEMENT IN ACTION:
R5#sh ip bgp
BGP table version is 4, local router ID is 5.5.5.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
*> 5.5.5.5/32 0.0.0.0 0 32768 i
R5#
This is exactly what we want to see, a valid* and best> network in the BGP table. Ping tests are not a valid way to test route reachability with BGP. Some thing to note in the above output, bullet point style:
- Since the network is on the local router, the Next Hop will be 0.0.0.0
- The 32768 number is the weight, which will be covered in future sections
- You don’t just want a valid path, but a valid and best path as noted above
- You can also view the local RID above the Status codes, with table version #
- You want to see a *> next to your network, meaning it’s valid and best status, anything else (at this point) is unacceptable!
So what is happening on R1 with no network information entered yet?
THIS IS WHERE IT ALL STARTS TO GO DOWNHILL, BEFORE I SAVE IT, STICK WITH ME THROUGH THIS STRUGGLE!
R1#sh ip bgp
BGP table version is 9, 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
r> 5.5.5.5/32 5.5.5.5 0 0 500 i
This doesn’t look great to me with the Rib Failure in front of Best for our network, so lets see if adding the local router network evens things up:
R1(config)#router bgp 100
R1(config-router)#network 1.1.1.1 mask 255.255.255.255
R1(config-router)#^Z
R1#sh
*Mar 31 01:31:13.149: %SYS-5-CONFIG_I: Configured from console by console
R1#sh ip bgp
BGP table version is 10, 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 32768 i
r> 5.5.5.5/32 5.5.5.5 0 0 500 i
I didn’t see this complication in my materials at all so I am kind of googling around, and what I am finding is that it failed to insert the route into the route table, or if I perhaps made one of those networks a /24 without realizing it.
So I wr mem / reload on both R1 and R5 to see how they re-establish and go from there:
R1>en
Password:
R1#sh ip bgp
BGP table version is 4, 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 32768 i
r> 5.5.5.5/32 5.5.5.5 0 0 500 i
R1#
Ahhhhhh man. Ok, so I am going to completely remove BGP from both routers and start from scratch, as I didn’t remove configs from the last post of configuring loopbacks to form the neighbor relationship.
I will wr mem on both routers before I get going on dismantling them, so I can research this tomorrow to see if we can keep those settings and have this work.
However, without further ado:
R1(config)#router bgp 100
R1(config-router)#neighbor 172.12.123.3 remote-as 100
R1(config-router)#neighbor
*Mar 31 01:52:27.868: %BGP-5-ADJCHANGE: neighbor 172.12.123.3 Up
R1(config-router)#neighbor 172.12.123.2 remote-as 100
R1(config-router)#
*Mar 31 01:53:10.695: %BGP-5-ADJCHANGE: neighbor 172.12.123.2 Up
R1(config-router)#nei 172.12.15.5 remote-as 500
R1(config-router)#
ASR#5
[Resuming connection 5 to r5 … ]
R5(config)#router bgp 500
R5(config-router)#neighbor 172.12.15.1 remote-as 100
R5(config-router)#
*Apr 11 03:05:19.443: %BGP-5-ADJCHANGE: neighbor 172.12.15.1 Up
R5(config-router)#do sh ip route 5.5.5.5
Routing entry for 5.5.5.5/32
Known via “connected”, distance 0, metric 0 (connected, via interface)
Advertised by odr
Routing Descriptor Blocks:
* directly connected, via Loopback5
Route metric is 0, traffic share count is 1
R5(config-router)#network 5.5.5.5 mask 255.255.255.255
R5(config-router)#
ASR#1
[Resuming connection 1 to r1 … ]
*Mar 31 01:54:19.844: %BGP-5-ADJCHANGE: neighbor 172.12.15.5 Up
R1(config-router)#do sh ip bgp
BGP table version is 3, 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
r> 5.5.5.5/32 172.12.15.5 0 0 500 i
GAH! Ok, this is getting solved right meow, time for some Google-fu.
So after some research on this, I found this really good command to know when dealing with any sort of RIB failure message for BGP (and possibly other protocols):
R1#sh ip bgp rib-failure ?
| Output modifiers
<cr>
R1#sh ip bgp rib-failure
Network Next Hop RIB-failure RIB-NH Matches
5.5.5.5/32 172.12.15.5 Higher admin distance n/a
AH HA!!!! GOT YA!!! I should have known your tricky ways BGP, I should have known.
So upon googling eBGP’s default administrative distance it is 20 (not to be confused with iBGP’s of 200), and I had a static route set with no admin distance specified so it of course defaults to 1, so it goes like this:
R1(config)#no ip route 5.5.5.5 255.255.255.255 172.12.15.5
R1(config)#ip route 5.5.5.5 255.255.255.255 172.12.15.5 21
And then like this:
R1(config)#do sh ip bgp
BGP table version is 5, 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 32768 i
*> 5.5.5.5/32 172.12.15.5 0 0 500 i
R1(config)#
HA! HAHAHAAHAAAAAAAA!!!!!! Making the static route to the remote BGP loopback an AD of 21 allows it to be in the route table instead of the static route.
This is why I stress always using more than one option for studying any given topic, google, youtube, RFC’s, etc. I cannot believe that is what was choking it up and it wasn’t mentioned in the training videos at all, I guess that is how you learn đŸ™‚
So I added the loopback neighboring stuff right on back almost from memory, here is the long output of getting them both back on track:
R1(config)#router bgp 100
R1(config-router)#no nei 172.12.15.5 remote-as 500
R1(config-router)#
*Mar 31 02:13:44.088: %BGP-5-ADJCHANGE: neighbor 172.12.15.5 Down Neighbor deleted
R1(config-router)#nei 5.5.5.5 remote-as 500
R1(config-router)#nei 5.5.5.5 ebgp-m
R1(config-router)#nei 5.5.5.5 ebgp-multihop 5
R1(config-router)#neighbor 5.5.5.5 update-source Loopback1
R1(config-router)#^Z
R1#
*Mar 31 02:14:39.676: %SYS-5-CONFIG_I: Configured from console by console
R1#wr
Building configuration…
ASR#5
[Resuming connection 5 to r5 … ]
*Apr 11 03:24:43.867: %BGP-5-ADJCHANGE: neighbor 172.12.15.1 Down Peer closed the session
*Apr 11 03:24:43.867: %BGP_SESSION-5-ADJCHANGE: neighbor 172.12.15.1 IPv4 Unicast topology base removed from session Peer closed the session
R5(config-router)#no neighbor 172.12.15.1 remote-as 100
R5(config-router)#nei 1.1.1.1 remote-as 100
R5(config-router)#nei 1.1.1.1 ebgp-multihop 5
R5(config-router)#
*Apr 11 03:27:15.891: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up
R5(config-router)#nei 1.1.1.1 update-source Loopback5
R5(config-router)#^Z
R5#sh ip bgp summ
BGP router identifier 5.5.5.5, local AS number 500
BGP table version is 7, main routing table version 7
2 network entries using 240 bytes of memory
2 path entries using 104 bytes of memory
2/2 BGP path/bestpath attribute entries using 248 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 616 total bytes of memory
BGP activity 3/1 prefixes, 3/1 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
1.1.1.1 4 100 5 5 7 0 0 00:00:36 1
R5#sh ip bgp nei
BGP neighbor is 1.1.1.1, remote AS 100, external link
BGP version 4, remote router ID 1.1.1.1
BGP state = Established, up for 00:01:02
Things are looking good, lets see it:
R5#sh ip bgp
BGP table version is 7, local router ID is 5.5.5.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
r> 1.1.1.1/32 1.1.1.1 0 0 100 i <—- Need to redo R5’s static route
*> 5.5.5.5/32 0.0.0.0 0 32768 i
R5#conf t
R5(config)#no ip route 1.1.1.1 255.255.255.255 172.12.15.1
R5(config)#ip route 1.1.1.1 255.255.255.255 172.12.15.1 21
R5(config)#exit
One more time!!! :
R5#sh ip bgp
BGP table version is 10, local router ID is 5.5.5.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
*> 1.1.1.1/32 1.1.1.1 0 0 100 i
*> 5.5.5.5/32 0.0.0.0 0 32768 i
R5#
Success!!
However of course when I look back at my console screen I find this:
R5#
*Apr 11 03:31:27.247: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Down BGP Notification sent
*Apr 11 03:31:27.247: %BGP-3-NOTIFICATION: sent to neighbor 1.1.1.1 4/0 (hold time expired) 0 bytes
R5#
*Apr 11 03:31:27.247: %BGP_SESSION-5-ADJCHANGE: neighbor 1.1.1.1 IPv4 Unicast topology base removed from session BGP Notification sent
R5#
*Apr 11 03:31:38.531: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up
R5#
*Apr 11 03:34:38.735: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Down BGP Notification sent
*Apr 11 03:34:38.735: %BGP-3-NOTIFICATION: sent to neighbor 1.1.1.1 4/0 (hold time expired) 0 bytes
R5#
*Apr 11 03:34:38.735: %BGP_SESSION-5-ADJCHANGE: neighbor 1.1.1.1 IPv4 Unicast topology base removed from session BGP Notification sent
R5#
*Apr 11 03:34:51.043: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up
R5#
Once again, gah.
Wait, I thunk I just had an idea, one last stab at this, as I have to stop myself from studying all night. What if I just remove that stinking, I mean static route from the route table all together on both routers? Then there is no Administrative Distance to fight over:
R1(config)#no ip route 5.5.5.5 255.255.255.255 172.12.15.5
R1(config)#
ASR#5
[Resuming connection 5 to r5 … ]
R5(config)#no ip route 1.1.1.1 255.255.255.255 172.12.15.1
R5(config)#no router bgp 500
R5(config)#router bgp 500
R5(config-router)#neighbor 172.12.15.1 remote-as 100
R5(config-router)#
ASR#1
[Resuming connection 1 to r1 … ]
R1(config)#router bgp 100
R1(config-router)#neighbor 172.12.15.5 remote-as 500
R1(config-router)#
*Mar 31 02:48:53.118: %BGP-5-ADJCHANGE: neighbor 172.12.15.5 Up
R1(config-router)#network 1.1.1.1 mask 255.255.255.255
R1(config-router)#
ASR#5
[Resuming connection 5 to r5 … ]
*Apr 11 03:59:53.199: %BGP-5-ADJCHANGE: neighbor 172.12.15.1 Up
R5(config-router)#network 5.5.5.5 mask 255.255.255.255
R5(config-router)#exit
R5(config)#exit
R5#
*Apr 11 04:00:49.851: %SYS-5-CONFIG_I: Configured from console by console
R5#
Oooooh I so don’t even want to type the command to see what happens but here we go:
R5#sh ip bgp
BGP table version is 3, local router ID is 5.5.5.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
*> 1.1.1.1/32 172.12.15.1 0 0 100 i
*> 5.5.5.5/32 0.0.0.0 0 32768 i
R5#
OMG, AND LOGIC WINS!!!! BWAAAAHAHAHAHAAAAAAHAHAHAAA!!!!!!
So now we also have BGP routes in our route table as well:
R5#sh ip route
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
B 1.1.1.1 [20/0] via 172.12.15.1, 00:11:48
4.0.0.0/32 is subnetted, 1 subnets
S 4.4.4.4 [1/0] via 172.12.15.1
5.0.0.0/32 is subnetted, 1 subnets
C 5.5.5.5 is directly connected, Loopback5
172.12.0.0/16 is variably subnetted, 3 subnets, 2 masks
C 172.12.15.0/24 is directly connected, FastEthernet0/1
L 172.12.15.5/32 is directly connected, FastEthernet0/1
S 172.12.123.0/24 [1/0] via 172.12.15.1
R5#
With that I am content with my progress, and going to wr mem and power down before anything else starts to break, next up will be a quick informative post about BGP Attributes before later diving head first into the subject matter, wooOOO!!!!