Here’s another BGP attributes which I’m going to explore. It’s called Local Preference which has the following characteristics:


    1. Second BGP attributes
    2. Local Preference is used to choose the outbound external BGP paths.
   3. Local Preference can be sent in BGP updates among the BGP routers within an AS.
   4. It has a default value of 100.
   5. Local Preference is considered as Well-Known Descretionary BGP attributes which means that 
       this attribute must be recognized by all BGP routers but it’s an optional on BGP updates. 
   6. The BGP path with the HIGHEST Local preference is the preferred path.

Below is my topology for my lab…
 

Here is my complete working configurations for both the EBGP and IBGP:


R1#sh run | sec bgp
ipv6 multicast rpf use-bgp
router bgp 65001
 bgp log-neighbor-changes
 network 1.1.1.0 mask 255.255.255.0
 neighbor 172.16.12.2 remote-as 65002
 neighbor 172.16.13.3 remote-as 65002


 R2#sh run | sec ospf
router ospf 1
 network 2.2.2.2 0.0.0.0 area 0
 network 172.16.24.0 0.0.0.255 area 0
R2#sh run | sec bgp
ipv6 multicast rpf use-bgp
router bgp 65002
 bgp log-neighbor-changes
 network 172.16.24.0 mask 255.255.255.0
 neighbor 3.3.3.3 remote-as 65002
 neighbor 3.3.3.3 update-source Loopback2
 neighbor 4.4.4.4 remote-as 65002
 neighbor 4.4.4.4 update-source Loopback2
 neighbor 4.4.4.4 next-hop-self
 neighbor 172.16.12.1 remote-as 65001


 R3#sh run | sec ospf
router ospf 1
 network 3.3.3.3 0.0.0.0 area 0
 network 172.16.34.0 0.0.0.255 area 0
R3#sh run | sec bgp
ipv6 multicast rpf use-bgp
router bgp 65002
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 65002
 neighbor 2.2.2.2 update-source Loopback3
 neighbor 4.4.4.4 remote-as 65002
 neighbor 4.4.4.4 update-source Loopback3
 neighbor 4.4.4.4 next-hop-self
 neighbor 172.16.13.1 remote-as 65001
R3#


 R4#sh run | sec ospf
router ospf 1
 network 4.4.4.4 0.0.0.0 area 0
 network 172.16.24.0 0.0.0.255 area 0
 network 172.16.34.0 0.0.0.255 area 0
R4#sh run | sec bgp
ipv6 multicast rpf use-bgp
router bgp 65002
 bgp log-neighbor-changes
 network 10.10.10.0 mask 255.255.255.0
 neighbor 2.2.2.2 remote-as 65002
 neighbor 2.2.2.2 update-source Loopback4
 neighbor 3.3.3.3 remote-as 65002
 neighbor 3.3.3.3 update-source Loopback4

   Below are the BGP Database: 


 R1#show ip bgp
BGP table version is 4, 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, 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
 *>  1.1.1.0/24       0.0.0.0                  0         32768 i
 *   10.10.10.0/24    172.16.12.2                            0 65002 i
 *>                   172.16.13.3                            0 65002 i
 *>  172.16.24.0/24   172.16.12.2              0             0 65002 i
 *                    172.16.13.3                            0 65002 i

R2#show ip bgp
BGP table version is 8, 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, 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 1.1.1.0/24       172.16.13.1              0    100      0 65001 i
 *>                   172.16.12.1              0             0 65001 i
 *>i 10.10.10.0/24    4.4.4.4                  0    100      0 i
 *>  172.16.24.0/24   0.0.0.0                  0         32768 i

R3#show ip  bgp
BGP table version is 12, 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, 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 1.1.1.0/24       172.16.12.1              0    100      0 65001 i
 *>                   172.16.13.1              0             0 65001 i
 *>i 10.10.10.0/24    4.4.4.4                  0    100      0 i
 r>i 172.16.24.0/24   2.2.2.2                  0    100      0 i

