fbpx

If an IPsec tunnel is established, do you also have to create firewall rules in MikroTik

Yes, when establishing an IPsec tunnel in MikroTik, it is recommended and often necessary to configure specific firewall rules. These rules are important for several reasons, including securing the tunnel, allowing IPsec traffic through the firewall, and protecting your network.

We explain what types of rules are usually necessary and why:

1. Allow IPsec Traffic

In order for IPsec traffic to flow through your MikroTik device and establish the tunnel correctly, you need to ensure that the firewall allows the protocols and ports used by IPsec. This usually includes:

  • ESP (Encapsulating Security Payload): Allow IP 50 protocol traffic, used by ESP to provide confidentiality, authentication and integrity.
  • AH (Authentication Header): Allow IP 51 protocol traffic, if AH is used in your IPsec configuration to provide authentication and integrity without confidentiality.
  • IKE (Internet Key Exchange): Allow UDP traffic on port 500 (and possibly port 4500 for NAT-T) for IKE, which is used for key exchange and security association negotiation.

2. Secure the Tunnel

In addition to simply allowing IPsec traffic, you may want to create rules to limit traffic through the tunnel to certain types of traffic or to certain IP addresses to increase security. This may include rules for:

  • Allow only certain types of traffic through the tunnel.
  • Restrict access through the tunnel to only certain IP addresses or subnets.

3. Attack Protection

It is important to consider rules to protect your device and network against attacks that could be facilitated through the IPsec tunnel. This could include:

  • Limit connection attempts to the VPN to prevent brute force attacks.
  • Block anomalous or unwanted traffic that should not be present in the tunnel.

Example Firewall Rule to Allow IKE and ESP:

plaintextCopy code/ip firewall filter
add chain=input protocol=udp dst-port=500 action=accept comment="Allow IKE for IPsec"
add chain=input protocol=ipsec-esp action=accept comment="Allow ESP for IPsec"

Final Considerations:

  • Order of the Rules: The order in which you place your rules on the firewall is important. Rules are processed from the top down, so you should place specific rules before more general rules to avoid conflicts or unwanted blocking.
  • Monitoring and Maintenance: Once the IPsec tunnel and corresponding firewall rules are configured, it is good practice to monitor tunnel traffic and performance, as well as periodically review the firewall rules to adjust them as necessary.

Properly configuring firewall rules on your MikroTik device is crucial to the success and security of your IPsec tunnel.

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

Present in several = 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

Present in several = 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

Present in several = 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

Present in several = 17%

all MikroTik OnLine courses

CW23-AX

Present in several = 30%

all Academy courses

CW23-LIB

Present in several = 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

Present in several = 22%

all MikroTik OnLine courses

BF23-AX

Present in several = 35%

all Academy courses

BF23-LIB

Present in several = 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