fbpx

BGP Protocol: History, messages and configuration on MikroTik RouterOS devices

Facebook
Twitter
LinkedIn
WhatsApp
Telegram

El (BGP) Border Gateway Protocol (Border Gateway Protocol), is a routing protocol used on the Internet to exchange routing information between autonomous systems (AS).

BGP plays a critical role in building and maintaining the Internet's global routing table.

At the end of the article you will find a small test that will allow you assess the knowledge acquired in this reading

In this article, we will explore the history of creation of the BGP protocol, the different types of BGP messages, the attributes used in making routing decisions and will also provide a guide to configure BGP on MikroTik RouterOS equipment through the line interface. commands (CLI).

History of creation of the BGP protocol

The BGP protocol was initially developed in the 1980s by the Internet Traffic Control System (IDRP) working group of the Institute of Electrical and Electronics Engineering (IEEE). The protocol was later adopted and standardized by the Internet Engineering Task Force (IETF). The most widely used version of the protocol, BGP-4, was defined in 1994.

Different types of BGP messages

BGP uses several types of messages to exchange routing information between autonomous systems. These messages include:

 

  1. OPEN: This message is used to establish a BGP session between two routers. It contains information about the BGP version being used, supported routing attributes, and authentication parameters, among other details.
  2. UPDATE: This message is the most important in BGP as it is used to announce routes and update routing information. It contains information about the reachable routes, the attributes associated with those routes, and the routing policies.
  3. KEEPALIVE: This message is used to keep the BGP session active. It is periodically exchanged between routers to confirm connectivity and the good state of the session.
  4. NOTIFICATION: This message is used to inform a router of an error or event that has occurred in the BGP session. It may indicate session termination or configuration problems.

BGP attributes

In the world of network connectivity, the BGP protocol plays a crucial role in exchanging routing information between autonomous systems (AS). MikroTik RouterOS, an operating system used in routing and firewall equipment offers a wide range of BGP attributes that allow network administrators to make intelligent decisions and optimize routing.

The most used BGP attributes in MikroTik RouterOS, analyzing how they are applied and how they can contribute to more efficient and reliable routing, are the following:

AS_PATH:

The AS_PATH attribute specifies the path followed by the advertised route across different autonomous systems. In MikroTik RouterOS, the AS_PATH attribute can be used to influence routing, such as filtering routes based on the presence or absence of certain autonomous systems in the path.

NEXT_HOP:

The NEXT_HOP attribute indicates the IP address of the next hop to reach the advertised route. In MikroTik RouterOS, this attribute is set automatically and is based on the selected exit interface to reach the next hop. It is essential to ensure that the next hop IP address is reachable and correctly configured to ensure optimal connectivity.

LOCAL_PREF:

The LOCAL_PREF attribute is used to influence the selection of the preferred route when there are multiple routes to the same network advertised by different autonomous systems. In MikroTik RouterOS, LOCAL_PREF can be configured to assign a numerical value that reflects the preference of one route relative to others. The router will select the route with the highest LOCAL_PREF as the best route.

MED (Multi-Exit Discriminator):

The MED attribute is used to influence route selection when there are multiple egress points from the same autonomous system. In MikroTik RouterOS, the MED can be configured to assign a numerical value that reflects the preference of a specific route compared to other routes on the same autonomous system. However, the MED attribute is only considered when comparing routes advertised by different autonomous systems.

COMMUNITY:

The COMMUNITY attribute is used to label routes and group them into specific categories. In MikroTik RouterOS, COMMUNITIES can be applied using filtering rules to control routing. This allows for greater control and flexibility when selecting routes based on custom criteria.

ORIGINAL:

The ORIGIN attribute indicates the origin of the advertised route. It can be IGP (Interior Gateway Protocol), EGP (Exterior Gateway Protocol) or INCOMPLETE (route learned from an unknown source). In MikroTik RouterOS, this attribute can be used to influence the selection of routes based on their origin.

BGP Protocol: History, messages and configuration on MikroTik RouterOS devices

BGP configuration on MikroTik RouterOS devices

Below is a basic guide to configuring BGP on MikroTik RouterOS machines using the command line interface (CLI):

  1. Connect and configure the network interfaces on both MikroTik routers.
  2. Access the MikroTik RouterOS CLI using SSH, Telnet or the console interface.
  3. Configure the IP addresses of the interfaces and ensure that there is connectivity between the routers.
  4. Enable BGP on both routers by running the following command:
				
					/routing bgp instance set default as=AS_NUMBER router-id=ROUTER_ID
				
			

5. Add the networks you want to advertise using the following command:

				
					/routing bgp network add network=NETWORK_ADDRESS
				
			

6. Establish the BGP session with the other router by running the following command:

				
					/routing bgp peer add remote-address=REMOTE_IP remote-as=REMOTE_AS_NUMBER
				
			

7. Check the BGP session status using the command:

				
					/routing bgp peer print
				
			

Conclusion

The BGP protocol is essential for the functioning of the Internet, as it allows routing information to be exchanged between autonomous systems. Throughout its history, we have seen how it has evolved and become the predominant protocol for routing globally.

Additionally, we have explored the different types of BGP messages and the attributes used in making routing decisions. Finally, we have provided a basic guide to configure BGP on MikroTik RouterOS devices via the CLI, which will allow you to implement and manage this protocol on your own network.

Brief knowledge quiz

What do you think of this article?
Do you dare to evaluate your learned knowledge?

QUIZ - BGP Protocol: History, messages and configuration on MikroTik RouterOS devices

Recommended book for this article

Do you want to suggest a topic?

Every week we post new content. Do you want us to talk about something specific?
Topic for the next blog

Leave a comment

Your email address will not be published. Required fields are marked with *

Days
Hours
Minutes
Seconds

Introduction to
OSPF - BGP - MPLS

Sign up for this Free course

MAE-RAV-ROS-240118
Days
Hours
Minutes
Seconds

Sign up for this Free course

MAS-ROS-240111

Promo for Three Kings Day!

KINGS24

15%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the Three Kings Day discount code!

* promotion valid until Sunday January 7, 2024
** the code (KINGS24) applies to shopping cart
*** buy your course now and take it until March 31, 2024

New Year's Eve Promo!

NY24

20%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the New Year's Eve discount code!

* promotion valid until Monday, January 1, 2024
** the code (NY24) applies to shopping cart
*** buy your course now and take it until March 31, 2024

Christmas discounts!

XMAS23

30%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the discount code for Christmas!!!

**codes are applied in the shopping cart
Promo valid until Monday December 25, 2023

CYBER WEEK DISCOUNTS

CW23-MK

17%

all MikroTik OnLine courses

CW23-AX

30%

all Academy courses

CW23-LIB

25%

all MikroTik Books and Book Packs

Take advantage of the discount codes for Cyber ​​Week!!!

**codes are applied in the shopping cart
Promo valid until Sunday December 3, 2023

BLACK FRIDAY DISCOUNTS

BF23-MX

22%

all MikroTik OnLine courses

BF23-AX

35%

all Academy courses

BF23-LIB

30%

all MikroTik Books and Book Packs

Take advantage of the discount codes for Black Friday!!!

**Codes are applied in the shopping cart

codes are applied in the shopping cart
valid until Sunday November 26, 2023

Days
Hours
Minutes
Seconds

Sign up for this Free course

MAE-VPN-SET-231115

Halloween promo

Take advantage of discount codes for Halloween.

Codes are applied in the shopping cart

HW23-MK

11% discount on all MikroTik OnLine courses

11%

HW23-AX

30% discount on all Academy courses

30%

HW23-LIB

25% discount on all MikroTik Books and Book Packs

25%

Register and participate in the free course Introduction to Advanced Routing with MikroTik (MAE-RAV-ROS)

Today (Wednesday) October 11, 2023
7pm to 11pm (Colombia, Ecuador, Peru)

MAE-RAV-ROS-231011