How to Read the BGP Table

(sachin v) #21

Hi Rene,

Firstly I appreciate your knowledge and skills to explain topics in easy way.

My question is we are observing two paths to reach network on R3 router and just one path from R2. Both of them are just one hop away so why this difference is seen in two outputs. Please reply to this question…

(Rene Molenaar) #22

Hi Sachin,

The answer is in the output of R1:

R1#show ip bgp
BGP table version is 2, local router ID is
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
*                           0 3 4 i
*>                                   0 2 4 i

It has installed R2 as the best path to get to, so it doesn’t advertise the route through to R2.


(Aduma O) #23

Hi Rene,

Thank you for the lesson. I set up your topology and ran the configuration but the routers did not learn BGP route until i added the command “Network x.x.x.x Mask x.x.x.x” for each router for connecting network. Is it suppose to be so?

(Lazaros Agapides) #24

Hello Aduma

Yes, that is the case. Notice in Rene’s initial configuration, the routers become BGP neighbors but there is only a single route being advertised between the four routers, that is the network on R4. If you go into all the BGP tables of all the routers, only that route will be indicated.

So unless you explicitly configure the network command, no routes will be advertised.

I hope this has been helpful!


(Aduma O) #25

Thanks Laz, your explanation is helpful.

(samit k) #26

Hi Rene, i have also the same question, could you please explain

(Lazaros Agapides) #27

Hello Samit and Tejashri

This is a very good question. That’s why I labbed this one up and in the routers that I set up, it seems that R1, R2 and R3 all have two routes to the destination. I don’t see why R2 should only have one route. I’ll ask Rene to take a look at this one and if needed, the lesson can be modified appropriately.

Thanks for bringing it up!


(Rene Molenaar) #28

Hello @samit.nsn @tejashreedeshmukh021 @lagapides,

It makes sense why R2 only has one route. Let’s take a look:

R1#show ip bgp           

     Network          Next Hop            Metric LocPrf Weight Path
 *                           0 3 4 i
 *>                                     0 2 4 i

R1 has two paths, one through R2 and another one through R3. The one through R2 is installed so that’s why R1 never advertises the path through R3 to R2:

R1#show ip bgp neighbors advertised-routes 

     Network          Next Hop            Metric LocPrf Weight Path
 *>                           0 2 4 i

Total number of prefixes 1 

You can test this by changing the weight so R1 prefers R3:

R1(config)#route-map PREFER_R3 permit 10
R1(config-route-map)#set weight 1000

R1(config)#router bgp 1
R1(config-router)#neighbor route-map PREFER_R3 in

R1 now uses R3:

R1#show ip bgp 

     Network          Next Hop            Metric LocPrf Weight Path
 *>                        1000 3 4 i
 *                                      0 2 4 i

The path through R3 is installed and R1 advertises it to R2:

R1#show ip bgp neighbors advertised-routes 

     Network          Next Hop            Metric LocPrf Weight Path
 *>                        1000 3 4 i

R2 has it now:

R2#show ip bgp

     Network          Next Hop            Metric LocPrf Weight Path
 *                           0 1 3 4 i
 *>                       0             0 4 i

I hope this helps!


(Dominique R) #29

hi René and staff,
this is a basic question about this lesson (sorry)
Using looking glass servers, I don’t understand how you could filter the routes with | exclude *
What symbol did you use ?

(Lazaros Agapides) #30

Hello Dominique

You are correct that this should not work. This is because the ‘*’ character is a special character used in regular expressions and cannot be used as a single character pattern to be searched for and found. In order to make it work, you must precede each character with a backslash ‘’. The command would work if you entered

show ip bgp | exclude \*

More details about this syntax can be found on the second page of the following Cisco documentation:

I will let Rene know to revise the lesson appropriately.

Thanks for bringing this to our attention!


(Rene Molenaar) #31

Hi Dominique,

I did the exclude example in my lesson on a Cisco router where the exclude parameter looks for a string. The looking glass server you used requires a regular expression and in that case, you need to ignore the * with a slash like @lagapides explained.

On a Cisco router, you can also use regex but you have to specify it like this:

route-server.ams2>show ip bgp regexp \*

Hope this helps!


(Dominique R) #32

Thanks a lot Rene and Laz to spend time in replying me,

I am playing with looking glass servers and show ip bgp regexp \* don’t work as show ip bgp | exclude \*

exclude \* is filtering valid routes from output (so you will get only lines with d and h from the output)
but regexp \* seems not to apply in this case (filtering valid routes) because it only filters on the AS path (and not on valid routes)
So, and again sorry about that, but i dont understand your reply
And when playing with looking glass servers, i wonder how to filter on other attributes like metric, weight, …i don’t know if it is a legitimate question, and i did not find the answser yet

(Fritz M) #33

Hi Rene,

I tried to lab your given example, I would like to confirm with you why is not reachable in R1? Even I tried to advertised in R2 and in R3.

Best Regard,
Fritz Macahilig

Network Diagram

(Dominique R) #34

i am not Rene neither his staff, but i think
to understand your question, you will have to put the configs of the routers in your lab (not only the network diagram)
Then I’ll try to answer

(Rene Molenaar) #35

Hello Dominique,

Are you still having issues with this? Like you mentioned, regex for BGP only works for AS numbers:>show ip bgp regexp ?
  LINE  A regular-expression to match BGP AS paths. Use "ctrl-v ?" to enter "?"

If you want to filter anything else then you should use the “include” command instead. You can also use regex for the include command. For example:>show ip bgp | include _10_
*            10             0 7474 4826 13335 i
*                  10             0 7474 4826 38803 56203 i
*                  10             0 7474 4826 38803 56203 i

The example above applies regex to the entire output of the show command. You can get pretty creative with that.

The things you can do a on a looking glass server are limited. On your own routers, you can also combine show ip bgp with a route-map if you want to see specific things:

show ip bgp route-map ?
  WORD  A route-map to match on

Does this help?


(Rene Molenaar) #36

Hi Fritz ,

Did you use my exact configs? If not, it’s best to paste the output of your BGP tables here.