|
Local Preference is a well-known
discretionary attribute (type code 5). The Local Preference
attribute is a degree of preference given to a route for comparison
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 is exchanged between IBGP peers only. Local
Preference is
not advertised to EBGP peers.
Routers within a multihomed AS may
learn that they can reach the same destination network via neighbors
in two (or more) different autonomous systems. In effect, there
could be two or more exit points from the local AS to any given
destination. You can use the Local Preference attribute to force
your BGP routers to prefer one exit point over another when routing
to a particular destination network. 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.
Note: Although routers always prefer
the lowest route metric and administrative distance for a given
destination, BGP routers prefer higher Local Preference values over
lower ones.
Consider the environment illustrated
in the 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: RTB can give the routes coming from YNET
a Local Preference of 300, and RTA can give the routes coming from
XNET a lower value, such as 200. Because both RTA and RTB 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 the figure, ANET learns route
128.213.0.0/16 via XNET and YNET. RTA and RTB 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.
|