Saturday, July 25, 2015

BGP troubleshooting - (bgp redistribute-internal)


This exercise was first post by Arwin Reprakash (http://ithitman.blogspot.com/2013/03/bgp-troubleshooting-lab.html). I took his post and found a way to resolve the problem

The diagrams and original idea belongs to Arwin Reprakash, please check the above link to see more details

  

THE PROBLEM

The goal is to ping 11.11.11.11 from R4


THE SOLUTION

Fist let's check if R1 is advertising its loopback to R4

R1#show run | section ospf
 router ospf 1
 redistribute connected subnets route-map lo-2-ospf
 network 1.1.1.1 0.0.0.0 area 0

From the output we can see that there is a route-map filter when R1 advertise its connected subnets. So let's check  the route-map
 
R1#show route-map                
route-map lo-2-ospf, permit, sequence 10
  Match clauses:
    ip address prefix-lists: lo-2-ospf
  Set clauses:
  Policy routing matches: 0 packets, 0 bytes
 
 
This output shows that no packets were filter by the route-map (0 packets, 0 bytes). So the next step is to check the prefix-list inside the route-map
 
R1#show run | section prefix  
ip prefix-list lo-2-ospf seq 10 permit 11.11.11.0/24
 match ip address prefix-list lo-2-ospf
 
The prefix-list will allow any route from 11.11.11.0/24 to pass the filter. So the next step is to know if we have that route in our routing table
 
R1#show ip route 11.11.11.0 255.255.255.0
% Subnet not in table

We can't filter a route that we don't have. That's why the packets never hit the roupe-map and nothing is advertised. What we really need is to include 11.11.11.11/32 into the prefix-list because that's the ip address of l0. So we need to open the range of the prefix-list to include the mask 255.255.255.255
 
R1(config)#no ip prefix-list lo-2-ospf seq 10 permit 11.11.11.0/24
R1(config)#ip prefix-list lo-2-ospf seq 10 permit 11.11.11.0/24 le 32


Now let's check if R2 finally got the route to 11.11.11.11

R2#show ip route
      11.0.0.0/32 is subnetted, 1 subnets
O E2     11.11.11.11 [110/20] via 1.1.1.1, 00:04:14, GigabitEthernet0/1


Everything is ok, now let's check if R2 is advertising 11.11.11.11 to 2.2.2.3 (R3)
 
 R2#show ip bgp neighbors 2.2.2.3 advertised-routes
     Network          Next Hop            Metric LocPrf Weight Path
 *>  11.11.11.11/32   1.1.1.1                 20         32768 ?
 
 
R2 is advertising 11.11.11.11 ok but it is setting the next hop as 1.1.1.1. that's a problem cause R1 has no route to 1.1.1.1 so 11.11.11.11 will never be installed into R3's routing table. We can check that with the following commands
 
 
R3#show ip route bgp  (no bgp routes)
 
R3#show ip route 1.1.1.1
% Network not in table
 
Let's replace "next hop 1.1.1.1" with "next hop 2.2.2.2". R2's local ip address 2.2.2.2
 
R2(config)#router bgp 2
R2(config-router)#neighbor 2.2.2.3 next-hop-self
 
 
Let's check if R3 finally has the route to 11.11.11.11
 
R3#show ip route
      11.0.0.0/32 is subnetted, 1 subnets
B        11.11.11.11 [200/20] via 2.2.2.2, 00:00:29
 
 
Everything is ok. Now let's see if R3 is advertising 11.11.11.11 to R4
 
 
R3#show run | section ospf
router ospf 1
 redistribute bgp 2 subnets route-map bgp-2-ospf
 network 3.3.3.0 0.0.0.255 area 0
ip prefix-list bgp-2-ospf seq 10 permit 11.11.11.11/32
route-map bgp-2-ospf permit 10
 match ip address prefix-list bgp-2-ospf
 
 
All is ok but the route is not installed yet into R4. let's check that with the following commands
 
 
R3#show route-map
route-map bgp-2-ospf, permit, sequence 10
  Match clauses:
    ip address prefix-lists: bgp-2-ospf
  Set clauses:
  Policy routing matches: 0 packets, 0 bytes
 
 
R3#show ip ospf database external
            OSPF Router with ID (192.168.0.3) (Process ID 1)
 
 
So if everything is ok why the IBGP route 11.11.11.11 is not redistributed into OSPF?
 
You should remenber the following rule
 
 
 
Internal BGP (iBGP) routes are not, by default, redistributed into any IGP

 
 
To change this default behaviour in BGP we must use "redistribute-internal"
 
 
R3(config-router)#bgp redistribute-internal
 
 
Finally let's check is the route is installed in R4 and if we can do ping
 


R4#show ip route
O E2 11.11.11.11 [110/1] via 3.3.3.3, 00:00:16, GigabitEthernet0/1


R4#ping 11.11.11.11
Sending 5, 100-byte ICMP Echos to 11.11.11.11, timeout is 2 seconds:
!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/5 ms

 
 
 
I use cisco virl for these labs but i think they will work ok in GNS3 too.

Please leave your feedback
  

1 comment: