Page cover

Mikrotik IPsec Tunnel Setup

Although there are a few new and shiny VPN tunneling protocols like WireGuard, IPsec is still the king of enterprise grade for site-to-site VPN tunnteling. It is not as easy as WireGuard to setup on Mikrotik. Personally I like Mikrotik a lot because of its RouterOS based on Linux and pricing model for all hardware. At least, it doesn't break my bank for all the features I want to work with.

Prerequisites

  • GNS3 Emulator

  • Mikrotik CHR appliance setup on GNS3

  • Mikrotik RouterOS version 7.7

  • Basic level of comfortableness with Mikrotik RouterOS CLI and GNS3 setup

Network Topology

Mikrotik IPsec Tunneling
  • Two sites - HQ and Cloud; each site has the WAN IP address of 10.20.30.0/24 subnet as shown in the diagram.

  • HQ has two VLANs - 100 for Dev team and 200 for OPS team at its site. Only Dev team can access to the resources in Cloud since it is not that cheap.

  • Cloud has only one connected subnet of 172.31.1.0/24 where they host their Dev servers.

  • Internet switch is the representation of the internet connection via NAT in GNS3.

Configuration

HQ router config

Here is the full configuration of HQ router on the left in the diagram and its description.

Cloud router config

Here is the full configuration on Cloud router for both LAN and WAN setup.

Testing

To test the IPsec tunnel connectivity, run the following command on each side of the tunnel.

Based on the above output, the IPsec tunnel is up and running. By now, you should be able to ping the servers in cloud from dev1 and dev2 PCs at HQ site.

The ping test should be also successful from srv1 and srv2 in Cloud to dev1 and dev2 at HQ as well.

Last updated

Was this helpful?