Mikrotik – Configure BGP (eBGP) for a given network

Published on Author gryzliLeave a comment

I assume the following setup:

Router1 (Some external router) , with AS: 65532

Mikrotik router (our internal router) , with AS: 65535

Network prefix: 1.1.1.1/24 , delegated to AS 65535 (our internal router)

Router1.IP == 1.1.1.1/24

Mikrotik.IP == 1.1.1.2/24

===============================

1. Enable BGP on the Mikrotik router

[admin@MikroTik] /interface> /routing bgp instance set default as=65535 redistribute-static=no router-id=1.1.1.2

 

2. Add our network to BGP on Mikrotik

[admin@MikroTik] > /routing bgp network add network=1.1.1.1/24  comment="Network delegated to our AS: 65535"

 

3. Create input/output filters on Mikrotik router

We must create input/output filters on our router in order we to NOT annouce other network.

When using invert-match=yes, we tell the router to discard everything BUT the prefix stated

# Allow only 1.1.1.1/24 as annoucements
[admin@MikroTik] > /routing filter add chain=to_R1 prefix=1.1.1.1/24 invert-match=yes action=discard

 

4. Add BGP neighbour R1 to Mikrotik

[admin@MikroTik] > /routing bgp peer add remote-address=1.1.1.1 remote-as=65532

 

5. Finally … Validate the route for the network

[admin@MikroTik] /routing bgp advertisements> /ip  route print where dst-address=1.1.1.1/24

 

Leave a Reply

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