BGP · Topic 1 of 7
Autonomous Systems, BGP and the Path Vector Algorithm
Learn what an autonomous system is, why the internet uses BGP between ASes, and how the path vector algorithm uses the AS path to avoid routing loops.
- 5 min
- An AS is a set of networks under one administration and one routing policy.
- BGP is the routing protocol used between autonomous systems.
- BGP is a path vector protocol, so it carries the list of ASes a route crossed.
What it is
An autonomous system is a group of networks run by one organisation under one routing policy.
Each AS is identified by an AS number. The internet is a large set of such systems that exchange reachability information with each other.
BGP (Border Gateway Protocol) is the routing protocol that carries this information between autonomous systems. It is the only protocol in common use for that job.
How it works
BGP exchanges prefixes with attributes, and the AS path attribute drives loop prevention.
Autonomous system numbers
An AS number is a label for a routing domain. Public numbers are handed out by the registries. A block of numbers is reserved for private use, and the classic 16 bit private range is 64512 to 65534.
RouterOS accepts 4 byte AS numbers as well as the older 2 byte ones. A private number is fine for a lab or for a customer that sits behind one provider.
An IGP versus BGP
An interior protocol such as OSPF finds the best path inside one AS, usually by link cost. BGP does not find the fastest path. It applies policy to choose between paths that other ASes offer.
| Property | OSPF or RIP (IGP) | BGP (EGP) |
|---|---|---|
| Scope | Inside one AS | Between ASes |
| Decision basis | Metric or cost | Attributes and policy |
| Neighbour discovery | Automatic | Manually configured peers |
| Typical use | Inside one network | Between organisations |
BGP peers are configured by hand. Each router needs to be told the address of its neighbour and the AS number the neighbour belongs to.
The path vector algorithm
A distance vector protocol shares a metric. A path vector protocol shares the full list of ASes a route has passed through, called the AS path.
Each time a route leaves an AS over eBGP, that AS adds its own number to the front of the list. The receiving router can see the whole route history.
This gives BGP its loop protection. When a router receives an update whose AS path already contains its own AS number, it ignores the route. No timers or hop counts are needed.
The AS path also acts as a rough distance measure. A shorter path is preferred, all else being equal, which the best path page covers.
A first configuration
The following is the RouterOS v6 form. An instance holds the local AS and router ID, and a peer points at the neighbour.
/routing bgp instance set default as=65001 router-id=10.255.255.1
/routing bgp peer add name=isp1 remote-address=203.0.113.1 remote-as=100
/routing bgp network add network=198.51.100.0/24
/routing bgp peer print status
/ip route print where bgp
routing bgp instancedefines the local AS number and the router ID.routing bgp peerdefines each neighbour withremote-addressandremote-as.routing bgp networklists the prefixes this router originates.routing bgp peer print statusshows each neighbour and the state of its session.ip route print where bgpshows the routes that BGP installed.
RouterOS v7 restructures this configuration. The instance and peer menus are replaced by connections and templates, so check which version a question assumes.
A peer is eBGP when remote-as differs from the local AS, and iBGP when the numbers are equal.
What to remember for the exam
Seven facts cover most questions here.
- An AS is a set of networks under one administration and one routing policy.
- BGP is the routing protocol used between autonomous systems.
- BGP is a path vector protocol, so it carries the list of ASes a route crossed.
- A router drops a route if its own AS number is already in the AS path.
- Private AS numbers in the 16 bit range run from 64512 to 65534.
- BGP neighbours are configured manually, unlike IGP neighbours.
- BGP chooses by policy and attributes, not simply by speed.
Do not describe BGP as a distance vector protocol with hop counts. The exam answer is path vector.
Common mistakes
These four errors are easy to make.
Treating BGP as a faster OSPF. BGP is built for policy and scale between organisations, not for quick convergence inside one network.
Forgetting that peers are manual. A BGP session will not appear just because two routers share a link. Both sides need a matching peer entry.
Mixing up the AS number of a peer. If remote-as is wrong, the session fails at the open stage and never reaches the established state.
Expecting a prefix to appear automatically. BGP advertises only what you tell it to originate or redistribute, so a missing routing bgp network entry means a missing route.
Check yourself
Work through these three questions.
What is an autonomous system, and how is one identified?
It is a group of networks under one administration and one routing policy. It is identified by an AS number.
Why is BGP called a path vector protocol, and how does it prevent loops?
It carries the list of ASes a route has crossed, called the AS path. A router that sees its own AS number in the path ignores the route.
Which command shows the state of the configured BGP neighbours?
/routing bgp peer print statusshows each peer and its session state.
Topic 1 of 7 in BGP
Test yourself on BGP
The full MikroTik MTCINE question bank has 475 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by MikroTik. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.