The Border Gateway Protocol (BGP) allows setting up an interdomain dynamic routing system that automatically updates routing tables of devices running BGP in case of network topology changes.
MikroTik RouterOS supports BGP Version 4, as defined in RFC 4271
Standards and Technologies:
/routing/bgp/template
The template contains all BGP protocol related configuration options. It can be used as a template for dynamic peers and to apply similar configuration to a group of peers. Note that this is not the same as peer groups on Cisco devices, where the group is more than just a common configuration.
Property | Description | |
---|---|---|
add-path-out (all |none; Default: ) | ||
address-families (ip | ipv6 | l2vpn | l2vpn-cisco | vpnv4; Default: ip) | List of address families about which this peer will exchange routing information. The remote peer must support (they usually do) BGP capabilities optional parameter to negotiate any other families than IP. | |
allow-as-in (integer [0..10]; Default: ) | How many times to allow own AS number in AS-PATH, before discarding a prefix. | |
as (integer [0..4294967295]; Default: ) | 32-bit BGP autonomous system number. Value can be entered in AS-Plain and AS-Dot formats. | |
as-override (yes | no; Default: no) | If set, then all instances of remote peer's AS number in BGP AS PATH attribute are replaced with local AS number before sending route update to that peer. Happens before routing filters and prepending. | |
cisco-vpls-nlri-len-fmt (auto-bits | auto-bytes | bits | bytes; Default: ) | VPLS NLRI length format type. Used for compatibility with Cisco VPLS. [[Read more>>]]. | |
cluster-id (IP address; Default: ) | In case this instance is a route reflector: cluster ID of the router reflector cluster this instance belongs to. This attribute helps to recognize routing updates that comes from another route reflector in this cluster and avoid routing information looping. Note that normally there is only one route reflector in a cluster; this case 'cluster-id' does not need to be configured and BGP router ID is used instead | |
default-originate (always | if-installed | never; Default: never) | Specifies how to distribute default route | |
default-prepend (integer [0..255]; Default: ) | ||
disabled (yes | no; Default: no) | Whether template is disabled. | |
hold-time (time[3s..1h] | infinity; Default: 3m) | Specifies the BGP Hold Time value to use when negotiating with peers. According to the BGP specification, if router does not receive successive KEEPALIVE and/or UPDATE and/or NOTIFICATION messages within the period specified in the Hold Time field of the OPEN message, then the BGP connection to the peer will be closed. The minimal hold-time value of both peers will be actually used (note that the special value 0 or 'infinity' is lower than any other values)
| |
ignore-as-path-len (yes | no; Default: no) | Whether to ignore AS_PATH attribute in BGP route selection algorithm | |
input - group of parameters associate with BGP input | ||
.accept-comunities (string; Default: ) | Quick way to filter incoming updates with specific communities. If it is known that the update should be dropped before decoding it and sending to the routing filters, then this update can be dropped here. Main benefit is reduction of the memory usage, information form the update message will not be decoded and stored anywhere. | |
.accept-ext-communities(string; Default: ) | Quick way to filter incoming updates with specific extended communities. If it is known that the update should be dropped before decoding it and sending to the routing filters, then this update can be dropped here. Main benefit is reduction of the memory usage, information form the update message will not be decoded and stored anywhere. | |
.accept-large-comunities (string; Default: ) | Quick way to filter incoming updates with specific large communities. If it is known that the update should be dropped before decoding it and sending to the routing filters, then this update can be dropped here. Main benefit is reduction of the memory usage, information form the update message will not be decoded and stored anywhere. | |
.accept-nlri(string; Default: ) | Quick way to filter incoming updates with specific NLRIs. If it is known that the update should be dropped before decoding it and sending to the routing filters, then this update can be dropped here. Main benefit is reduction of the memory usage, information form the update message will not be decoded and stored anywhere. | |
.accept-unknown(string; Default: ) | Quick way to filter incoming updates with specific "unknown" attributes. If it is known that the update should be dropped before decoding it and sending to the routing filters, then this update can be dropped here. Main benefit is reduction of the memory usage, information form the update message will not be decoded and stored anywhere. | |
.affinity(afi | alone | instance | main | remote-as | vrf; Default: ) | Configure input multicore processing. Read more in Routing Protocol Multi-core Support article.
| |
.filter(name; Default: ) | Name of the routing filter chain to be used on input prefixes. Happens after NLRIs are processed. If the chain is not specified, then BGP by defaults accepts everything. | |
keepalive-time (time [1s..30m]; Default:3m ) | How long to keep BGP session open after the last received "keepalive" message. | |
multihop (yes | no; Default: no) | Specifies whether the remote peer is more than one hop away. This option affects outgoing nexthop selection as described in RFC 4271 (for EBGP only, excluding EBGP peers local to the confederation). It also affects:
| |
name (string; Default: ) | Name of the BGP template | |
nexthop-choice (default | force-self | propagate; Default: default) | Affects the outgoing NEXT_HOP attribute selection. Note that nexthops set in filters always takes precedence. Also note that nexthop is not changed on route reflection, expect when it's set in filter.
| |
no-client-to-client-reflection (yes | no; Default: ) | Disable client to client route reflection in Route Reflector setups. | |
no-early-cut (yes | no; Default: ) | Early cut is the mechanism, to guess (based on default RFC behaviour) what would happen with the sent NPLRI when received by the remote peer. If the algorithm determines that the NLRI is going to be dropped, peer will not even try to send it. However such a behaviour may not be desired in specific scenarios, then then this option should be used to disable early cut feature. | |
output - group of parameters associate with BGP output | ||
.affinity(afi | alone | instance | main | remote-as | vrf; Default: ) | Configure output multicore processing. Read more in Routing Protocol Multi-core Support article.
| |
.filter(name; Default: ) | Name of the routing filter chain to be used on output prefixes. If the chain is not specified, then BGP by defaults accepts everything. | |
.network(name; Default: ) | Name of the address list, used to send local networks. The network is sent only if matching IGP route exists in the routing table. | |
remove-private-as (yes | no; Default: no) | If set, then BGP AS-PATH attribute is removed before sending out route update if attribute contains only private AS numbers. removal process happens before routing filters are applied and before local AS number is prepended to the AS path. | |
router-id (IP | name; Default: main ) | BGP Router ID to be used. Use the ID from the /routing/router-id configuration by specifying reference name, or set ID directly by specifying IP. Equal router-ids are also used to group peers into one instance. | |
routing-table (string; Default: ) | Name of the routing table BGP connections operates on. By default always use the "main" routing table. | |
templates (name[,name]; Default: ) | List of template names from which to inherit parameters. Useful feature, to easily configure groups with overlapping configuration options. | |
use-bfd (yes | no; Default: no) | Whether to use the BFD protocol for faster connection state detection. | |
vrf (name; Default: main ) | Name of the VRF, to install routes in. |
/routing/bgp/connection
This menu is used to define BGP outgoing connections as well as listen on single or group of remote BGP peer connections. In addition to connection specific parameters, template specific parameters are also directly exposed in this menu, for easier configuration in simple scenarios (when templates are not necessary).
Property | Description | |
---|---|---|
name (string; Default: ) | Name of the BGP connection | |
connect (yes | no; Default: yes) | Whether to allow router to initiate connection. | |
listen (yes | no; Default: yes) | Whether to listen for incoming connections. | |
local - group of parameters associated with local side of the connection | ||
.address (IPv4/6; Default: ::) | Local connection address. | |
.port(integer [0..65535]; Default:179 ) | Local connection port. | |
.role(ebgp | ebgp-customer | ebgp-peer | ebgp-provider | ebgp-rs | ebgp-rs-client | ibgp | ibgp-rr | ibgp-rr-client; Default: ) | BGP role, in most common scenarios it should be set to iBGP or eBGP. More information on BGP roles can be found in corresponding RFC draft https://datatracker.ietf.org/doc/draft-ietf-idr-bgp-open-policy/?include_text=1) | |
remote - group of parameters associated with remote side of the connection | ||
.address (IPv4/6; Default: ::) | Remote address used to connect and/or listen to. | |
.port(integer [0..65535]; Default:179 ) | Local connection port. | |
.as(integer []; Default: ) | Remote AS number. If not specified BGP will determine remote AS automatically from the OPEN message. | |
.allow-as() | List of remote AS number that are allowed to connect. Useful for dynamic peer configuration. | |
rx-min-ttl (integer [1..255]; Default:) | Time To Live, the hop limit for TCP connection. For example, if 'ttl=1' then only single hop neighbours will be able to establish the connection. This property only affects EBGP peers. | |
tcp-md5-key (string; Default: ) | Key used to authenticate the connection with TCP MD5 signature as described in RFC 2385. If not specified, authentication is not used. | |
templates (name[,name]; Default: default) | List of the template names, to inherit parameters from. Useful for dynamic BGP peers. | |
tx-ttl (integer [1..255]; Default:) | Time To Live, the hop limit for TCP connection. For example, if 'ttl=1' then only single hop neighbours will be able to establish the connection. This property only affects EBGP peers. |
/routing/bgp/session
This menu shows read-only cached BGP session information.
Even if BGP session is not active anymore, the cache can still be stored for some time. Routes received from particular session are removed only if cache expires, this allows to mitigate extensive routing table recalculations if BGP session is flapping.
/routing/bgp/vpn
Property | Description | |
---|---|---|
disabled (yes | no; Default: ) | ||
export-filter (name; Default: ) | The name of the routing filter chain used to filter prefixes before exporting. | |
export-route-targets (rt[,rt]; Default: ) | Route targets to be added when exporting VPNv4 routes. | |
import-filter (integer [0..4294967295]; Default: ) | The name of the routing filter chain used to filter prefixes before importing. | |
import-route-targets (rt[,rt]; Default: ) | Import VPNv4 routes with matching route targets. | |
label-allocation-policy (per-prefix | per-vrf; Default: ) | ||
route-distinguisher (string; Default: ) | ||
vrf (name; Default: ) | Name of the VRF table to install routes to. |
/routing/bgp/advertisements
Read only information about outgoing routing information currently advertised.
This information is calculated dynamically after 'print' command is issued. As a result, it may not correspond to the information that at the exact moment has been sent out. Especially if in case of slow connection, routing information prepared for output will spend long time in buffers. 'advertisements print' will show as things should be, not as they are!
Note: At the moment AS-PATH attribute for advertised routes is shown without prepends.
Property | Description |
---|---|
aggregator (IP) | Advertised AGGREGATOR attribute value |
as-path (string) | Advertised AS_PATH attribute value |
atomic-aggregate (yes | no) | Advertised ATOMIC_AGGREGATE attribute value |
bgp-ext-communities () | |
cluster-list (string) | Advertised CLUSTER_LIST attribute value |
communities () | |
local-pref (integer) | Advertised LOCAL_PREF attribute value |
med (integer) | Advertised MULTI_EXIT_DISC attribute value |
nexthop (IP | IPv6) | Advertised NEXT_HOP attribute value |
origin (igp | egp | incomplete) | Advertised ORIGIN attribute value |
originator-id (IP) | Advertised ORIGINATOR_ID attribute value |
peer (string) | Name of the peer this information is advertised to |
prefix (IPv4 | IPv6 prefix) | Advertised NLRI prefix |