This is another post about BGP Weight Attributes.


 Objective:
1. Established EBGP peering using two methods.
2. Implement a policy for so that all networks on R4 will take the path via R3.
  

 Topology:
 
 R1 BGP Configurations:

R1#sh run | sec bgp
router bgp 1
 bgp log-neighbor-changes
 network 100.100.100.100 mask 255.255.255.255
 neighbor 2.2.2.2 remote-as 2      <<<< Method # 1 to create BGP peering
 neighbor 2.2.2.2 ebgp-multihop 10
 neighbor 2.2.2.2 update-source Loopback0

 neighbor 192.168.13.3 remote-as 2    <<< Method # 2 to create BGP peering

Static Route in R1 and R2:

 R1#sh run | inc ip route
        ip route 2.2.2.2 255.255.255.255 192.168.12.2
R2#sh run | inc ip route
        ip route 1.1.1.1 255.255.255.255 192.168.12.1
IGP Configs on R2:

R2#sh run | sec ospf
 router ospf 1
 network 2.2.2.2 0.0.0.0 area 0
 network 192.168.24.0 0.0.0.255 area 0
IBGP Configs on R2:

R2#sh run | sec bgp
router bgp 2
 bgp log-neighbor-changes
 network 192.168.12.0
 neighbor 1.1.1.1 remote-as 1    <<< Method # 1 to create BGP peering
 neighbor 1.1.1.1 ebgp-multihop 10
 neighbor 1.1.1.1 update-source Loopback0

 neighbor 3.3.3.3 remote-as 2
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 4.4.4.4 remote-as 2
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
IGP Configs on R3:

R3#sh run | sec ospf
 router ospf 1
 network 3.3.3.3 0.0.0.0 area 0
 network 192.168.34.0 0.0.0.255 area 0
 IBGP Configs on R3:

R3#sh run | sec bgp
router bgp 2
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 2
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 4.4.4.4 remote-as 2
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 neighbor 192.168.13.1 remote-as 1
IGP Configs on R4:

R4#sh run | sec ospf
router ospf 1
 network 4.4.4.4 0.0.0.0 area 0
 network 192.168.24.0 0.0.0.255 area 0
 network 192.168.34.0 0.0.0.255 area 0
BGP Configs on R4:

R4#sh run | sec bgp
 router bgp 2
 bgp log-neighbor-changes
 network 11.11.11.11 mask 255.255.255.255
 network 22.22.22.22 mask 255.255.255.255
 network 33.33.33.33 mask 255.255.255.255
 network 44.44.44.44 mask 255.255.255.255
 neighbor 2.2.2.2 remote-as 2
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 3.3.3.3 remote-as 2
 neighbor 3.3.3.3 update-source Loopback0

 
Checking OSPF Neighbors:

R2#show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
44.44.44.44       0   FULL/  –        00:00:36    192.168.24.4    Serial3/2

R3# show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
44.44.44.44       0   FULL/  –        00:00:32    192.168.34.4    Serial3/3

R4#show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           0   FULL/  –        00:00:38    192.168.34.3    Serial3/3
2.2.2.2           0   FULL/  –        00:00:32    192.168.24.2    Serial3/2
Checking BGP Neighbors:

 R1#sh ip bgp summary
BGP router identifier 100.100.100.100, local AS number 1
BGP table version is 6, main routing table version 6
5 network entries using 720 bytes of memory
5 path entries using 400 bytes of memory
2/2 BGP path/bestpath attribute entries using 272 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1416 total bytes of memory
BGP activity 5/0 prefixes, 5/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
2.2.2.2               4            2      27      27        6    0     0                  00:20:31        2
192.168.13.3    4            2      26      27        6    0    0                 00:20:27        2


R2#sh ip bgp summary
BGP router identifier 2.2.2.2, local AS number 2
BGP table version is 7, main routing table version 7
6 network entries using 864 bytes of memory
7 path entries using 560 bytes of memory
4/3 BGP path/bestpath attribute entries using 544 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1992 total bytes of memory
BGP activity 6/0 prefixes, 7/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4            1      28      27        7    0    0 00:20:40        1
3.3.3.3         4            2      26      28        7    0    0 00:20:26        1
4.4.4.4         4            2      27      27        7    0    0 00:20:28        4
R2#

R3#show ip bgp summary
BGP router identifier 3.3.3.3, local AS number 2
BGP table version is 7, main routing table version 7
6 network entries using 864 bytes of memory
7 path entries using 560 bytes of memory
3/2 BGP path/bestpath attribute entries using 408 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1856 total bytes of memory
BGP activity 6/0 prefixes, 7/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
2.2.2.2         4            2      28      26        7    0    0 00:20:38        2
4.4.4.4         4            2      26      27        7    0    0 00:20:41        4
192.168.13.1    4            1      28      27        7    0    0 00:20:47        1


R4#show ip bgp summary
BGP router identifier 44.44.44.44, local AS number 2
BGP table version is 8, main routing table version 8
6 network entries using 864 bytes of memory
7 path entries using 560 bytes of memory
3/3 BGP path/bestpath attribute entries using 408 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1856 total bytes of memory
BGP activity 6/0 prefixes, 7/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
2.2.2.2         4            2      28      27        8    0    0 00:21:05        2
3.3.3.3         4            2      27      26        8    0    0 00:21:05        1

Checking the BGP Topology

 R1#sh ip bgp
