DONATE


BGP Local preference configuration




BGP Local preference (Local_Pref) Path attribute gives the router inside a single autonomous system a value that they can set per-route and advertise to all iBGP routers inside the autonomous system, so that all routers in the autonomous system agree about which routers is the best exit point for packet destined for that prefix.


  • Local preference (Local_Pref) is the second BGP attribute.
  • We can use the local preference to choose the outbound external BGP path.
  • Local preference is sent to all internal BGP (iBGP) routers in our autonomous system.
  • Local preference (Local_Pref) is not exchanged between external BGP routers.
  • It’s a well-known and discretionary BGP attribute.
  • Default value is 100.
  • The path with the highest local preference is desirable 


Topology:-


TASK: To reach 50.1.1.1, 15.0.0.1 network router 2 and router 3 using 3.1.1.2 path ( AS 65144) because it has less numbers of autonomous system. but as per our requirement we need router use 1.1.1.1 interface to reach all the networks, to manipulate the path we use local_pref
  • configure the topology as per the diagram.
  • configure iBGP and eBGP peering using directly connected interfaces.
  • advertise all the networks as per the topology.
  • configure router 2 exit point for autonomous system of 65123.
  • make sure router 2 reach all the network via router 1.

ROUTER-1(config)#Interface fastethernet 0/0
ROUTER-1(config-if)#Ip address 10.1.1.1   255.0.0.0
ROUTER-1(config-if)#No shutdown
ROUTER-1(config-if)#No keepalive
ROUTER-1(config-if)#Exit

ROUTER-1(config)#Interface serial 3/0
ROUTER-1(config-if)#Ip address  1.1.1.1 255.0.0.0
ROUTER-1(config-if)#No shutdown

ROUTER-1(config-if)#Exit
ROUTER-1(config)#Interface serial 3/3
ROUTER-1(config-if)#Ip address  4.4.4.2 255.0.0.0
ROUTER-1(config-if)#No shutdown
ROUTER-1(config-if)#Exit

ROUTER-1(config)#Interface loopback 0
ROUTER-1(config-if)#Ip address 11.0.0.1 255.255.255.0
ROUTER-1(config-if)#Exit


ROUTER-2(config)#Interface fastethernet 0/0
ROUTER-2(config-if)#Ip address 20.1.1.1   255.0.0.0
ROUTER-2(config-if)#No shutdown
ROUTER-2(config-if)#No keepalive
ROUTER-2(config-if)#Exit

ROUTER-2(config)#Interface serial 3/0
ROUTER-2(config-if)#Ip address  1.1.1.2 255.0.0.0
ROUTER-2(config-if)#No shutdown
ROUTER-2(config-if)#Exit

ROUTER-2(config)#Interface serial 3/1
ROUTER-2(config-if)#Ip address  2.2.2.1 255.0.0.0
ROUTER-2(config-if)#No shutdown
ROUTER-2(config-if)#Exit

ROUTER-2(config)#Interface loopback  1
ROUTER-2(config-if)#Ip address 12.0.1.1 255.255.255.0
ROUTER-2(config-if)#Exit


ROUTER-3(config)#Interface fastethernet 0/0
ROUTER-3(config-if)#Ip address 30.1.1.1   255.0.0.0
ROUTER-3(config-if)#No shutdown
ROUTER-3(config-if)#No keepalive
ROUTER-3(config-if)#Exit

ROUTER-3(config)#Interface serial 3/1
ROUTER-3(config-if)#Ip address  2.2.2.2 255.0.0.0
ROUTER-3(config-if)#No shutdown
ROUTER-3(config-if)#Exit

ROUTER-3(config)#Interface serial 3/2
ROUTER-3(config-if)#Ip address  3.3.3.1 255.0.0.0
ROUTER-3(config-if)#No shutdown
ROUTER-3(config-if)#Exit
ROUTER-3(config)#

ROUTER-3(config)#Interface loopback 0
ROUTER-3(config-if)#Ip address 13.0.0.1 255.255.255.0
ROUTER-3(config-if)#Exit


