Table of Contents
BGPTraffic engineering is about making sure that internet traffic takes the path. This means that Traffic Engineering with BGP has to deal with traffic that is coming into the network and traffic that is going out of the network. The goal of Traffic Engineering with BGP is to make the network work better, be cheaper and be more reliable.
There are two ways that Traffic Engineering with BGP does this: BGP Communities and MED. BGP Communities are like labels that can be put on traffic to tell the network what to do with it. MED is a way to decide which path traffic should take when there are paths to the same place on the network.
BGP Communities for Traffic Engineering
BGP communities are like labels that are attached to routes. These labels are made up of a number and a value. They help network operators control how traffic moves through their network and other networks. This is really useful because it lets operators make specific decisions about how traffic is routed.
When traffic is leaving your network, communities help decide which path it takes. You can add a community to a route that tells networks how much they should prefer that path. For example a community like ASN:200 might tell a neighboring network to make that path the preferred one. On the other hand ASN:50 might tell them to use it as a backup. Operators can also ask neighboring networks to add their network information to the route, which makes it less attractive to other networks. There are some communities, like NO_EXPORT that prevent routes from being advertised to other networks.

When traffic is coming into your network communities are sent to the networks that provide you with internet access. These networks have to follow the instructions in the communities. Big network providers have their systems for using communities. For example Cogent uses 174:10 to ask neighboring networks to add their network information and 174:20 to ask them to add it twice. Lumen and NTT have their own systems too. By using these communities you can control how traffic comes into your network and avoid areas.
There is also something called communities, which give you even more control. They use a format that includes more information. This is useful for things like tagging traffic based on where it comes from, what type of peer it’s, what kind of service it is. For example 64496:1:10 might indicate that traffic comes from Europe. This gives network operators a lot of flexibility and control over their traffic.
MED (Multi-Exit Discriminator) for Traffic Engineering
MED is a setting used in BGP (Border Gateway Protocol) when two connected networks have multiple links. It helps the neighboring network decide which link to use when traffic comes in. The lower the MED value, the more preferred the link is.
When you have connections to the same network provider or partner you can set different MED values on each link. A MED value of 0 makes a link the most preferred. Higher MED values, like 100 or more mean the link is less preferred or used as a backup. This helps in setting up active/backup systems. In these systems one link handles all traffic until it fails. It also helps in load balancing. In load balancing different traffic paths get MED values. This way traffic is spread across links.
Practical Use Cases for MED Include
When we have two links one is the link and the other is the backup link. We use MED 0 for the link and MED 100 for the backup link. This way all the traffic goes through the link when it is working. If the main link stops working the traffic automatically goes to the backup link.
We can also use MED to balance the traffic between two links that go to the place. For example we can use MED 100 on the link for some of the traffic and MED 100 on the second link for the rest of the traffic. This way each link carries about half of the traffic.
MED is also used to direct traffic based on where it’s coming from. Let’s say we have a network on the east coast and the west coast. We can use a MED for the east coast traffic on the east coast link and a lower MED for the west coast traffic, on the west coast link. This keeps the traffic local, which reduces how long it takes for the traffic to get to where it’s going and saves money.
Configuration Example for MED
Here is a configuration example for Multi Exit Discriminator. The Multi Exit Discriminator is used in Cisco IOS-XE. This is how it works: a route map is used to match lists of addresses and it sets the Multi Exit Discriminator value based on that. Then this value is applied to the neighbor that the information is being sent to.
For example if the address is on the east coast the Multi Exit Discriminator might be set to 10.. If the address is on the west coast the Multi Exit Discriminator might be set to 50. The same kind of thing can be done in Juniper JunOS. In Juniper JunOS a policy is. It has a special part that changes the metric value. This is all part of the policy statements. The Multi Exit Discriminator is important in these policy statements.
Limitations
Here are some important things to know about MED:
- It only affects the neighbor Autonomous System that’s right next to it and does not go any further.
- The MED value is compared between paths that come from the neighboring Autonomous System by default. However Cisco has commands like BGP med and BGP always-compare-med that can change this. If a MED value is missing many implementations think it is 0, which means it is the preferred.
- This can cause traffic to go in ways if it is not managed carefully.
With these limitations the Multi-Exit Discriminator remains useful for controlling relationships between multiple connections in a fine-grained way. The Multi-Exit Discriminator is still valuable, for this purpose.
Combining Communities and MED
Most networks use both communities and MED together to control traffic. In a setup with two transit providers and two internet exchange points outbound traffic is controlled using communities. These communities are like labels that say which path the traffic should take. For example Transit A might get a label that says it is the choice and Transit B might get a label that says it is the fourth choice. The internet exchange points might get labels that say they are the second choices. This means that the network will try to send traffic through the internet exchange points because they are free and then through the best transit provider.

For traffic coming into the network MED values are used. These values are like numbers that say how good a path is. For example some addresses on the east coast might get a number when they are sent to Transit A but a high number when they are sent to Transit B. This means that traffic for those addresses will try to come in through Transit A because it is closer. Some addresses on the west coast might get the numbers so they will try to come in through Transit B. Communities are also used to ask transit providers to make some paths less desirable which helps control traffic even more.
Using communities and MED together is an idea. Communities can handle rules, like which path to take and how to filter traffic based on where it is coming from. MED can control traffic for each address, which communities cannot do. When used together they help network operators make sure traffic is flowing in and out of the network in the way possible which saves money and makes the network more reliable. Communities and MED help network operators balance cost, performance and reliability which is important for networks, with many connections.
Operational Best Practices
To do traffic engineering with communities and MED the way we need to follow some rules. We have to keep track of all the communities we use in our network and what they are supposed to do. Which peers pay attention to them. This is really important for fixing problems and making sure everything works smoothly. We should remove communities at the edge of our network so they do not leak to peers outside. If we do not do this people might find out about our rules or things might not work the way we want them to.
When we make changes it is an idea to test them a little at a time. We can start by adding one thing. See how traffic moves then add more if we need to. We have to talk to the people who give us internet access to make sure we know which communities they support and how they compare MED values. This is because different networks do things differently.
We should watch how traffic moves before. After we make changes to traffic engineering to make sure everything works the way we want it to. We also have to check our rules for filtering prefixes to make sure we do not accept or send out communities that we should not. For MED, using the numbers for the same things everywhere like 0 for the main one, 100 for the second one and 200 for the third one makes things less confusing and easier to fix when there are problems. Traffic engineering with communities and MED is important. We have to be careful when we make changes to traffic engineering with communities and MED.
Summary
BGP Communities and MED are tools that help control network traffic. They work well together to give us control over how traffic moves on the network. BGP Communities are useful because they let us add tags to traffic and send signals to parts of the network. This helps us do things like decide which path traffic should take, add information to route announcements, filter traffic based on where it comes from and block certain routes. We can do all these things with peers on the network. MED is another tool that gives us control over where traffic enters the network. It is especially useful when we have connections to the same neighboring network.
We can use both BGP Communities and MED together to make the network work better. This means we can save money by choosing the transit and peering options, make the network faster by sending traffic to the right place and make it more reliable by setting up good backup plans. If we use these tools correctly and keep records, test them and watch how they work they will help us control network traffic effectively. This is important for networks that connect to multiple other networks. BGP Communities and MED are important for making sure network traffic flows smoothly and efficiently.
ABOUT THE AUTHOR

You can learn more about her on her linkedin profile – Rashmi Bhardwaj



