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:
- 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.
- 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.
- 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.
- 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 configuration on MikroTik RouterOS devices
Below is a basic guide to configuring BGP on MikroTik RouterOS machines using the command line interface (CLI):
- Connect and configure the network interfaces on both MikroTik routers.
- Access the MikroTik RouterOS CLI using SSH, Telnet or the console interface.
- Configure the IP addresses of the interfaces and ensure that there is connectivity between the routers.
- 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?
Recommended book for this article
BGP and MPLS RouterOS v7 book
Study material for the MTCINE Certification Course updated to RouterOS v7
Related Posts
- Virtual Private LAN Service (VPLS): An advanced approach to network connectivity
- BGP RPKI in MikroTik RouterOS: Concepts, Uses and Scenarios
- Network Optimization with Traffic Engineering: Designing Efficient Data Flow
- MPLS: A Versatile Technology to Optimize Networks
- Loopback Interfaces: Boosting Stability and Connectivity in Modern Networks