These days have been looking at BGP, I think the attribute of BGP is a difficult point, sometimes look at to their own are confused, especially the difference between LOCAL-PREF and MED in BGP. after finding some information on the Internet, I can understand a lot.
Med is used to affect the inbound traffic. It is an announcement to the ebgp peer.
The local-pref is used to influence the outbound traffic. It is announced to the ibgp peer.
BGPDesign
We know that there is no planning policyBGPThe design is incomplete. BRFTBGPThe design is comprehensively planned through effective useBGPAnd design and plan a practical routing policy to better optimize the network. By controlling the routing policy, you can control the flow direction of data streams between AS, which is of great significance for protecting network security and rationally using network resources. In route policy control, traffic is controlled by attributes such as A S_PATH, Local_Preference, and MEDMULTI_EXIT_DISC. For example, the AS-PATH attribute can be used to filter data by AS. By controlling the length of the AS-Path table, such AS adding a dumb AS number) you can control which path the data goes in when other conditions are the same,BGPSelect a route with a small length AS-Path ). You can control the outbound path of a data stream by controlling the Loca1-Preference attributes of inbound) routing information. You can control the inbound path of the data stream by controlling the MED attribute of the outbound route. By setting these attributes properly, you can achieve load balancing and symmetric routing.BGPDifferent properties have different priorities, where the priority of the Loca1-Preference property is higher than the MEDMULTI-EX-IT-DISC) property, when both properties are applied to the routing policy at the same time, the routing policy executes the Loca1-Peference property.
Loca1-Preference properties can control the outbound path of business data streams. The priority of a high Loca1-Preference property value is high, as shown in 5.
You can control the inbound path of the data stream by controlling the MED attribute of the outbound route. The priority of a low MED attribute value is high, as shown in figure 6.
Pass ControlBGPAttribute to generate a routing policy. The routing protocol calls the corresponding routing policy to control the output input, so as to control and filter the network path and network traffic, as shown in figure 7.