User Tools

Site Tools


tech:network:cisco:bgp:bgp:bgp-next-hop:bgp-next-hop

BGP: Configuring NEXT_HOP

about NEXT_HOP attribute.

Project name: ccna-bgp8-next-hop

Issued BGP Configuration

  • R1
en
conf t
!
hostname R1
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int gig0/0
ip address 1.0.0.1 255.255.255.0
no shut
exit
int gig0/2
ip address 50.0.0.1 255.255.0.0
no shut
exit
!
router bgp 1
neighbor 1.0.0.2 remote-as 2
network 50.0.0.0 mask 255.255.0.0
exit
!
end
wr
  • R2
en
conf t
!
hostname R2
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int gig0/0
ip address 2.0.0.2 255.255.255.0
no shut
exit
int gig0/1
ip address 1.0.0.2 255.255.255.0
no shut
exit
int gig0/2
ip address 60.0.0.2 255.255.0.0
no shut
exit
!
router bgp 2
neighbor 1.0.0.1 remote-as 1
neighbor 2.0.0.3 remote-as 2
network 60.0.0.0 mask 255.255.0.0
exit
!
end
wr
  • R3
en
conf t
!
hostname R3
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int gig0/1
ip address 2.0.0.3 255.255.255.0
no shut
exit
int gig0/2
ip address 70.0.0.3 255.255.0.0
no shut
exit
!
router bgp 2
neighbor 2.0.0.2 remote-as 2
network 70.0.0.0 mask 255.255.0.0
exit
!
end
wr
  • PC1
ip 50.0.0.101 255.255.0.0 50.0.0.1
save
  • PC2
ip 70.0.0.103 255.255.0.0 70.0.0.3
save
  • PC3
ip 60.0.0.102 255.255.0.0 60.0.0.2
save
R1#sh ip bgp
BGP table version is 4, local router ID is 50.0.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  50.0.0.0/16      0.0.0.0                  0         32768 i
 *>  60.0.0.0/16      1.0.0.2                  0             0 2 i
 *>  70.0.0.0/16      1.0.0.2                                0 2 i
R1#sh ip ro
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.0.0.0/24 is directly connected, GigabitEthernet0/0
L        1.0.0.1/32 is directly connected, GigabitEthernet0/0
      50.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        50.0.0.0/16 is directly connected, GigabitEthernet0/2
L        50.0.0.1/32 is directly connected, GigabitEthernet0/2
      60.0.0.0/16 is subnetted, 1 subnets
B        60.0.0.0 [20/0] via 1.0.0.2, 00:03:36
      70.0.0.0/16 is subnetted, 1 subnets
B        70.0.0.0 [20/0] via 1.0.0.2, 00:03:36
R2#sh ip bgp
BGP table version is 4, local router ID is 60.0.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  50.0.0.0/16      1.0.0.1                  0             0 1 i
 *>  60.0.0.0/16      0.0.0.0                  0         32768 i
 *>i 70.0.0.0/16      2.0.0.3                  0    100      0 i
R2#sh ip ro
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.0.0.0/24 is directly connected, GigabitEthernet0/1
L        1.0.0.2/32 is directly connected, GigabitEthernet0/1
      2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        2.0.0.0/24 is directly connected, GigabitEthernet0/0
L        2.0.0.2/32 is directly connected, GigabitEthernet0/0
      50.0.0.0/16 is subnetted, 1 subnets
B        50.0.0.0 [20/0] via 1.0.0.1, 00:03:40
      60.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        60.0.0.0/16 is directly connected, GigabitEthernet0/2
L        60.0.0.2/32 is directly connected, GigabitEthernet0/2
      70.0.0.0/16 is subnetted, 1 subnets
B        70.0.0.0 [200/0] via 2.0.0.3, 00:03:41
R3#sh ip bgp neigh | i BGP state
  BGP state = Established, up for 00:02:17
R3#sh ip bgp
BGP table version is 3, local router ID is 70.0.0.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 50.0.0.0/16      1.0.0.1                  0    100      0 1 i
 *>i 60.0.0.0/16      2.0.0.2                  0    100      0 i
 *>  70.0.0.0/16      0.0.0.0                  0         32768 i