R4#show ip bgp
BGP table version is 4, local router ID is 10.10.10.10
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 1.1.1.0/24       3.3.3.3                  0    100      0 65001 i
 *>i                  2.2.2.2                  0        100      0 65001 i

 *>  10.10.10.0/24    0.0.0.0                  0         32768 i
 r>i 172.16.24.0/24   2.2.2.2                  0    100      0 i
R4#

You can see above on R4 BGP database that the Local Preference value is 100 (Default)…Why R2 was chosen because all other Attributes are the same and the last BGP attribute ( Router ID) determines the path…The Lowest the Router ID the better path..

  Here’s my traceroutes and ping to 1.1.1.1/24…


 R4#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
  1 172.16.24.2 56 msec 52 msec 56 msec
  2 172.16.12.1 56 msec 52 msec 88 msec
R4#ping 1.1.1.1 source 172.16.24.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 172.16.24.4
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 72/89/120 ms
R4#

   Look at R4…..R4 is taking R2 to reach 1.1.1.1/24…


 R4#show ip route bgp
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
       + – replicated route, % – next hop override

Gateway of last resort is not set

      1.0.0.0/24 is subnetted, 1 subnets
B        1.1.1.0 [200/0] via 2.2.2.2, 00:13:41
R4#

Now, I want to used LOCAL PREFERENCE to influence R4 how it will reach 1.1.1.1/24…By this time, I want R4 to reach 1.1.1.1/24 via R3…



 We can used the command:  bgp default local-preference


R3(config)#router bgp 65002
R3(config-router)#bgp default ?
  inter-as-hybrid   Configure Inter-AS Hybrid peer defaults
  ipv4-unicast      Activate ipv4-unicast for a peer by default
  ipv6-nexthop      Default IPv6 nexthop format
  local-preference  local preference (higher=more preferred)
  route-target      Control behavior based on Route-Target attributes

R3(config-router)#bgp default local
R3(config-router)#bgp default local-preference ?
    Configure default local preference value

R3(config-router)#bgp default local-preference 101
R3(config-router)#do clear ip bgp *
R3(config-router)#
*Oct  8 14:47:26.007: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Down User reset
*Oct  8 14:47:26.007: %BGP_SESSION-5-ADJCHANGE: neighbor 2.2.2.2 IPv4 Unicast topology base removed from session  User reset
*Oct  8 14:47:26.011: %BGP-5-ADJCHANGE: neighbor 4.4.4.4 Down User reset
*Oct  8 14:47:26.015: %BGP_SESSION-5-ADJCHANGE: neighbor 4.4.4.4 IPv4 Unicast topology base removed from session  User reset
*Oct  8 14:47:26.019: %BGP-5-ADJCHANGE: neighbor 172.16.13.1 Down User reset
*Oct  8 14:47:26.019: %BGP_SESSION-5-ADJCHANGE: neighbor 172.16.13.1 IPv4 Unicast topology base removed from session  User reset
*Oct  8 14:47:26.727: %BGP-5-ADJCHANGE: neighbor 172.16.13.1 Up
R3(config-router)#
*Oct  8 14:47:26.935: %BGP-5-ADJCHANGE: neighbor 4.4.4.4 Up
*Oct  8 14:47:27.075: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Up
R3(config-router)#

Now, let’s check R4 BGP database.. I just increased the Local Pref value by 1….and now I have a path towards 1.1.1.1/24 via R3…
 

 R4#show ip bgp
BGP table version is 5, local router ID is 10.10.10.10
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 1.1.1.0/24       3.3.3.3                  0    101      0 65001 i
 * i                  2.2.2.2                  0    100      0 65001 i
 *>  10.10.10.0/24    0.0.0.0                  0         32768 i
 r>i 172.16.24.0/24   2.2.2.2                  0    100      0 i
R4#

****************************END OF LAB*************************

Leave a comment

Quote of the week

"People ask me what I do in the winter when there's no baseball. I'll tell you what I do. I stare out the window and wait for spring."

~ Rogers Hornsby