BGP attribute for exporting routes

Which BGP attribute use for exporting routes.??? & how ???

Actually this question asked me twice to interview.

BGP uses attributes to control the advertisement of routes to its peers. While BGP itself does not “export” routes, it advertises routes to its neighboring routers or autonomous systems (ASs). The attributes in BGP help shape the routing decisions and influence the path selection.

Two commonly used attributes for advertising routes are the Local Preference and the Multi-Exit Discriminator (MED).

The Local Preference attribute is used within an AS to determine the preferred exit point for outbound traffic. By assigning a higher value to the Local Preference, the router indicates that it prefers to exit the AS through that particular path. The Local Preference attribute is exchanged and considered within the AS itself.

The Multi-Exit Discriminator (MED) attribute is used to provide guidance to neighboring ASs or external peers on how to enter the AS. It represents a suggestion from one AS to another about the preferred path for inbound traffic. The lower the MED value, the more preferred the path is. However, it’s important to note that MED is not always honored by neighboring ASs, as its interpretation and handling can vary.

In addition to Local Preference and MED, there are several other BGP attributes that can be utilized to influence route advertisements and path selection, such as the AS Path attribute, Next Hop attribute, Community attribute, and more.

So, in summary, BGP uses attributes such as Local Preference and MED to influence the advertisement and path selection of routes among peers or neighboring ASs. These attributes help guide traffic flow within an AS and provide suggestions to external peers on preferred routes for inbound traffic.

I have attached some pictures of a lab topology using local preference and MED.
in one of them you will see that the local preference was not applied and the prefer router was and then after the local preference is applied the is prefer

*>i 0 200 0 1300 ?

  •                 110             0 1300 ?

this is because the attributes have a rpiority and local preference has a higher priority than MED.
here are some of the attributes and their priority :

| Priority | Attribute |

|1| Weight|
|2| Local Preference|
|3| Originate|
|4| AS path length|
|5| Origin code|
|6| MED|
|7| eBGP path over iBGP path|
|8| Shortest IGP path to BGP next hop|
|9| Oldest path|
|10| Router ID|
|11 |Neighbor IP address|


Great share Carlos, You are doing great !!