Border Gateway Protocol (BGP) Routing Protocol

Document revision 1.1 (23-Nov-2002)
This document applies to MikroTik RouterOS v2.7

Table of Contents

Summary

The Border Gateway Protocol (BGP) allows setting up an interdomain dynamic routing system that automatically generates the routing table for routing between autonomous systems (AS).

MikroTik RouterOS supports BGP Version 4, as defined in RFC1771.

The MikroTik RouterOS implementation of the BGP has filtering (using prefix lists) feature.

Specifications

Packages required : routing
License required : Any
Home menu level : /routing bgp
Protocols utilized : BGP (RFC1771)
Hardware usage: requires additional RAM for storing routing information (128MB recommended)

Related Documents

Software Package Installation and Upgrading
IP Addresses and Address Resolution Protocol (ARP)
Routes, Equal Cost Multipath Routing, Policy Routing
Prefix Lists

Description

The Border Gateway Protocol (BGP) is an Exterior Gateway Protocol (EGP). It allows setting up an interdomain routing system that automatically guarantees the loop-free exchange of routing information between autonomous systems (AS). It is widely used in companies assigned with a definite IP address ranges and connected to a nubmer of ISPs simultaneously so that if one of the links is down, the IP address ranges are still reachable via an another ISP.

The MikroTik RouterOS implementation of the BGP supports filtering with prefix lists, that is used for filtering received and sent routing information

The routes learned by BGP protocol are installed in the route list with the distance of 200 for iBGP (Internal BGP) routes and of 20 for eBGP (External BGP) routes.

BGP Setup

Submenu level : /routing bgp
[admin@MikroTik] routing bgp> print
                   enabled: no
                        as: 1
                 router-id: 0.0.0.0
       redistribute-static: no
    redistribute-connected: no
          redistribute-rip: no
         redistribute-ospf: no
                     state: disabled
[admin@MikroTik] routing bgp>

Property Description

enabled (yes | no, default: no) - enable or disable the BGP
as (integer, default: 1) - autonomous system number
router-id (IP address, default: 0.0.0.0) – the Router ID
redistribute-connected (yes | no, default: no) – if enabled, the router will redistribute the information about all connected routes, i.e., routes to the networks, that can be directly reached from the router
redistribute-static (yes | no, default: no) – if enabled, the router will redistribute the information about all static routes added to its routing database, i.e., routes, that have been created using the /ip route add command on the router
redistribute-rip (yes | no, default: no) – if enabled, the router will redistribute the information about all routes learned by the RIP protocol
redistribute-ospf (yes | no, default: no) – if enabled, the router will redistribute the information about all routes learned by the OSPF protocol

Statistics:

state (disabled | running | terminating) - status of the BGP:

  • disabled - not working, has been disabled
  • running - working
  • terminating - shutting dows, flushing all route information

    Notes

    Usually you want to redistribute connected and static routes, if any. Therefore change the settings for these arguments and proceed to the BGP networks.

    Example

    To enable BGP protocol specifying that router 192.168.0.206, that belongs to the 65002 AS, should redistribute the connected routes:
    [admin@MikroTik] routing bgp> set enabled=yes router-id=192.168.0.206 as=65002 \
    \... redistribute-connected=yes
    [admin@MikroTik] routing bgp> print
                       enabled: yes
                            as: 65002
                     router-id: 159.148.147.206
           redistribute-static: no
        redistribute-connected: yes
              redistribute-rip: no
             redistribute-ospf: no
                         state: running
    [admin@MikroTik] routing bgp>
    

    BGP Network

    Submenu level : /routing bgp network

    Description

    BGP Networks is a list of the networks to be advertized.

    Property Description

    network (IP address/mask, default: 0.0.0.0/0) - network to advertize.

    Notes

    You can add to the list as many networks as required.

    The router is not checking whether the network is in the routing table, it always advertises all the routes that are specified here.

    Note the difference with OSPF, that use network list for different purpose - to determine where to send updates.

    Example

    To specify the router should advertize the 159.148.150.192/27 network:
    [admin@MikroTik] routing bgp network> add network=159.148.150.192/27
    [admin@MikroTik] routing bgp network> print
      # NETWORK
      0 192.168.150.192/27
    [admin@MikroTik] routing bgp network>
    

    BGP Peers

    Submenu level : /routing bgp peer

    Description

    You need to specify the BGP peer with whom you want to exchange the routing information. The BGP exchanges routing information only if it can establish a TCP connection to its peer. You can add as many peers as required

    Property Description

    remote-address (IP address, default: 0.0.0.0) - address of the remote peer
    remote-as (integer, default: 0) - AS number of the remote peer
    multihop (yes | no, default: no) - if enabled, allows BGP sessions, even when the neighbor is not on a directly connected segment. The multihop session is not established if the only route to the multi-hop peer's address is the default route (0.0.0.0/0)
    route-reflect (yes | no, default: no) - defines whether to redistribute further the routes learned from the router of the same AS or not. If enabled, can significantly reduce traffic between routers in the same AS
    prefix-list-in (name, default: "") - name of the filtering prefix list for receiving routes
    prefix-list-out (name, default: "") - name of the filtering prefix list for advertising routes

    Statistics:

    state (connected | not-connected) - the status of the BGP connection to the peer
    routes-received - the number of received routes from this peer

    Example

    To enable routing information exchange with the neigbour (non-multihop) 192.168.0.254 that belongs to 65002 AS:
    [admin@MikroTik] routing bgp peer> add remote-address=192.168.0.254 remote-as=217
    [admin@MikroTik] routing bgp peer> print
      # REMOTE-ADDRESS  REMOTE-AS MULTIHOP ROUTE-REFLECT PREFIX-LIS... PREFIX-LI...
      0 192.168.0.254   65002     no       no            none          none
    [admin@MikroTik] routing bgp> peer print status
      # REMOTE-ADDRESS  REMOTE-AS STATE          ROUTES-RECEIVED
      0 192.168.0.254   65002     connected      1
    [admin@MikroTik] routing bgp>
    

    Troubleshooting

    Additional Resources

    Recommended readings for guidelines on building BGP networks:


    © Copyright 1999-2003, MikroTik