Assigning a Weight to a Route
You can assign a weight to a route when more than one route exists to the same
destination. A weight indicates a preference for that particular route over the other
routes to that destination. The higher the assigned weight, the more preferred the
route. By default, the route weight is 32768 for paths originated by the router, and
0 for other paths.
In the configuration shown in Figure 31 on page 112, routers Boston and NY both
learn about network 192.68.5.0/24 from AS 200. Routers Boston and NY both
propagate the route to router LA. Router LA now has two routes for reaching
192.68.5.0/24 and must decide the appropriate route. If you prefer that router LA
direct traffic through router Boston, you can configure router LA so that the weight
of routes coming from router Boston are higher—more preferred—than the routes
coming from router NY. Router LA subsequently prefers routes received from router
Boston and therefore uses router Boston as the next hop to reach network
192.68.5.0/24.
Figure 31: Assigning a Weight to a Neighbor Connection
You can use any of the following three ways to set the weights in routes coming in
from router Boston:
â– The neighbor weight command
â– The set weight command in route maps
â– An AS-path access list
Using the neighbor weight Command
The following commands assign a weight of 1000 to all routes router LA receives
from AS 100 and assign a weight of 500 to all routes router LA receives from AS 300:
host1(config)#router bgp 400
host1(config-router)#neighbor 10.5.5.1 remote-as 100
host1(config-router)#neighbor 10.5.5.1 weight 1000
112 â– Selecting the Best Path
JUNOSe 11.1.x BGP and MPLS Configuration Guide