Problems connecting to Mikrotik OVPN server using .ovpn file

This forum is for general conversation and user-user networking.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
BrayanOrozco
OpenVpn Newbie
Posts: 3
Joined: Tue May 30, 2023 10:07 am

Problems connecting to Mikrotik OVPN server using .ovpn file

Post by BrayanOrozco » Tue May 30, 2023 10:13 am

I am trying to connect to an OVPN server configured on a Mikrotik router.
When I generate the certificates, I get these three files:

ca.crt
client.crt
client.key

I use these three files on another Mikrotik client, and the connection to the server works. I have another Ubiquiti router where I need to connect as a client to the Mikrotik server, and for this, I have to use a file with an OVPN extension, inside that file I put the information of the three files mentioned above "inline", but it still doesn't work. I don't know what is wrong or what parameter I need in the OVPN file for the client to connect.
I really appreciate any help you can provide.

This is the information from my OVPN file:

client
dev tun
proto tcp-client
remote (my public IP)
port 1194
nobind
persist-key
persist-tun
tls-client
remote-cert-tls server
verb 4
mute 10
cipher AES-256-CBC
auth SHA1
auth-user-pass
auth-nocache
route 192.168.84.0 255.255.255.0
<ca>
-----BEGIN CERTIFICATE-----
MII(...)gwbLj
-----END CERTIFICATE-----
</ca>

<cert>
-----BEGIN CERTIFICATE-----
MII(...)WN2sw==
-----END CERTIFICATE-----
</cert>

<key>
-----BEGIN ENCRYPTED PRIVATE KEY-----
MII(...)/S6Q==
-----END ENCRYPTED PRIVATE KEY-----
</key>

Fadim
OpenVPN User
Posts: 40
Joined: Mon May 15, 2023 12:14 pm

Re: Problems connecting to Mikrotik OVPN server using .ovpn file

Post by Fadim » Tue May 30, 2023 11:13 am

The configuration you've shared seems generally correct. It's tricky to diagnose the problem without logs or error messages. However, here are a few things you might want to check:

1. Ensure the certificates and keys are correctly formatted in the .ovpn file. They should be exactly as they are in the original files, including all lines and dashes.
2. Make sure the Mikrotik server is configured to allow connections from your Ubiquiti router's IP.
3. The line "proto tcp-client" might be causing issues, you could try changing it to "proto udp" instead, as UDP is generally recommended for VPNs due to better performance.
4. Check if the Mikrotik router's firewall rules allow the Ubiquiti router to establish a connection.
5. Lastly, verify that you have the correct public IP and port number.

If none of this works, it would be really helpful if you could share any error messages you're seeing. They could provide valuable clues on what's going wrong.

BrayanOrozco
OpenVpn Newbie
Posts: 3
Joined: Tue May 30, 2023 10:07 am

Re: Problems connecting to Mikrotik OVPN server using .ovpn file

Post by BrayanOrozco » Wed May 31, 2023 8:40 am

Fadim wrote:
Tue May 30, 2023 11:13 am
The configuration you've shared seems generally correct. It's tricky to diagnose the problem without logs or error messages. However, here are a few things you might want to check:

1. Ensure the certificates and keys are correctly formatted in the .ovpn file. They should be exactly as they are in the original files, including all lines and dashes.
2. Make sure the Mikrotik server is configured to allow connections from your Ubiquiti router's IP.
3. The line "proto tcp-client" might be causing issues, you could try changing it to "proto udp" instead, as UDP is generally recommended for VPNs due to better performance.
4. Check if the Mikrotik router's firewall rules allow the Ubiquiti router to establish a connection.
5. Lastly, verify that you have the correct public IP and port number.

If none of this works, it would be really helpful if you could share any error messages you're seeing. They could provide valuable clues on what's going wrong.
Thank you very much for your reply. In the Mikrotik's log I don't have any error or connection attempt from the Ubiquiti router. And from the Ubiquiti router the only thing I have is a "problem" when trying to load the file.

I'll try to check the spaces or if everything is formatted correctly, because I don't really know what it could be.

This is what I get when I try to load the file:

Image

Connection not established. Please check your credentials, configuration file and check if remote is online.

Fadim
OpenVPN User
Posts: 40
Joined: Mon May 15, 2023 12:14 pm

Re: Problems connecting to Mikrotik OVPN server using .ovpn file

Post by Fadim » Wed May 31, 2023 9:38 am

Given that the error message is mentioning checking the credentials and configuration file, you might also want to double-check the auth-user-pass directive. It's possible the authentication details are not being read correctly from your .ovpn file.

Also, just to be sure, have you checked that your Ubiquiti router's firmware is up to date? Sometimes, updates can resolve compatibility issues.

BrayanOrozco
OpenVpn Newbie
Posts: 3
Joined: Tue May 30, 2023 10:07 am

Re: Problems connecting to Mikrotik OVPN server using .ovpn file

Post by BrayanOrozco » Wed May 31, 2023 10:26 am

Well, I don't know if the credentials should be added in the .ovpn file because anyway in this screenshot, it asks me for the username and password (they are the same I used in the Mikrotik client to connect and it worked), so I have put the credentials in this section and I don't know if it is necessary to put a line with them in the file.:

Image

As for the version, yes, I have the latest one.

Post Reply