In any company where there is more than one office, sooner or later there is a need to merge these same offices. Many providers offer such services, but they will ask for money for it, and who knows what is going on there on the side of the provider? Therefore, we will do everything ourselves, and consider the option of combining using Mikrotik RB750, Ubuntu and OpenVPN.

Why Mikrotik?
The point is native support, ease of setup, more stable behavior, low (by comparison) pings and many other nice features that the RB750 provides. Third-party firmware like tomato or dd-wrt were excluded from consideration, because there were (and still are) doubts about their stability. Asus WL-520GU was also tested, but pings were 20-30 ms higher.
')
So let's go.
On the server in the central office, is Ubuntu. Installing openvpn on it looks like this.
$ sudo su
All the nuances of the settings were contained in the openvpn configuration file on the server; as a result, it turned out to be like this (commented only on essential points, the description of the rest of the config parameters is in mana, internet, example configs, etc.):
port 1194
/etc/openvpn/.ccd/client1
Now mikrotik
I will describe the setting from the very beginning, including the organization of the switch, the setting of addresses, routes, DHCP and so on.
Go to the web interface of the router, download winbox.
We launch winbox (it is possible to connect both via IP and MAC), open the new terminal, and write the following (achtung, reset the configuration of the router):
system reset-configuration
Connect to the second port of the mikrotik, run the same winbox, and on the request that appears, click
remove config
We organize a switch on ports 2-5, port 1 will act as a WAN port.
For this, for all interfaces 3-5 we specify the ether2 master port:

In the IP-> Adresses menu, assign an ip lan interface

Add a gate to go to the Internet in the menu IP-> Routes (in this particular case, the gate is a DSL modem with the address 10.100.0.1)

Note that 10.100.0.0 is the addressing between the router and the DSL modem through which it goes to the Internet, and 10.0.141.0 is the VPN network.
You can configure the DNS here IP-> DNS, and DHCP in the menu IP-> DHCP Server-> DHCP setup, specifying the parameters of the pool.
All of our internal subnet push for NAT, for this we set up masquerading.
Go IP-> Firewall-> NAT and add a rule by analogy:

Happiness is near
It remains to copy the root certificate (ca.crt) and the client certificate and key (client1.crt, client1.key), which we generated during the server installation / configuration process. On the microtic we select the Files menu, and we see a window with the file system of the router. This is where you need to put our keys, it works drag-n-drop.
In order for the router to know if it has certificates, you need to import them via System-> Certifates, add ca.crt, client1.crt, client1.key, the client key will automatically become “Decrypted”.
Directly, the OpenVPN connection is created in the Interfaces menu, when you click on the red plus you will see the OVPN Client in the drop-down list.
On the Dial Out tab, we indicate the address of our server, port, client certificate and types of encryption.

Total.
As a result, we have quite a secure VPN, with minimal costs for equipment and communication services, which can be organized within a couple of minutes.