What Are BGP Attributes?
BGP attributes are the properties carried with a route that decide whether your router prefers it. One attribute change can move every outbound packet to a different provider.
Each one rides inside the UPDATE message alongside the prefix. Two providers both send you 203.0.113.0/24, their attribute values differ, and your router installs exactly one of the two.
Here BGP parts company with the interior protocols. OSPF picks a winner on a single cost number.
BGP works down a list instead. A path with the higher local preference wins even when its AS_PATH runs four times longer, because nothing further down ever gets read.
Routes only carry attributes once a session comes up. So attribute faults and BGP states faults look nothing alike.
A peer sitting in Established while traffic takes the wrong path points at an attribute. The session itself has nothing left to fix.
What Are the Four Attribute Categories?
Four categories cover every attribute. The split matters most when your router meets a value it has never seen before.
An older box that does not know LARGE_COMMUNITY still passes it along untouched. An unknown non-transitive value gets dropped at that hop instead.
Category | Must every router understand it? | What happens to an unknown one |
Well-known mandatory | Yes, and it appears in every UPDATE carrying a prefix | Cannot happen, since all implementations recognize it |
Well-known discretionary | Yes, though it need not be present | Cannot happen |
Optional transitive | No | Passed along untouched to the next AS |
Optional non-transitive | No | Dropped instead of forwarded |
Only ORIGIN, AS_PATH and NEXT_HOP carry the well-known mandatory label. An UPDATE that leaves any of the three out counts as a malformed message.
The peer answers with a NOTIFICATION and drops the session. Missing attributes get no tolerance at all, while unknown ones get plenty.
One value you set survives three networks away. Another dies at the first hop, and MED and LOCAL_PREF sit side by side in the same route policy.
The Path Attributes You Will Actually See
Each attribute carries a type code in the UPDATE. That code is how a router tells one from another.
IANA keeps the list, and it runs past forty entries. A table dump on a transit edge will show you about ten.
Attribute | Type code | Category | How far it travels |
ORIGIN | 1 | Well-known mandatory | End to end, unchanged |
AS_PATH | 2 | Well-known mandatory | End to end, with each AS prepending itself |
NEXT_HOP | 3 | Well-known mandatory | Rewritten at every eBGP hop |
MULTI_EXIT_DISC | 4 | Optional non-transitive | Into the neighboring AS only, never further |
LOCAL_PREF | 5 | Well-known discretionary | Inside your own AS only |
ATOMIC_AGGREGATE | 6 | Well-known discretionary | End to end |
AGGREGATOR | 7 | Optional transitive | End to end |
COMMUNITIES | 8 | Optional transitive | End to end, unless a policy strips it |
MP_REACH_NLRI | 14 | Optional non-transitive | Between the two peers only |
LARGE_COMMUNITY | 32 | Optional transitive | End to end, unless a policy strips it |
Read the last column before the others. Most attribute mistakes start there, when someone expects a value to reach a network it was never built to reach.
What Is BGP Local Preference?
Local preference ranks your exits, and every router inside your AS reads the same ranking. Highest wins, and a missing value gets filled in as 100.
Put 200 on your primary transit and leave the backup at 100. Every iBGP speaker then picks the primary without any config of its own.
The attribute never crosses your border. RFC 4271 bars it from eBGP updates, and a confederation sub-peer is the lone exception.
That restriction is what makes it useful. One route policy on a single edge router moves the outbound traffic of a whole network.
Raise it on one provider and your packets leave through that provider tomorrow. What arrives does not move an inch.
Your neighbors never saw the change. Pulling traffic toward you takes a different attribute entirely.
How Is MED Different from Local Preference?
MED works in the opposite direction, and the lowest value wins. You send it to a neighboring AS.
It suggests which of your links they should use coming in. That makes MED the one standard attribute aimed at inbound traffic.
The word suggest carries real weight there. Your neighbor can ignore MED outright, or strip it with a route policy.
It also travels exactly one AS further and stops, which its optional non-transitive category guarantees. Your provider will not pass your MED on to anyone behind them.
So the two attributes split the job neatly. Local preference controls traffic leaving you, while MED asks politely about traffic arriving.
What Are BGP Communities?
A community rides along as a number stuck to the route, written in the form 65000:100.
Your own router does nothing with it. The provider you send it to may do quite a lot.
No meaning ships with the number itself. RFC 1997 reserved only three well-known values, NO_EXPORT among them.
Everything past those three means whatever the receiving network says it means. The same 65000:100 does different work at two different providers.
Transit providers publish their lists, usually on one support page each. Tag a route with the right value to lower its local preference at their end.
Others will prepend their own AS for you. Some will keep your route out of one region.
That makes communities the practical lever on traffic coming in. You send a number, and their route policy does the work.
You are reaching into their local preference. Nothing else in BGP touches a value inside another network.
The original COMMUNITIES attribute packs an AS number and a tag into 32 bits. LARGE_COMMUNITY arrived in RFC 8092 with 96 bits.
Four-byte AS numbers broke the old format, since 32 bits cannot hold a 32-bit AS plus a tag. An operator running AS 4200000000 has to use the newer one.
How Does BGP Choose the Best Path?
The router works down an ordered list and stops the moment one step separates the two paths. Everything below that step goes unread.
That list is not identical on every platform. A Cisco box and the standard disagree about what comes first.
RFC 4271 lists seven tie-breaking rules in section 9.1.2.2. Cisco documents thirteen steps, and the first three of theirs sit above every rule in the RFC.
Step | Cisco's documented order | In the RFC 4271 tie-break list? |
1 | Highest WEIGHT | No, and no such attribute exists in the registry |
2 | Highest LOCAL_PREF | No, because the RFC applies it earlier as degree of preference |
3 | Locally originated route | No |
4 | Shortest AS_PATH | Yes, rule (a), the first tie-break |
5 | Lowest origin type | Yes, rule (b) |
6 | Lowest MED | Yes, rule (c) |
7 | eBGP over iBGP | Yes, rule (d) |
8 | Lowest IGP metric to the next hop | Yes, rule (e), as interior cost |
9 to 13 | Multipath, oldest path, lowest router ID, shortest cluster list, lowest neighbor address | Partly, as rules (f) and (g) |
Steps 4 through 8 match the RFC in order. Learn that middle stretch once and it holds up on Juniper, Arista and FRRouting too.
The top and the bottom are where platforms part ways. So we read the vendor's own best-path page first.
A sequence memorized on another platform has caused more than one surprising traffic shift.
Day to day the table collapses to two rows. Local preference at step 2 and AS_PATH prepending at step 4 account for nearly every change anyone makes on purpose.
Is Weight a BGP Attribute?
Weight belongs to Cisco alone. It sits at step one of their order, where the higher value wins.
A route the router originated itself starts at 32768. Anything learned from a peer starts at 0.
The IANA registry settles whether it counts as an attribute. Weight has no assigned type code (the registry runs past forty, and none of them is Weight).
So it cannot ride inside an UPDATE message at all. Nothing leaves the router carrying it.
That makes it the bluntest tool available and the easiest to forget. A weight set on one router changes that router's choice.
Every neighbor stays unaware of it. Six months later nobody remembers why one box prefers a path the others do not.
Why BGP Attributes Matter for Network Monitoring
Attribute changes move traffic without breaking anything. Nothing goes down, so nothing pages anyone.
Every session stays up. Your transit bill then arrives higher next month, and the cause sits three weeks back in a change nobody logged.
A provider adding an AS prepend causes the common version of this. Your routes look identical from inside, while the path your traffic takes has quietly changed.
So watch the AS_PATH itself. Each AS in it counts as one hop toward the tie-break at step 4.
A new one appearing overnight is worth a look. Record the path for your important prefixes and compare it against yesterday.
Prefix counts per peer work the same way. A peer that normally sends 900,000 routes and now sends 400 still shows Established, and it is still badly wrong.
Both belong beside interface and link health, not in a separate tool. Attributes, peer state and link data want one router monitoring view between them.
A routing change then becomes something you catch the same day. Finding it on the invoice is the expensive version.
Explore More IT Terms
Browse our comprehensive IT glossary to learn more about technology terminology.