BGP Next hop self

Scenario:

As a junior networking engineer you were always fascinated with science fiction movies, that’s why you are now working at a company specialized in special effects. The closest you got to light speed was sending bits and bytes with electricity through wires…nevertheless there is a task waiting for you. You need to configure BGP between your network (AS100) and the service provider (AS200). Setting up BGP was no problem for you, but users behind router Luke are complaining they can’t access networks in AS 200. Time for you to solve this problem…you feel the force is strong within you so this should be a piece of cake!

Goal:

  • All IP addresses have been preconfigured as specified in the topology picture.
  • Configure IBGP between router Hansolo and Luke, use AS 100, use the loopback0 interfaces as source for BGP.
  • Configure EBGP between router Hansolo and Leia.
  • Ensure both BGP neighbor relationships are up.
  • Router HanSolo: Advertise the 192.168.12.0/24 network into BGP.
  • Router Leia: Advertise the 3.3.3.0 /24 on the loopback interface into BGP.
  • Ensure you can ping this network from router Hansolo.
  • Try to ping this network from router Luke, why does this fail?
  • Fix this problem by using a BGP command on router Hansolo. You are not allowed to advertise the 192.168.13.X network in BGP.

It took me 1000s of hours reading books and doing labs, making mistakes over and over again until I mastered all the routing protocols for CCNP.

Would you like to be a master of routing too? In a short time without having to read 900 page books or google the answers to your questions and browsing through forums?

I collected all my knowledge and created a single ebook for you that has everything you need to know to become a master of routing.

You will learn all the secrets about BGP, next hop behavior and more.

Does this sound interesting to you? Take a look here and let me show you how to Master CCNP ROUTE

IOS:

c3640-jk9s-mz.124-16.bin

Topology:

BGP Next Hop Self

Video Solution:

Configuration Files

You need to register to download the GNS3 topology file. (Registration is free!)

Once you are logged in you will find the configuration files right here.

Opt In Image
Do you want your CCNA or CCNP Certificate?

The How to Master series helps you to understand complex topics like spanning-tree, VLANs, trunks, OSPF, EIGRP, BGP and more.

Written by René Molenaar - CCIE #41726