R3#ping 50.0.0.101
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 50.0.0.101, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#^Z
R3#
*Nov 25 10:03:30.362: %SYS-5-CONFIG_I: Configured from console by console
R3#sh ip ro
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        2.0.0.0/24 is directly connected, GigabitEthernet0/1
L        2.0.0.3/32 is directly connected, GigabitEthernet0/1
      60.0.0.0/16 is subnetted, 1 subnets
B        60.0.0.0 [200/0] via 2.0.0.2, 00:03:44
      70.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        70.0.0.0/16 is directly connected, GigabitEthernet0/2
L        70.0.0.3/32 is directly connected, GigabitEthernet0/2

50.0.0.0/16 isn't installed on R3 routing table because R3 isn't know to route 1.0.0.0/24 to reach NEXT_HOP.

PC-2> ping 70.0.0.3
84 bytes from 70.0.0.3 icmp_seq=1 ttl=255 time=2.871 ms
84 bytes from 70.0.0.3 icmp_seq=2 ttl=255 time=2.110 ms
84 bytes from 70.0.0.3 icmp_seq=3 ttl=255 time=2.177 ms
84 bytes from 70.0.0.3 icmp_seq=4 ttl=255 time=2.162 ms
84 bytes from 70.0.0.3 icmp_seq=5 ttl=255 time=2.176 ms

PC-2> ping 50.0.0.101
*70.0.0.3 icmp_seq=1 ttl=255 time=2.606 ms (ICMP type:3, code:1, Destination host unreachable)
*70.0.0.3 icmp_seq=2 ttl=255 time=2.452 ms (ICMP type:3, code:1, Destination host unreachable)
*70.0.0.3 icmp_seq=3 ttl=255 time=2.480 ms (ICMP type:3, code:1, Destination host unreachable)
*70.0.0.3 icmp_seq=4 ttl=255 time=2.498 ms (ICMP type:3, code:1, Destination host unreachable)
*70.0.0.3 icmp_seq=5 ttl=255 time=2.639 ms (ICMP type:3, code:1, Destination host unreachable)

Solution 1: Add static route to 50.0.0.0/16

  • R3
conf t
!
ip route 50.0.0.0 255.255.0.0 2.0.0.2
!
end
PC-2> ping 50.0.0.101
50.0.0.101 icmp_seq=1 timeout
50.0.0.101 icmp_seq=2 timeout
84 bytes from 50.0.0.101 icmp_seq=3 ttl=61 time=4.533 ms
84 bytes from 50.0.0.101 icmp_seq=4 ttl=61 time=4.867 ms
84 bytes from 50.0.0.101 icmp_seq=5 ttl=61 time=6.186 ms

PC-2> ping 50.0.0.101
84 bytes from 50.0.0.101 icmp_seq=1 ttl=61 time=2.905 ms
84 bytes from 50.0.0.101 icmp_seq=2 ttl=61 time=3.433 ms
84 bytes from 50.0.0.101 icmp_seq=3 ttl=61 time=4.309 ms
84 bytes from 50.0.0.101 icmp_seq=4 ttl=61 time=5.172 ms
84 bytes from 50.0.0.101 icmp_seq=5 ttl=61 time=4.379 ms
R3#sh ip bgp
BGP table version is 3, local router ID is 70.0.0.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 50.0.0.0/16      1.0.0.1                  0    100      0 1 i
 *>i 60.0.0.0/16      2.0.0.2                  0    100      0 i
 *>  70.0.0.0/16      0.0.0.0                  0         32768 i
R3#sh ip ro
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        2.0.0.0/24 is directly connected, GigabitEthernet0/1
L        2.0.0.3/32 is directly connected, GigabitEthernet0/1
      50.0.0.0/16 is subnetted, 1 subnets
S        50.0.0.0 [1/0] via 2.0.0.2
      60.0.0.0/16 is subnetted, 1 subnets
B        60.0.0.0 [200/0] via 2.0.0.2, 00:17:46
      70.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        70.0.0.0/16 is directly connected, GigabitEthernet0/2
L        70.0.0.3/32 is directly connected, GigabitEthernet0/2

Solution 2: Modify NEXT_HOP that advertise to iBGP peer

  • R2
