BGP local preference attribute: a value used to instruct IBGP peers on where the traffic should leave the AS.
The local-preference is a well-known discretionary attribute. It is used to favor one route over the other inside an AS. The attribute must be included whenever a route is advertised across an IBGP session. It is never included in Update messages send to external peers. Whenever a routes are learned from multiple EBGP peers, the network administrator can use local-preference to prefer one peer over the other.
Observe the following:
In the picture above, R3 is learning about the 18.104.22.168/32 route that originated in AS100. It is learning the route via R1 and R2. The local-preference attribute for routes advertised from R1 to R3 is set to 110. Routes advertised from R2 to R3 are left at the default value, a value of 100. Whenever R3 needs to send traffic to 22.214.171.124/32, it will choose to have its traffic exit the AS via R1. This is the case even though the AS-path is longer.