Comments

  1. Profile photo of Rene Molenaar says

    Try a show ip bgp on router Luke. It’ll show you the next-hop address for the network router Leia is advertising.

    Now take a look and see if this next-hop address if reachable….it probably isn’t.

    There are 2 ways to fix this:

    1) Make the next-hop reachable by using a static or routing protocol.
    2) Use next-hop-self on router HanSolo so the next-hop address for router Luke changes.

    Good luck!

    Rene

  2. Profile photo of lcguy says

    router bgp 100
    no synchronization
    bgp log-neighbor-changes
    neighbor 192.168.12.3 remote-as 200
    neighbor 192.168.23.2 remote-as 100
    neighbor 192.168.23.2 next-hop-self
    no auto-summary

    ——–
    Still can’t figure out how to reach 1.1.1.1.
    Even trying with static router also failed
    next hop address in Router Luke show correctly as below

    BGP table version is 8, local router ID is 192.168.23.2
    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
    *>i1.1.1.0/24 192.168.23.1 0 100 0 200 i

    Report user
  3. Profile photo of Rene Molenaar says

    Keep in mind that you need to check all the BGP routers ‘Routing Tables’. Perhaps you only have ‘one way’ reachability and the ip packets don’t know their way back…

    Check every routing table and see if you have full reachability.

  4. Profile photo of Sebastian says

    Hey I fired up tha lab and it is working like I thought. I entered the next hop self command on hansolo. So if I ping the network 1.1.1.1 from Luke it failed because there it no way back on Leia. Leia does not know how to reach Luke.

    My solution fire up a default route or : ip route 192.168.23.0 255.255.255.0 s0/0 . I am right?

    Report user
  5. Profile photo of Rene Molenaar says

    @Sebastian,

    Uh-oh shame on you for using default / static routes in a BGP lab! ;D

    I changed the lab task to make sure to advertise 192.168.23.0 into BGP, otherwise router Leia will indeed not know the way back to router Luke.

    Rene

  6. Profile photo of Verica says

    Hi Rene,

    I have one question about this Lab…

    When you trying to ping Lo 3.3.3.3 from Luke it works. I was wondering what do you suggest in the other way: when you try to ping Lo 2.2.2.2 from Leia? I tried with advertising first that network 2.2.2.0 from Luke and then with advertising the network 192.168.13.0 from HanSolo. And the ping from Leia to Lo 2.2.2.2 then works. :) I just wanna know if that’s ok and the appropriate way for this situation? I mean does it make sense if I do something like that?

    Thanks in advance! ;)

    Veka;D;D;D;D;D

    Report user
    • Profile photo of Rene Molenaar says

      Hi Veka,

      You already know the answer but just for anyone else that is wondering…

      When a router learns something through EBGP and advertises it through IBGP to routers in the same AS it will not change the next-hop IP address. This can sometimes cause issues with reachability if the next-hop IP address is not reachable.

      Best way to solve and check what is going on is to use the "show ip bgp" command to see the advertised network(s) and the next-hop IP address. Next step is to make sure the next-hop IP address is reachable. If it’s not we need to advertise additional networks and/or use the "next-hop-self" command to change the next-hop IP address.

  7. Profile photo of Balister kumar says

    Hi Rene

    I was working on this lab, every thing was perfect. however i dont understand why did you say "Router HanSolo: Advertise the 192.168.12.0/24 network into BGP."
    I also checked and found that without network 192.168.12.0/24 " its impossible to reach to 3.3.3.3 from Router Luke.

    If our final task to put everything into BGP then why do we use Internal routing protocol to support BGP. when we know that rules like Split horizon and synchronization also working in BGP.
    we can also do redistribution to achieve this task or do only BGP on all router.

    Report user
    • Profile photo of Rene Molenaar says

      Hi,

      [quote]I was working on this lab, every thing was perfect. however i dont understand why did you say "Router HanSolo: Advertise the 192.168.12.0/24 network into BGP."
      I also checked and found that without network 192.168.12.0/24 " its impossible to reach to 3.3.3.3 from Router Luke.[/quote]

      You need to do this because router Leia will receive IP packets with a source address of the 192.168.12.0/24 subnet. If you don’t advertise this network Leia has no idea where to return the IP packets to.

      [quote]If our final task to put everything into BGP then why do we use Internal routing protocol to support BGP. when we know that rules like Split horizon and synchronization also working in BGP.
      we can also do redistribution to achieve this task or do only BGP on all router.[/quote]

      An IGP is commonly used for BGP because for IBGP because of two reasons:

      – IBGP has to be full mesh so you have to configure BGP neighbors with all routers, not just the neighbors that are directly connected. Without a routing protocol your router only knows about it’s "directly connected" networks so we need to use an IGP like OSPF so it can learn about other networks so we can configure IBGP peerings between all routers.

      – For IBGP it’s best practice to configure the BGP peering between loopback interfaces. Physical interfaces can go do down and this will kill our BGP peering. If we use loopbacks we have an IGP to calculate another route to the loopback interface.

      Does that make sense?

      Best Regards,

      Rene

  8. Profile photo of Emill says

    Hello Rene. First off, let me thank you for all your hard work and dedication. I wanted to solve this a bit differently and what I did is I advertised 2.2.2.2 from Luke in BGP and also set a default route out to 192.168.12.1 . This gave me the ability to reach 3.3.3.3 from Luke and also allowed me to ping luke from Leia. Was that Bad??

    Report user
  9. Profile photo of mansoor says

    [size=medium][size=small]CAN ANY ONE PLZ HELP ME what i can not ping LUKE and LISA from each other if i just use bgp to make neighpour and attvise loopback of of luke and leisa

    [b]HanSolo[/b](config-router)# do sh runn | sec bgp
    router bgp 100
    no synchronization
    bgp log-neighbor-changes
    neighbor 192.168.12.2 remote-as 100
    neighbor 192.168.12.2 next-hop-self
    neighbor 192.168.13.3 remote-as 200
    no auto-summary

    HanSolo(config)#do sh ip route
    Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
    D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
    N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
    E1 – OSPF external type 1, E2 – OSPF external type 2
    i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
    ia – IS-IS inter area, * – candidate default, U – per-user static route
    o – ODR, P – periodic downloaded static route

    Gateway of last resort is not set

    C 192.168.12.0/24 is directly connected, FastEthernet1/0
    1.0.0.0/24 is subnetted, 1 subnets
    C 1.1.1.0 is directly connected, Loopback0
    C 192.168.13.0/24 is directly connected, Serial0/0
    2.0.0.0/24 is subnetted, 1 subnets
    B 2.2.2.0 [200/0] via 192.168.12.2, 01:36:33
    3.0.0.0/24 is subnetted, 1 subnets
    B 3.3.3.0 [20/0] via 192.168.13.3, 00:05:19

    HanSolo#sh ip bgp
    BGP table version is 13, 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
    *>i2.2.2.0/24 192.168.12.2 0 100 0 i
    *> 3.3.3.0/24 192.168.13.3 0 0 200 i

    ———————————————————-

    Luke(config-router)#do sh runn | sec bgp
    router bgp 100
    no synchronization
    bgp log-neighbor-changes
    network 2.2.2.0 mask 255.255.255.0
    neighbor 192.168.12.1 remote-as 100
    no auto-summary

    Luke(config-router)#do sh ip route
    Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
    D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
    N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
    E1 – OSPF external type 1, E2 – OSPF external type 2
    i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
    ia – IS-IS inter area, * – candidate default, U – per-user static route
    o – ODR, P – periodic downloaded static route

    Gateway of last resort is not set

    C 192.168.12.0/24 is directly connected, FastEthernet0/0
    2.0.0.0/24 is subnetted, 1 subnets
    C 2.2.2.0 is directly connected, Loopback0
    3.0.0.0/24 is subnetted, 1 subnets
    B 3.3.3.0 [200/0] via 192.168.12.1, 00:04:55

    Luke#sh ip bgp
    BGP table version is 13, local router ID is 2.2.2.2
    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
    *> 2.2.2.0/24 0.0.0.0 0 32768 i
    *>i3.3.3.0/24 192.168.12.1 0 100 0 200 i

    ——————————————————————

    Leia(config-router)#do sh runn | sec bgp
    router bgp 200
    no synchronization
    bgp log-neighbor-changes
    network 3.3.3.0 mask 255.255.255.0
    neighbor 192.168.13.1 remote-as 100
    no auto-summary

    Leia(config-router)#do sh ip route
    Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
    D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
    N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
    E1 – OSPF external type 1, E2 – OSPF external type 2
    i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
    ia – IS-IS inter area, * – candidate default, U – per-user static route
    o – ODR, P – periodic downloaded static route

    Gateway of last resort is not set

    C 192.168.13.0/24 is directly connected, Serial0/0
    2.0.0.0/24 is subnetted, 1 subnets
    B 2.2.2.0 [20/0] via 192.168.13.1, 00:02:00
    3.0.0.0/24 is subnetted, 1 subnets
    C 3.3.3.0 is directly connected, Loopback0[/size][/size]

    Leia#sh ip bgp
    BGP table version is 21, local router ID is 3.3.3.3
    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
    *> 2.2.2.0/24 192.168.13.1 0 100 i
    *> 3.3.3.0/24 0.0.0.0 0 32768 i

    Report user
  10. Profile photo of Cornel says

    for y_mansoor…the problem in your configuration is that except for the 2.2.2.2 and 3.3.3.3 loopbacks you don’t advertise the 192.168.xx. networks (or static routes)…..so Luke doesn’t know about the 192.168.13 network and Leia doesn’t know about the 192.168.12 network

    Report user
  11. Profile photo of Mazhar says

    though added 3.3.3.0/24 net in BGP, not able to ping end to end by loopback addresses and no reflection of it showing in Luke as well…..after adding .13 network in BGP, only interface ip ping works end to end…….any suggestion…..??

    Luke#sh ip route
    Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
    D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
    N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
    E1 – OSPF external type 1, E2 – OSPF external type 2
    i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
    ia – IS-IS inter area, * – candidate default, U – per-user static route
    o – ODR, P – periodic downloaded static route

    Gateway of last resort is not set

    C 192.168.12.0/24 is directly connected, FastEthernet0/0
    1.0.0.0/32 is subnetted, 1 subnets
    C 1.1.1.1 is directly connected, Loopback0
    B 192.168.13.0/24 [200/0] via 2.2.2.2, 00:08:39
    2.0.0.0/32 is subnetted, 1 subnets
    O 2.2.2.2 [110/11] via 192.168.12.2, 00:27:40, FastEthernet0/0

    Leia#sh ip bgp
    BGP table version is 3, local router ID is 3.3.3.3
    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
    *> 192.168.12.0 192.168.13.2 0 0 100 i
    *> 192.168.13.0 0.0.0.0 0 32768 i
    Leia#sh ip route
    Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
    D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
    N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
    E1 – OSPF external type 1, E2 – OSPF external type 2
    i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
    ia – IS-IS inter area, * – candidate default, U – per-user static route
    o – ODR, P – periodic downloaded static route

    Gateway of last resort is not set

    B 192.168.12.0/24 [20/0] via 192.168.13.2, 00:24:31
    C 192.168.13.0/24 is directly connected, Serial0/0
    3.0.0.0/32 is subnetted, 1 subnets
    C 3.3.3.3 is directly connected, Loopback0

    HanSolo#sh ip route
    Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
    D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
    N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
    E1 – OSPF external type 1, E2 – OSPF external type 2
    i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
    ia – IS-IS inter area, * – candidate default, U – per-user static route
    o – ODR, P – periodic downloaded static route

    Gateway of last resort is not set

    C 192.168.12.0/24 is directly connected, FastEthernet1/0
    1.0.0.0/32 is subnetted, 1 subnets
    O 1.1.1.1 [110/2] via 192.168.12.1, 00:27:11, FastEthernet1/0
    C 192.168.13.0/24 is directly connected, Serial0/0
    2.0.0.0/32 is subnetted, 1 subnets
    C 2.2.2.2 is directly connected, Loopback0

    Report user
  12. Profile photo of Rowon1234 says

    Hi all
    I used the loopbacks for the eBGP connexion as well. All the BGP connexions were established.
    For the IGP Iused EIGRP and I advertised the 192.168… networks as well as the three loopbacks.
    When i configured the BGP and I advertised 3.3.3.0/24 into BGP on Leila, i couldn’t indeed ping 3.3.3.3 from Luke.
    But what was strange is that even if the BGP route didn’t appear on Luke, the EIGRP route for 3.3.3.0/24 disappeared from it.
    Can anyone explain why ?
    Regards

    Report user
    • Profile photo of Nicholas Russo says

      Without seeing your config, I am guessing that HanSolo was preferring eBGP route to 3.3.3.0/24 over the EIGRP internal route (20 vs 90) and installed the eBGP route in its routing table. EIGRP and RIP, by their distance vector nature, cannot advertise any route that is not currently installed in the routing table. Why would a protocol that relies on “routing by rumor” pass on a route if the router itself did not trust it sufficiently to use it?

      Report user
      • Profile photo of Rowon1234 says

        Hi Nick42518
        Thanks for your reply.
        Actually, i didn’t see neither the BGP route nor the EIGRP route in the routing table.
        What is more, the EIGRP route would appear and disapear over the time.
        I will send the configuration soon.
        regards

        Report user
        • Profile photo of Nicholas Russo says

          That sounds odd. Check your computer for memory or CPU constraint. I have seen GNS3 become very unreliable when the host resources are low. Other small things to check are things like EIGRP auto summary, EIGRP Q count (should be 0, if not, make sure no unicast issues across the link), etc.

          Report user
  13. ABhi says

    for this scenario could you please tell me if i dont want to use NEXT-HOP-SELF command then what is the exact command i should use.

    • Profile photo of Nicholas Russo says

      There are different ways to do it. You could ensure the other iBGP routers have IGP routes to the next hop, you could use a route-map with “set ip next-hop”, applied outbound to your iBGP peers, or just use next-hop-self.

      Report user

Leave a reply:

Your email address will not be published. Required fields are marked *

If you have any technical questions, please use the Forum instead of posting a comment.