conf t
!
router bgp 2
neighbor 2.0.0.3 next-hop-self
exit
!
end
R2(config-router)#do clear ip bgp *
R2(config-router)#
*Nov 25 10:25:02.941: %BGP-3-NOTIFICATION_ALL: sent to all sessions 6/4 (Administrative Reset)
R2(config-router)#
*Nov 25 10:25:02.987: %BGP-5-ADJCHANGE: neighbor 1.0.0.1 Down User reset
*Nov 25 10:25:02.991: %BGP_SESSION-5-ADJCHANGE: neighbor 1.0.0.1 IPv4 Unicast topology base removed from session  User reset
*Nov 25 10:25:02.994: %BGP-5-ADJCHANGE: neighbor 2.0.0.3 Down User reset
*Nov 25 10:25:02.995: %BGP_SESSION-5-ADJCHANGE: neighbor 2.0.0.3 IPv4 Unicast topology base removed from session  User reset

route to 50.0.0.0/16 installed on R3 NEXT_HOP IP is connected route.

R1#sh ip bgp
BGP table version is 8, local router ID is 50.0.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  50.0.0.0/16      0.0.0.0                  0         32768 i
 *>  60.0.0.0/16      1.0.0.2                  0             0 2 i
 *>  70.0.0.0/16      1.0.0.2                                0 2 i
R1#sh ip ro
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.0.0.0/24 is directly connected, GigabitEthernet0/0
L        1.0.0.1/32 is directly connected, GigabitEthernet0/0
      50.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        50.0.0.0/16 is directly connected, GigabitEthernet0/2
L        50.0.0.1/32 is directly connected, GigabitEthernet0/2
      60.0.0.0/16 is subnetted, 1 subnets
B        60.0.0.0 [20/0] via 1.0.0.2, 00:00:20
      70.0.0.0/16 is subnetted, 1 subnets
B        70.0.0.0 [20/0] via 1.0.0.2, 00:00:51
R2#sh ip bgp
BGP table version is 4, local router ID is 60.0.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  50.0.0.0/16      1.0.0.1                  0             0 1 i
 *>  60.0.0.0/16      0.0.0.0                  0         32768 i
 *>i 70.0.0.0/16      2.0.0.3                  0    100      0 i
R2#sh ip ro
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.0.0.0/24 is directly connected, GigabitEthernet0/1
L        1.0.0.2/32 is directly connected, GigabitEthernet0/1
      2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        2.0.0.0/24 is directly connected, GigabitEthernet0/0
L        2.0.0.2/32 is directly connected, GigabitEthernet0/0
      50.0.0.0/16 is subnetted, 1 subnets
B        50.0.0.0 [20/0] via 1.0.0.1, 00:00:54
      60.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        60.0.0.0/16 is directly connected, GigabitEthernet0/2
L        60.0.0.2/32 is directly connected, GigabitEthernet0/2
      70.0.0.0/16 is subnetted, 1 subnets
B        70.0.0.0 [200/0] via 2.0.0.3, 00:00:54
R3#sh ip bgp
BGP table version is 6, local router ID is 70.0.0.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i 50.0.0.0/16      2.0.0.2                  0    100      0 1 i
 *>i 60.0.0.0/16      2.0.0.2                  0    100      0 i
 *>  70.0.0.0/16      0.0.0.0                  0         32768 i
R3#sh ip ro
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        2.0.0.0/24 is directly connected, GigabitEthernet0/1
L        2.0.0.3/32 is directly connected, GigabitEthernet0/1
      50.0.0.0/16 is subnetted, 1 subnets
B        50.0.0.0 [200/0] via 2.0.0.2, 00:00:58
      60.0.0.0/16 is subnetted, 1 subnets
B        60.0.0.0 [200/0] via 2.0.0.2, 00:00:28
      70.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        70.0.0.0/16 is directly connected, GigabitEthernet0/2
L        70.0.0.3/32 is directly connected, GigabitEthernet0/2

ping successful.

PC-2> ping 50.0.0.101
84 bytes from 50.0.0.101 icmp_seq=1 ttl=61 time=11.843 ms
84 bytes from 50.0.0.101 icmp_seq=2 ttl=61 time=3.953 ms
84 bytes from 50.0.0.101 icmp_seq=3 ttl=61 time=4.212 ms
84 bytes from 50.0.0.101 icmp_seq=4 ttl=61 time=4.063 ms
84 bytes from 50.0.0.101 icmp_seq=5 ttl=61 time=4.216 ms

References

tech/network/cisco/bgp/bgp/bgp-next-hop/bgp-next-hop.txt · Last modified: 2018/11/25 19:30 by wnoguchi