8.8 Issue with Using Private AS  Numbers
8.8.5 The local preference attribute
The local preference is a well-known discretionary attribute (type code 5). The local preference attribute is a degree of preference given to a route to compare it with other routes for the same destination; higher local preference values are preferred. local preference, as indicated by the name, is local to the AS and gets exchanged between IBGP peers only-it is not advertised to EBGP peers.

An AS connected via BGP to multiple other ASs will get routing updates about the same destinations from different ASs. local preference is usually used to set the exit point of an AS to reach a certain destination. Because this attribute is communicated within all BGP routers inside the AS, all BGP routers will have a common view on how to exit the AS.

Consider the environment illustrated in Figure . Suppose that company ANET has purchased Internet connections via two service providers, XNET and YNET. ANET is connected to YNET via a primary T3 link and to XNET via a backup T1 link.

It is important for ANET to decide what path its outbound traffic is going to take. Of course ANET's network administrators prefer to use the T3 link via YNET in normal operation because it is a high-speed link. This is where local preference comes into play: the Los Angeles router can give the routes coming from YNET a local preference of 300, and the San Jose router can give the routes coming from XNET a lower value, say 200. Because both the Los Angeles and San Jose routers are exchanging routing updates via IBGP, they both agree that the exit point of the AS is going to be via YNET because of the higher local preference.

In Figure , ANET learns route 128.213.0.0/16 via XNET and YNET. The San Jose and Los Angeles routers will agree on using YNET as the exit point for destination 128.213.0.0/16 because of the higher local preference value of 300. The local preference manipulation discussed in this case affects the traffic going out of the AS and not traffic coming into the AS. Inbound traffic can still come via the T1 link.

The weight parameter is similar to the local preference in that it gives higher preference to the route that has a higher weight. The difference is that the weight parameter is local to the router and does not get exchanged between routers. The weight parameter influences routes coming from different providers to the same router (one router with multiple connections to two or more providers). The weight parameter has a higher precedence than any other attribute; it is used as a main (proprietary) switch to determine route preference.