Weight

This scenario demonstrates how to configure the weight attribute for a BGP neighbor. Weight is a locally significant attribute used to influence path selection. Routes learned from a neighbor with a higher weight are preferred.

Test iBGP - Neighbor weight

Description

Test to verify that the weight attribute is applied to routes learned from a BGP neighbor. DUT0 is configured with weight 12345 for peer DUT1. Routes received from DUT1 should have weight 12345.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.10.0.100/24
set protocols bgp 20 neighbor peer remote-address 10.10.0.200
set protocols bgp 20 neighbor peer remote-as 20
set protocols bgp 20 neighbor peer weight 12345
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

set interfaces dummy dum0 address 1.1.1.1/24
set interfaces ethernet eth0 address 10.10.0.200/24
set protocols bgp 20 neighbor peer remote-address 10.10.0.100
set protocols bgp 20 neighbor peer remote-as 20
set protocols bgp 20 redistribute connected
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Attention

Verify iBGP session establishes.

Step 3: Run command protocols bgp show ip summary at DUT0 and check if output matches the following regular expressions:

10.10.0.200.*Established
Show output
IPv4 Unicast Summary:
BGP router identifier 10.10.0.100, local AS number 20 VRF default vrf-id 0
BGP table version 2
RIB entries 3, using 384 bytes of memory
Peers 1, using 24 KiB of memory

Neighbor        LocalAddr       V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down        State   PfxRcd   PfxSnt Desc
10.10.0.200     10.10.0.100     4         20         5         4        2    0    0 00:00:02  Established        2        0 FRRouting/10.4.1

Total number of neighbors 1

Attention

Verify that route 1.1.1.0/24 is received with weight 12345.

Step 4: Run command protocols bgp show ip 1.1.1.0/24 at DUT0 and check if output matches the following regular expressions:

weight 12345
Show output
BGP routing table entry for 1.1.1.0/24, version 1
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    10.10.0.200 from 10.10.0.200 (10.10.0.200)
      Origin incomplete, metric 0, localpref 100, weight 12345, valid, internal, best (First path received)
      Last update: Thu Mar  5 14:54:09 2026