Saturday, February 5, 2011

BGP (using next-hop-self)

After reading BGP, I was stopped for a while how to use "next-hop-self". If you still have same problem, below simple lab will help you, I believe.

Try to reach external networks (1.1.1.1) and (2.2.2.2) injected from R1 (AS 5500) from R3. Do not announce 200.100.10.0/24 network in AS 5000.

Download full GNS3 lab from https://docs.google.com/leaf?id=0B889ogd4ltI2YTM4OGE4MGUtZDYwNi00NDE0LTkxMTItYzJlMTcwNTYyZWNl&hl=en&authkey=CPi_26EP
























R1' BGP status.

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
200.100.10.2    4  5000      10      12        3    0    0 00:06:18        0
--------
     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback1
     2.0.0.0/32 is subnetted, 1 subnets
C       2.2.2.2 is directly connected, Loopback2
C    200.100.10.0/24 is directly connected, Serial1/0
===========================================
R2.

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.1.3     4  5000       0       0        0    0    0 never    Active
200.100.10.1    4  5500      14      12        3    0    0 00:04:12        2
-------------------
     1.0.0.0/32 is subnetted, 1 subnets
B       1.1.1.1 [20/0] via 200.100.10.1, 00:05:59
     2.0.0.0/32 is subnetted, 1 subnets
B       2.2.2.2 [20/0] via 200.100.10.1, 00:04:59
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    200.100.10.0/24 is directly connected, Serial1/0
---------

R2#sh ip bgp
BGP table version is 3, local router ID is 200.100.10.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
*> 1.1.1.1/32       200.100.10.1             0             0 5500 i
*> 2.2.2.2/32       200.100.10.1             0             0 5500 i
======================================
R3.
R3#sh ip bgp
BGP table version is 1, local router ID is 192.168.1.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
* i1.1.1.1/32       200.100.10.1             0    100      0 5500 i
* i2.2.2.2/32       200.100.10.1             0    100      0 5500 i
-----
There is no best route. To fix this two things need to do; one is announce the network 192.168.1.0/4 in R2 and R3 using BGP or other routing protocol.

Second, configure R2 as next hop self addresss for R3.
-----
Action in R2 as follow.
R2(config-router)#neighbor 192.168.1.3 next-hop-self

Result showing in R3 as follow.
R3#sh ip bgp
BGP table version is 1, local router ID is 192.168.1.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
* i1.1.1.1/32       200.100.10.1             0    100      0 5500 i
* i2.2.2.2/32       200.100.10.1             0    100      0 5500 i
R3#sh ip bgp
BGP table version is 3, local router ID is 192.168.1.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
*>i1.1.1.1/32       192.168.1.2              0    100      0 5500 i
*>i2.2.2.2/32       192.168.1.2              0    100      0 5500 i
(Best route appear in R3) but you can't ping to 1.1.1.1. Why?
It need to announce 192.168.1.0/24 as IGBP between R2 and R3.
In R2 announce the network as follow.
R2(config)#router bgp 5000
R2(config-router)#net
R2(config-router)#network 192.168.1.0 255.255.255.0
-------------
In R3...
R3(config)#router bgp 5000
R3(config-router)#network 192.168.1.0 mask 255.255.255.0
=====================================================
Check the  BGP routing tables in R2.

R2#sh ip bgp
BGP table version is 4, local router ID is 200.100.10.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
*> 1.1.1.1/32       200.100.10.1             0             0 5500 i
*> 2.2.2.2/32       200.100.10.1             0             0 5500 i
* i192.168.1.0      192.168.1.3              0    100      0 i
*>                  0.0.0.0                  0         32768 i
------------------------
In R3 BGP routing table.
R3#sh ip bgp
BGP table version is 6, local router ID is 192.168.1.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
*>i1.1.1.1/32       192.168.1.2              0    100      0 5500 i
*>i2.2.2.2/32       192.168.1.2              0    100      0 5500 i
*> 192.168.1.0      0.0.0.0                  0         32768 i
* i                 192.168.1.2              0    100      0
-----------
Best route and (i) internal route will appear and BGP will know how to route to two external routers (1.1.1.1) and (2.2.2.2)
Testing by pining.
-----
R3#ping 2.2.2.2


Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/16/28 ms


R3#traceroute 2.2.2.2


Type escape sequence to abort.
Tracing the route to 2.2.2.2


  1 192.168.1.2 16 msec 20 msec 8 msec
  2 200.100.10.1 12 msec 8 msec *
===========================================
Using this topology will achive both IBGP and EBGP, how to use next-hop-self and external routes (200.100.10.0/24) is not needed to announce in internal network.

2 comments:

  1. Dear Bro, can you share IOS for your file.

    ReplyDelete
  2. Sure, are you looking the IOS file only for this lab? Drop your email to my gmail.

    ReplyDelete