BGP Configuration Example using Mikrotik Router


This aricle introduce basic configuration about BGP, including ASN and E-BGP.
BGP use in TCP connection and using port 179,when connecting to the internet ,enterprise can use static route or a routing protocol name as Border Gateway Routing protocol(BGP).


Configure Basic ip address our mikrotik router

/ip address >            
add address=10.0.0.2/30 network=10.0.0.0 broadcast=10.0.0.3 interface=WAN1
add address=172.16.0.2/30 network=172.16.0.0 broadcast=172.16.0.3 interface=WAN2

Configure our AS number

routing bgp instance>
set default as=100


Configure BGP Neighbor

routing bgp peer>add name=ISP1 remote-address=10.0.0.1 remote-as=200
routing bgp peer>add name=ISP2 remote-address=172.16.0.1 remote-as=300



Verification BGP peer

routing bgp peer> print
Flags: X - disabled, E - established
 #   INSTANCE        REMOTE-ADDRESS                        REMOTE-AS
 0 E default                     10.0.0.1                                               200  
 1 E default                     172.16.0.1                                          300




Network Advertisement Configuration

routing bgp network
add network=192.168.10.0/24 synchronize=no




Outgoing and Incoming Filter Chain For ISP 1
routing filter
add chain =ISP_1-out prefix=192.168.10.0/24 action=accept
add chain=ISP_1-out action=discard


routing filter
add chain=ISP_1-in action=discard


Configure Outgoing and incoming Filter Chain For ISP 2

routing filter
add chain =ISP_2-out prefix=192.168.10.0/24 action=accept set-bgp-prepend=5


routing filter
add chain=ISP_2-in action=discard


IP Route Configuration:

/ip route
add gateway=10.0.0.1 check-gateway=ping
add gateway=172.16.0.1 check-gateway=ping distance=10

Comments