The Multi-Exit Discriminator (MED) is used in BGP to control inbound traffic into your AS. It tells a neighboring AS which entry point into your network it should prefer when there are multiple links between your AS and the neighboring AS. The lower the MED value, the more preferred the path.
- MED is only honored between the same neighboring AS.
Example Scenario:
You are connected to ISP1 via two routers, CE1 and CE2, and want to control which router ISP1 uses to send traffic into your AS.
Network Topology:
- CE1 (connected to ISP1): 10.0.1.1/30
- CE2 (connected to ISP1): 10.0.2.1/30
- iBGP Router (Internal) connected to both CE1 (10.0.1.2/30) and CE2 (10.0.2.2/30).
Configuration on CE1 (Lower MED, More Preferred):
Create a route map to set the MED to 50 for CE1:
route-map SET_MED permit 10 set metric 50
Apply this route map to the neighbor in the BGP configuration for CE1:
router bgp 65001 neighbor 10.0.1.1 remote-as 65000 neighbor 10.0.1.1 route-map SET_MED out
Configuration on CE2 (Higher MED, Less Preferred):
Create a route map to set a higher MED (200) for CE2:
route-map SET_MED permit 10 set metric 200
Apply this route map to the neighbor in the BGP configuration for CE2:
router bgp 65001 neighbor 10.0.2.1 remote-as 65000 neighbor 10.0.2.1 route-map SET_MED out
Result:
ISP1 will prefer CE1 as the entry point into your AS because CE1 advertises a lower MED value.
Comments
Post a Comment