ROUTER-4(config)#Interface fastethernet 0/0
ROUTER-4(config-if)#Ip address 40.1.1.1   255.0.0.0
ROUTER-4(config-if)#No shutdown
ROUTER-4(config-if)#No keepalive
ROUTER-4(config-if)#Exit

ROUTER-4(config)#Interface serial 3/2
ROUTER-4(config-if)#Ip address  3.3.3.2 255.0.0.0
ROUTER-4(config-if)#No shutdown
ROUTER-4(config-if)#Exit

ROUTER-4(config)#Interface serial 3/4
ROUTER-4(config-if)#Ip address  5.5.5.2 255.0.0.0
ROUTER-4(config-if)#No shutdown
ROUTER-4(config-if)#Exit

ROUTER-4(config)#Interface serial 3/3
ROUTER-4(config-if)#Ip address  4.4.4.1 255.0.0.0
ROUTER-4(config-if)#No shutdown
ROUTER-4(config-if)#Exit


ROUTER-5(config)#Interface fastethernet 0/0
ROUTER-5(config-if)#Ip address 50.1.1.1   255.0.0.0
ROUTER-5(config-if)#No shutdown
ROUTER-5(config-if)#No keepalive
ROUTER-5(config-if)#Exit

ROUTER-5(config)#Interface serial 3/4
ROUTER-5(config-if)#Ip address  5.5.5.1 255.0.0.0
ROUTER-5(config-if)#No shutdown
ROUTER-5(config-if)#Exit

ROUTER-5(config)#Interface loopback 0
ROUTER-5(config-if)#Ip address 15.0.0.1 255.255.255.0
ROUTER-5(config-if)#Exit


ROUTER-1(config)#router bgp 65111
ROUTER-1(config-router)#neighbor 1.1.1.2 remote-as 65123
ROUTER-1(config-router)#neighbor 1.1.1.2 remote-as 65144
ROUTER-1(config-router)#neighbor 4.4.4.1 remote-as 65144
ROUTER-1(config-router)#network 10.0.0.0
ROUTER-1(config-router)#network 1.0.0.0
ROUTER-1(config-router)#network 4.0.0.0
ROUTER-1(config-router)#network 11.0.0.0 mask 255.255.255.0
ROUTER-1(config-router)#no auto-summary
ROUTER-1(config-router)#no synchronization
ROUTER-1(config-router)#exit

*Nov 30 00:55:16.523: %BGP-5-ADJCHANGE: neighbor 1.1.1.2 Up

ROUTER-2(config)#router bgp 65123

ROUTER-2(config-router)#neighbor 1.1.1.1 remote-as 65111
ROUTER-2(config-router)#neighbor 1.1.1.1 remote-as 6511
ROUTER-2(config-router)#neighbor 2.2.2.2 remote-as 65123
ROUTER-2(config-router)#network 20.1.1.1
ROUTER-2(config-router)#network 2.1.1.1
ROUTER-2(config-router)#network 1.1.1.1
ROUTER-2(config-router)#network 12.0.0.0 mask 255.255.255.0
ROUTER-2(config-router)#no auto-summary
ROUTER-2(config-router)#no synchronization
ROUTER-2(config-router)#exit

ROUTER-2(config)#router bgp 65123
ROUTER-2(config-router)#neighbor 2.2.2.2 next-hop-self
ROUTER-2(config-router)#exit

ROUTER-2(config)#do clear ip bgp * soft


*Nov 30 00:59:19.611: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up


ROUTER-3(config)#router bgp  65123
ROUTER-3(config-router)#neighbor 2.2.2.1 remote-as 65123
ROUTER-3(config-router)#neighbor 2.2.2.1 remote-as 65144
ROUTER-3(config-router)#neighbor 3.3.3.2 remote-as 65144
ROUTER-3(config-router)#network 2.0.0.0
ROUTER-3(config-router)#network 3.0.0.0
ROUTER-3(config-router)#network 30.0.0.0
ROUTER-3(config-router)#network 13.0.0.0 mask 255.255.255.0
ROUTER-3(config-router)#no auto-summary
ROUTER-3(config-router)#no synchronization
ROUTER-3(config-router)#exit

