fbpx

I have BGP established in MikroTik, how can I output a private block to a public one?

To output a block of private IP addresses through a public IP address using BGP on a MikroTik router, you will need to configure NAT (Network Address Translation).

This is commonly required when you want multiple devices on a private network to access the Internet through a single public IP address.

We explain how you can configure this on your MikroTik router:

Step 1: Configure Public IP

Make sure your MikroTik router has a public IP address configured on the interface that is connected to your Internet provider. This address will be used to output your private blocks.

Step 2: Configure NAT

You will use the NAT functionality to translate the private IP addresses on your network to the public IP address configured on your router. Here I show you how to configure Network Address Translation (Source NAT) to allow private IP addresses to access the Internet:

/ip firewall nat
add chain=srcnat action=masquerade out-interface=ether1

In this example, ether1 should be replaced by the name of the interface where your public IP address is configured. The action masquerade is a form of Source NAT that automatically uses the IP address of the specified interface as the source address in outgoing packets.

Step 3: Verify BGP Routes

Make sure BGP routes are configured correctly so traffic can flow to and from your router. You do not need to advertise your private IP addresses over BGP, as they are generally not routable on the Internet.

Step 4: Firewall Rules

It is important to ensure that your firewall configuration allows outbound traffic from your private addresses and necessary inbound traffic. Here is an example of a firewall rule to allow all outgoing traffic:

/ip firewall filter
add chain=forward action=accept out-interface=ether1

Additionally, ensure that any security policies necessary to protect your internal network are properly implemented.

Step 5: Testing

After configuring NAT and firewall rules, perform tests to ensure that devices on your private network can access the Internet correctly and that traffic is being NATed as expected. You can do this by checking active connections in MikroTik:

/ip firewall connection print

This will show you the active connections and you should be able to see the address translations that occur thanks to NAT.

Conclusion

Configuring NAT on a MikroTik router to allow a block of private addresses to access the Internet through a public address while using BGP is a relatively straightforward process that involves making sure you have the proper NAT, firewall, and BGP settings.

These settings help ensure that your network is secure and traffic is handled correctly.

There are no tags for this post.
Did this content help you?
Facebook
Twitter
LinkedIn
WhatsApp
Telegram

Other documents in this category

Leave your comment

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

Tutorials available at MikroLABs

No Courses Found!

DISCOUNT CODE

AN24-LIB

applies to MikroTik books and book packs

Days
Hours
Minutes
Seconds

Introduction to
OSPF - BGP - MPLS

Sign up for this Free course

MAE-RAV-ROS-240118
Days
Hours
Minutes
Seconds

Sign up for this Free course

MAS-ROS-240111

Promo for Three Kings Day!

KINGS24

15%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the Three Kings Day discount code!

* promotion valid until Sunday January 7, 2024
** the code (KINGS24) applies to shopping cart
*** buy your course now and take it until March 31, 2024

New Year's Eve Promo!

NY24

20%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the New Year's Eve discount code!

* promotion valid until Monday, January 1, 2024
** the code (NY24) applies to shopping cart
*** buy your course now and take it until March 31, 2024

Christmas discounts!

XMAS23

30%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the discount code for Christmas!!!

**codes are applied in the shopping cart
Promo valid until Monday December 25, 2023

CYBER WEEK DISCOUNTS

CW23-MK

17%

all MikroTik OnLine courses

CW23-AX

30%

all Academy courses

CW23-LIB

25%

all MikroTik Books and Book Packs

Take advantage of the discount codes for Cyber ​​Week!!!

**codes are applied in the shopping cart
Promo valid until Sunday December 3, 2023

BLACK FRIDAY DISCOUNTS

BF23-MX

22%

all MikroTik OnLine courses

BF23-AX

35%

all Academy courses

BF23-LIB

30%

all MikroTik Books and Book Packs

Take advantage of the discount codes for Black Friday!!!

**Codes are applied in the shopping cart

codes are applied in the shopping cart
valid until Sunday November 26, 2023

Days
Hours
Minutes
Seconds

Sign up for this Free course

MAE-VPN-SET-231115

Halloween promo

Take advantage of discount codes for Halloween.

Codes are applied in the shopping cart

HW23-MK

11% discount on all MikroTik OnLine courses

11%

HW23-AX

30% discount on all Academy courses

30%

HW23-LIB

25% discount on all MikroTik Books and Book Packs

25%

Register and participate in the free course Introduction to Advanced Routing with MikroTik (MAE-RAV-ROS)

Today (Wednesday) October 11, 2023
7pm to 11pm (Colombia, Ecuador, Peru)

MAE-RAV-ROS-231011