BGP table version is 6, local router ID is 100.100.100.100
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
 *>  11.11.11.11/32   2.2.2.2                                0 2 i
 *                    192.168.13.3                           0 2 i
 *>  22.22.22.22/32   2.2.2.2                                0 2 i
 *                    192.168.13.3                           0 2 i
 *>  33.33.33.33/32   2.2.2.2                                0 2 i
 *                    192.168.13.3                           0 2 i
 *>  44.44.44.44/32   2.2.2.2                                0 2 i
 *                    192.168.13.3                           0 2 i
 r>  192.168.12.0     2.2.2.2                  0             0 2 i
 r                    192.168.13.3                           0 2 i


R2#sh ip bgp
BGP table version is 9, 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 11.11.11.11/32   4.4.4.4                  0    100      0 i
 *>i 22.22.22.22/32   4.4.4.4                  0    100      0 i
 *>i 33.33.33.33/32   4.4.4.4                  0    100      0 i
 *>i 44.44.44.44/32   4.4.4.4                  0    100      0 i
 * i 100.100.100.100/32
                       192.168.13.1             0    100      0 1 i
 *>                   1.1.1.1                  0             0 1 i
 *>  192.168.12.0     0.0.0.0                  0         32768 i

R3#show ip bgp
BGP table version is 9, 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 11.11.11.11/32   4.4.4.4                  0    100      0 i
 *>i 22.22.22.22/32   4.4.4.4                  0    100      0 i
 *>i 33.33.33.33/32   4.4.4.4                  0    100      0 i
 *>i 44.44.44.44/32   4.4.4.4                  0    100      0 i
 * i 100.100.100.100/32
                       1.1.1.1                            0    100      0 1 i
 *>                   192.168.13.1                   0             0 1 i
 *>i 192.168.12.0     2.2.2.2                  0    100      0 i
 

R4#show ip bgp
BGP table version is 11, local router ID is 44.44.44.44
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
 *>  11.11.11.11/32   0.0.0.0                  0         32768 i
 *>  22.22.22.22/32   0.0.0.0                  0         32768 i
 *>  33.33.33.33/32   0.0.0.0                  0         32768 i
 *>  44.44.44.44/32   0.0.0.0                  0         32768 i
 * i 100.100.100.100/32
                       3.3.3.3                  0    100      0 1 i
 *>i                  2.2.2.2                  0    100      0 1 i
 *>i 192.168.12.0     2.2.2.2                  0    100      0 i

Let’s check the routing table on R1:

 R1#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

      11.0.0.0/32 is subnetted, 1 subnets
B        11.11.11.11 [20/0] via 2.2.2.2, 00:03:03
      22.0.0.0/32 is subnetted, 1 subnets
B        22.22.22.22 [20/0] via 2.2.2.2, 00:03:03
      33.0.0.0/32 is subnetted, 1 subnets
B        33.33.33.33 [20/0] via 2.2.2.2, 00:03:03
      44.0.0.0/32 is subnetted, 1 subnets
B        44.44.44.44 [20/0] via 2.2.2.2, 00:03:03

** As observed, the paths towards R4 network is via R2.
To satisfy the second objective, I’m creating a route-map to influence the path towards R3:

R1(config)#route-map SET-WEIGHT-R3 permit 10
R1(config-route-map)#set weigh
R1(config-route-map)#set weight 500
R1(config-route-map)#match ip address 1

** I have increased the weight to 500 ..the default weight is 0. By setting the weight to higher value than 0, then it will prefer the path with higher weight attribute”
Here’s the access-list that will be used for the route-map SET-WEIGHT-R3
R1(config)#access-list 1 permit 11.11.11.11 0.0.0.0
R1(config)#access-list 1 permit 22.22.22.22 0.0.0.0
R1(config)#access-list 1 permit 33.33.33.33 0.0.0.0
R1(config)#access-list 1 permit 44.44.44.44 0.0.0.0
 Apply the route-map on R1 to R3 BGP peering.
R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.13.3 route-map SET-WEIGHT-R3 in
 Now, let’s check the new BGP topology after clearing BGP.
 R1#clear ip bgp *
R1#
*Sep 21 22:38:43.363: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Down User reset
*Sep 21 22:38:43.363: %BGP_SESSION-5-ADJCHANGE: neighbor 2.2.2.2 IPv4 Unicast topology base removed from session  User reset
*Sep 21 22:38:43.371: %BGP-5-ADJCHANGE: neighbor 192.168.13.3 Down User reset
*Sep 21 22:38:43.375: %BGP_SESSION-5-ADJCHANGE: neighbor 192.168.13.3 IPv4 Unicast topology base removed from session  User reset
*Sep 21 22:38:43.871: %BGP-5-ADJCHANGE: neighbor 192.168.13.3 Up
*Sep 21 22:38:43.875: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Up
 R1#sh ip bgp
BGP table version is 7, local router ID is 100.100.100.100
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
 *   11.11.11.11/32   2.2.2.2                                0             2 i
 *>                   192.168.13.3                         500             2 i
 *   22.22.22.22/32   2.2.2.2                                0           2 i
 *>                   192.168.13.3                         500             2 i
 *   33.33.33.33/32   2.2.2.2                                0           2 i
 *>                   192.168.13.3                         500             2 i
 *   44.44.44.44/32   2.2.2.2                                0           2 i
 *>                   192.168.13.3                         500             2 i

 *>  100.100.100.100/32
                       0.0.0.0                  0         32768 i
 r>  192.168.12.0     2.2.2.2                  0             0 2 i

*** As observed, we can see that the best path have changed to R3.****

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