*Nov 30 01:10:34.847: %BGP-5-ADJCHANGE: neighbor 3.3.3.2 Up


ROUTER-3(config)#router bgp 65123
ROUTER-3(config-router)#neighbor 2.2.2.1 next-hop-self
ROUTER-3(config-router)#exit

*Nov 30 01:08:47.059: %BGP-5-ADJCHANGE: neighbor 2.2.2.1 Up

ROUTER-4(config)#router bgp 65144
ROUTER-4(config-router)#neighbor 3.3.3.1 remote-as 65123
ROUTER-4(config-router)#neighbor 4.4.4.2 remote-as 65111
ROUTER-4(config-router)#neighbor 5.5.5.1 remote-as 65155
ROUTER-4(config-router)#network 40.0.0.0
ROUTER-4(config-router)#network 4.0.0.0
ROUTER-4(config-router)#network 5.0.0.0
ROUTER-4(config-router)#network 3.0.0.0
ROUTER-4(config-router)#network 14.0.0.0 mask 255.255.255.0
ROUTER-4(config-router)#no auto-summary
ROUTER-4(config-router)#no synchronization
ROUTER-4(config-router)#exit

*Nov 30 01:17:25.667: %BGP-5-ADJCHANGE: neighbor 5.5.5.1 Up
*Nov 30 01:10:34.827: %BGP-5-ADJCHANGE: neighbor 3.3.3.1 Up
*Nov 30 01:10:54.627: %BGP-5-ADJCHANGE: neighbor 4.4.4.2 Up

ROUTER-5(config)#router bgp 65155
ROUTER-5(config-router)#neighbor 5.5.5.2 remote-as 65144
ROUTER-5(config-router)#network 50.0.0
ROUTER-5(config-router)#network 50.0.0.0
ROUTER-5(config-router)#network 5.0.0.0
ROUTER-5(config-router)#network 15.0.0.0 mask 255.255.255.0
ROUTER-5(config-router)#no auto-summary
ROUTER-5(config-router)#no synchronization
ROUTER-5(config-router)#exit

*Nov 30 01:17:24.823: %BGP-5-ADJCHANGE: neighbor 5.5.5.2 Up

ROUTER-1#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

B     2.0.0.0/8 [20/0] via 1.1.1.2, 00:33:49
B     3.0.0.0/8 [20/0] via 1.1.1.2, 00:33:19
B     5.0.0.0/8 [20/0] via 4.4.4.1, 00:30:49
      13.0.0.0/24 is subnetted, 1 subnets
B        13.0.0.0 [20/0] via 1.1.1.2, 00:33:19
      14.0.0.0/24 is subnetted, 1 subnets
B        14.0.0.0 [20/0] via 4.4.4.1, 00:30:49
      15.0.0.0/24 is subnetted, 1 subnets
B        15.0.0.0 [20/0] via 4.4.4.1, 00:25:00
B     20.0.0.0/8 [20/0] via 1.1.1.2, 00:07:25
B     30.0.0.0/8 [20/0] via 1.1.1.2, 00:09:46
B     40.0.0.0/8 [20/0] via 4.4.4.1, 00:31:20
B     50.0.0.0/8 [20/0] via 4.4.4.1, 00:25:00


ROUTER-2#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

B     3.0.0.0/8 [200/0] via 2.2.2.2, 00:33:53
B     4.0.0.0/8 [20/0] via 1.1.1.1, 00:43:44
B     5.0.0.0/8 [200/0] via 2.2.2.2, 00:23:08
B     10.0.0.0/8 [20/0] via 1.1.1.1, 00:43:44
      11.0.0.0/24 is subnetted, 1 subnets
B        11.0.0.0 [20/0] via 1.1.1.1, 00:43:44
      13.0.0.0/24 is subnetted, 1 subnets
B        13.0.0.0 [200/0] via 2.2.2.2, 00:33:40
      14.0.0.0/24 is subnetted, 1 subnets
