Contact Info

Atlas Cloud LLC 600 Cleveland Street Suite 348 Clearwater, FL 33755 USA

support@dedirock.com

Client Area
Recommended Services
Supported Scripts
WordPress
Hubspot
Joomla
Drupal
Wix
Shopify
Magento
Typeo3

Building a Redundant Network with Mikrotik and BGP for High Availability

Building a redundant network is essential for ensuring high availability and minimizing downtime in critical systems. Mikrotik routers, combined with Border Gateway Protocol (BGP), offer a robust solution for network failover and redundancy. In this guide, we’ll explore the practical steps to configure a redundant network using Mikrotik and BGP.

1. Why Redundancy and BGP Are Important

High availability is crucial for businesses that rely on uninterrupted connectivity. Redundancy ensures that if one link or router fails, another can take over without significant impact.

  • BGP (Border Gateway Protocol): BGP is a powerful protocol for managing routing between different networks, enabling failover and load balancing.

  • Mikrotik Routers: These are cost-effective, feature-rich devices that support advanced networking features like BGP.

2. Prerequisites for Setting Up Redundancy

Before configuring redundancy, ensure the following:

  • Mikrotik Routers: At least two Mikrotik routers to act as primary and backup devices.

  • Multiple ISPs: Two or more internet service providers for redundancy.

  • Public IP Addresses: Allocated public IPs for configuring BGP sessions.

  • ASN (Autonomous System Number): An ASN from a Regional Internet Registry (RIR).

3. Configuring BGP on Mikrotik Routers

Step 1: Enable BGP on Mikrotik

Access the Mikrotik router and enable BGP:

				
					/routing bgp instance
add name="default" as=64512 router-id=192.168.1.1
				
			

Step 2: Add BGP Peers

Define BGP peers to establish connections with your ISPs:

				
					/routing bgp peer
add name="ISP1" remote-address=203.0.113.1 remote-as=65501 instance="default"
add name="ISP2" remote-address=203.0.113.2 remote-as=65502 instance="default"
				
			

Step 3: Configure Prefixes

Advertise your public IP prefixes to the ISPs:

				
					/routing filter
add chain=bgp-out prefix=192.0.2.0/24 action=accept
/routing bgp network
add network=192.0.2.0/24
				
			

Step 4: Monitor BGP Sessions

Verify the status of BGP sessions:

				
					/routing bgp peer print
				
			

Ensure that the state shows established for all peers.

4. Implementing Failover and Load Balancing

Failover Configuration

Set up route prioritization to ensure failover:

				
					/ip route
add dst-address=0.0.0.0/0 gateway=203.0.113.1 distance=1
add dst-address=0.0.0.0/0 gateway=203.0.113.2 distance=2
				
			

The lower distance value is preferred, ensuring ISP1 is the primary gateway. If ISP1 fails, traffic automatically switches to ISP2.

Load Balancing

Distribute traffic across both ISPs:

				
					/ip route
add dst-address=0.0.0.0/0 gateway=203.0.113.1 routing-mark=to-ISP1
add dst-address=0.0.0.0/0 gateway=203.0.113.2 routing-mark=to-ISP2
/mangle
add chain=prerouting src-address=192.0.2.0/24 action=mark-routing new-routing-mark=to-ISP1
add chain=prerouting src-address=192.0.2.128/25 action=mark-routing new-routing-mark=to-ISP2
				
			

5. Testing the Redundant Setup

Simulate ISP Failure

Disconnect one ISP link and check if the traffic fails over to the backup link. Use the following command to monitor routes:

				
					/ip route print
				
			

Verify BGP Advertisements

Ensure your prefixes are being advertised correctly:

				
					/routing bgp advertisements
				
			

6. Best Practices for Redundancy

  • Monitor BGP Sessions: Use monitoring tools to ensure BGP sessions are stable.

  • Implement Security: Secure your BGP setup with MD5 authentication.

  • Use Redundant Hardware: Consider dual power supplies and redundant routers for hardware reliability.

  • Regular Backups: Backup Mikrotik configurations regularly.

Conclusion

Setting up a redundant network with Mikrotik and BGP ensures high availability and enhances network resilience. By following this guide, you can create a failover-ready infrastructure that minimizes downtime and maximizes performance. Whether you’re managing a business-critical network or a large enterprise, redundancy is a key factor in delivering uninterrupted connectivity.

Share this Post
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x