MikroTik RouterOS VPN Site-to-Site And Remote Access
If you are looking to set up a site-to-site OpenVPN server with a MikroTik RouterOS client, you've come to the right place! This guide will show you exactly how to do it step-by-step.

But before we dive in, let's first understand what site-to-site OpenVPN is and why we want to set it up.
What is Site-to-Site OpenVPN?
Site-to-Site OpenVPN is a type of virtual private network (VPN) that allows communication between multiple locations or networks in a secure and encrypted manner. It is useful when you have remote offices or data centers that need to communicate with each other securely over the internet.
In our case, we'll be setting up an OpenVPN server on one MikroTik RouterOS device and connecting it to another MikroTik RouterOS device acting as an OpenVPN client. Once the connection is established, the two networks can communicate with each other as if they are on the same local network.
Step-by-Step Guide
Now that we understand what site-to-site OpenVPN is, let's get started with the setup process.
Step 1: Configure the OpenVPN Server
The first step is to configure the OpenVPN server on the MikroTik RouterOS device that will act as the server. Here are the steps:
- Login to your MikroTik RouterOS device and open the Terminal
- Enter the following commands to create the encryption certificates:
- Next, we'll create the OpenVPN configuration. Enter the following command:
- Now, we'll configure the IP addresses for the OpenVPN server:
- Finally, we'll create the firewall rules to allow traffic to and from the OpenVPN server:
/certificate add name=server-cert common-name=vpn.example.com
/certificate add name=client-cert common-name=vpn-client.example.com
/interface ovpn-server server set certificate=server-cert cipher=aes256 auth=sha512 enabled=yes
/ip address add address=10.0.1.1/24 network=10.0.1.0 interface=ovpn-server
/ip firewall filter add chain=input action=accept dst-port=1194 protocol=tcp
/ip firewall filter add chain=input action=accept dst-port=1194 protocol=udp
/ip firewall filter add chain=forward action=accept src-address=10.0.1.0/24 dst-address=192.168.1.0/24 protocol=all
Step 2: Configure the OpenVPN Client
Now that we've configured the OpenVPN server on one MikroTik RouterOS device, we need to configure the client on the other MikroTik RouterOS device. Here are the steps:
- Login to your MikroTik RouterOS device and open the Terminal
- Enter the following commands to create the encryption certificate:
- Next, we'll create the OpenVPN configuration. Enter the following command:
- Now, we'll configure the IP addresses for the OpenVPN client:
- Finally, we'll create the firewall rules to allow traffic to and from the OpenVPN client:
/certificate add name=client-cert common-name=vpn-client.example.com
/interface ovpn-client add name=ovpn-out1 connect-to=vpn.example.com port=1194 mode=ip cipher=aes256 auth=sha512 certificate=client-cert user=ovpn-user
/ip address add address=10.0.2.1/24 network=10.0.2.0 interface=ovpn-out1
/ip firewall filter add chain=input action=accept dst-port=1194 protocol=tcp
/ip firewall filter add chain=input action=accept dst-port=1194 protocol=udp
/ip firewall filter add chain=forward action=accept src-address=10.0.2.0/24 dst-address=192.168.0.0/24 protocol=all
At this point, the OpenVPN server and client are configured and we just need to establish the connection between the two devices.
Step 3: Establish the OpenVPN Connection
Here are the steps to establish the OpenVPN connection between the two devices:
- Login to the MikroTik RouterOS device acting as the OpenVPN client
- Enter the following command to start the OpenVPN client:
- The connection should now be established. Check the status using the following command:
/interface ovpn-client connect ovpn-out1
/interface ovpn-client print
That's it! You've now successfully set up a site-to-site OpenVPN connection between two MikroTik RouterOS devices.
Conclusion
Site-to-site OpenVPN is a powerful tool that allows you to securely communicate between multiple locations or networks. By using MikroTik RouterOS devices as the server and client, you can easily set up a site-to-site OpenVPN connection in just a few steps.
Thank you for reading and I hope you found this guide helpful!
Post a Comment for "MikroTik RouterOS VPN Site-to-Site And Remote Access"