B        14.0.0.0 [200/0] via 2.2.2.2, 00:23:08
      15.0.0.0/24 is subnetted, 1 subnets
B        15.0.0.0 [200/0] via 2.2.2.2, 00:23:08
B     30.0.0.0/8 [200/0] via 2.2.2.2, 00:09:55
B     40.0.0.0/8 [200/0] via 2.2.2.2, 00:23:08
B     50.0.0.0/8 [200/0] via 2.2.2.2, 00:23:08


ROUTER-3#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

B     1.0.0.0/8 [200/0] via 2.2.2.1, 00:24:04
B     4.0.0.0/8 [20/0] via 3.3.3.2, 00:31:33
B     5.0.0.0/8 [20/0] via 3.3.3.2, 00:31:03
B     10.0.0.0/8 [200/0] via 2.2.2.1, 00:24:04
      11.0.0.0/24 is subnetted, 1 subnets
B        11.0.0.0 [200/0] via 2.2.2.1, 00:24:04
      14.0.0.0/24 is subnetted, 1 subnets
B        14.0.0.0 [20/0] via 3.3.3.2, 00:31:03
      15.0.0.0/24 is subnetted, 1 subnets
B        15.0.0.0 [20/0] via 3.3.3.2, 00:25:13
B     20.0.0.0/8 [200/0] via 2.2.2.1, 00:07:39
B     40.0.0.0/8 [20/0] via 3.3.3.2, 00:31:33
B     50.0.0.0/8 [20/0] via 3.3.3.2, 00:25:13



ROUTER-4# 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

B     1.0.0.0/8 [20/0] via 4.4.4.2, 00:32:18
B     2.0.0.0/8 [20/0] via 3.3.3.1, 00:32:38
B     10.0.0.0/8 [20/0] via 4.4.4.2, 00:32:18
      11.0.0.0/24 is subnetted, 1 subnets
B        11.0.0.0 [20/0] via 4.4.4.2, 00:32:18
      13.0.0.0/24 is subnetted, 1 subnets
B        13.0.0.0 [20/0] via 3.3.3.1, 00:32:38
      15.0.0.0/24 is subnetted, 1 subnets
B        15.0.0.0 [20/0] via 5.5.5.1, 00:25:16
B     20.0.0.0/8 [20/0] via 3.3.3.1, 00:07:41
B     30.0.0.0/8 [20/0] via 3.3.3.1, 00:10:03
B     50.0.0.0/8 [20/0] via 5.5.5.1, 00:25:16


ROUTER-5#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

B     1.0.0.0/8 [20/0] via 5.5.5.2, 00:25:51
B     2.0.0.0/8 [20/0] via 5.5.5.2, 00:25:51
B     3.0.0.0/8 [20/0] via 5.5.5.2, 00:25:51
B     4.0.0.0/8 [20/0] via 5.5.5.2, 00:25:51
B     10.0.0.0/8 [20/0] via 5.5.5.2, 00:25:51
      11.0.0.0/24 is subnetted, 1 subnets
B        11.0.0.0 [20/0] via 5.5.5.2, 00:25:51
      13.0.0.0/24 is subnetted, 1 subnets
B        13.0.0.0 [20/0] via 5.5.5.2, 00:25:51
      14.0.0.0/24 is subnetted, 1 subnets
B        14.0.0.0 [20/0] via 5.5.5.2, 00:25:51
B     20.0.0.0/8 [20/0] via 5.5.5.2, 00:07:15
B     30.0.0.0/8 [20/0] via 5.5.5.2, 00:10:07
B     40.0.0.0/8 [20/0] via 5.5.5.2, 00:25:51
ROUTER-2#show ip bgp
BGP table version is 22, local router ID is 12.0.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
 r>  1.0.0.0          1.1.1.1                  0             0 65111 i
 r>i 2.0.0.0          2.2.2.2                  0    100      0 i
 *>i 3.0.0.0          2.2.2.2                  0    100      0 i
 * i 4.0.0.0          2.2.2.2                  0    100      0 65144 i
 *>                   1.1.1.1                  0             0 65111 i
 *   5.0.0.0          1.1.1.1                                0 65111 65144 i
 *>i                  2.2.2.2                  0    100      0 65144 i
 *>  10.0.0.0         1.1.1.1                  0             0 65111 i
 *>  11.0.0.0/24      1.1.1.1                  0             0 65111 i
 *>i 13.0.0.0/24      2.2.2.2                  0    100      0 i
 *   14.0.0.0/24      1.1.1.1                                0 65111 65144 i
 *>i                  2.2.2.2                  0    100      0 65144 i
 *>i 15.0.0.0/24      2.2.2.2                  0    100      0 65144 65155 i
 *                    1.1.1.1                                0 65111 65144 65155 i
     Network          Next Hop            Metric LocPrf Weight Path
 *>  20.0.0.0         0.0.0.0                  0         32768 i
 *>i 30.0.0.0         2.2.2.2                  0    100      0 i
 *   40.0.0.0         1.1.1.1                                0 65111 65144 i
 *>i                  2.2.2.2                  0    100      0 65144 i
 *>i 50.0.0.0         2.2.2.2                  0    100      0 65144 65155 i
 *                    1.1.1.1                                0 65111 65144 65155 i

ROUTER-2#traceroute 50.1.1.1
Type escape sequence to abort.
Tracing the route to 50.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
  1 2.2.2.2 140 msec 76 msec 100 msec
  2 3.3.3.2 128 msec 136 msec 200 msec
  3 5.5.5.1 [AS 65144] 300 msec 252 msec 172 msec


( configuring local pref  on router 2 )

ROUTER-2(config)#router bgp 65123
ROUTER-2(config-router)#bgp default local-preference 5000
ROUTER-2(config-router)#exit
ROUTER-2(config)#do clear ip bgp * soft
ROUTER-2(config)#end

ROUTER-2#traceroute 50.1.1.1
Type escape sequence to abort.
Tracing the route to 50.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
  1 1.1.1.1 [AS 65111] 48 msec 48 msec 100 msec
  2 4.4.4.1 [AS 65111] 116 msec 128 msec 128 msec
  3 5.5.5.1 [AS 65144] 200 msec 180 msec 248 msec


ROUTER-2#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

B     3.0.0.0/8 [200/0] via 2.2.2.2, 00:03:05
B     4.0.0.0/8 [20/0] via 1.1.1.1, 00:03:05
B     5.0.0.0/8 [20/0] via 1.1.1.1, 00:03:05
B     10.0.0.0/8 [20/0] via 1.1.1.1, 01:00:29
      11.0.0.0/24 is subnetted, 1 subnets
B        11.0.0.0 [20/0] via 1.1.1.1, 01:00:29
      13.0.0.0/24 is subnetted, 1 subnets
B        13.0.0.0 [200/0] via 2.2.2.2, 00:03:05
      14.0.0.0/24 is subnetted, 1 subnets
B        14.0.0.0 [20/0] via 1.1.1.1, 00:03:05
      15.0.0.0/24 is subnetted, 1 subnets
B        15.0.0.0 [20/0] via 1.1.1.1, 00:03:05
B     30.0.0.0/8 [200/0] via 2.2.2.2, 00:03:05
B     40.0.0.0/8 [20/0] via 1.1.1.1, 00:03:05
B     50.0.0.0/8 [20/0] via 1.1.1.1, 00:03:05



1 comment:

  1. Vint Ceramic Art | TITNIA & TECHNOLOGY
    Explore dental implants an all https://septcasino.com/review/merit-casino/ new “Vint poormansguidetocasinogambling.com Ceramic Art” project on TITNIA & 바카라 사이트 TECHNOLOGY. Our team of sculptors 출장샵 and artists have created new and

    ReplyDelete

How to configure DHCP Snooping on switch, DHCP Server on router, SVI Inter-VLAN-routing, BPDU Guard, Root-Guard, Port-fast, Dot1q and Port-channel pagp?

In this section, we are going to configure some important topics DHCP Snooping on the switch, DHCP Server on the router, SVI Inter-VLAN-rout...

INSTAGRAM FEED

@Edger C Francis