Jump to content
Not connected, Your IP: 18.119.139.50
DarkKman

Can I stop OpenVPN (Linux) from connecting to certain country servers?

Recommended Posts

Hi folks,

I use QNAP with a UDP OpenVPN config file for Europe however I find, whether its an issue with AirVPN or QNAP that I get disconnected and occasionally reconnect to a country that for some reason has a lot of latency (I mainly use the VPN to allow Internet access to Plex). Is there a way in the config file configuration (or otherwise) I can restrict a certain country?

Hope this makes sense and someone can help offer some advice (on either restricting connecting to a country or why the VPN drops and reconnects to another server)?

Share this post


Link to post

Hello!

For the selection problem, please consider this potential solution in your ovpn configuration file:
 

remote-random
remote <country>3.vpn.airdns.org
remote <another country>3.vpn.airdns.org
...
remote <yet another country>3.vpn.airdns.org

where you list only the ISO codes of the countries you want to connect to. Please see also here:
https://airvpn.org/faq/servers_ip/

About the connection instability you experience have you examined the OpenVPN log to check whether packet errors are reported (hinting to bad line or MTU size related problems)? If the device is connected via WiFi, try to change channel and/or get a stronger signal. If you suspect that the problem is MTU related, try the following directive (in the ovpn configuration file) and check whether it mitigates the problem:
mssfix 1280

Kind regards
 

Share this post


Link to post
6 hours ago, Staff said:

For the selection problem, please consider this potential solution in your ovpn configuration file:
 


remote-random
remote <country>3.vpn.airdns.org
remote <another country>3.vpn.airdns.org
...
remote <yet another country>3.vpn.airdns.org
This is great - thank you so much - and all appears to be working. I assume that the 'remote-random' command is just that; it will select a random server from the list given below? If so, is there a way to give the country list a priority instead? Or do I need to use the 'remote-random' at all? - again my assumption would be that if not used, it would then select the first in the list and failover to the next etc etc?

Thanks again for the help. AirVPN is top notch!

Share this post


Link to post
14 minutes ago, DarkKman said:

Thanks again for the help. AirVPN is top notch!


We're glad to know that this solution meets your needs. Thank you very much for your choice and your great feedback!

Kind regards
 

Share this post


Link to post

 

Quote

I assume that the 'remote-random' command is just that; it will select a random server from the list given below?


Exactly.
 

Quote

If so, is there a way to give the country list a priority instead?


Not exactly, see below.
 

Quote

Or do I need to use the 'remote-random' at all? - again my assumption would be that if not used, it would then select the first in the list and failover to the next etc etc?


Again, good intuition. That effectively prioritizes the first country. In reality, it's very rare that all servers from a country fail at the same time, unless it's a country with a very small number of servers. You might end up never connecting to other countries.

Here's a link to the official OpenVPN 2.6 docs: https://openvpn.net/community-resources/reference-manual-for-openvpn-2-6/
To learn about `remote` search for `--remote`.

Share this post


Link to post

Thank you @benfitita - that is great! I think I'll see how I get on with the remote-random and see how Plex manages that (as mentioned, the reason for the request was some countries, when selecting europe3 seem to suffer from some latency when streaming. Much appreciation to you and AirVPN :)

Share this post


Link to post

Hi! A nice bash script by @gzoido https://airvpn.org/forums/topic/47513-script-update-your-airvpn-configuration-with-working-ips-sorted-by-ping/
I'm not sure whether QNAP Linux based operating system includes bash and fping. If so, the script is fine. If you replace the domain name with europe3.vpn.airdns.org europe3.all.vpn.airdns.org you will get the server IP 3 in Europe with the quickest ping, so you cut out the slow ones. Maybe it's overkill for what you need and adds complexity, but it may come handy for other similar tasks.
 

Share this post


Link to post
3 hours ago, Quallian said:

Hi! A nice bash script by @gzoido https://airvpn.org/forums/topic/47513-script-update-your-airvpn-configuration-with-working-ips-sorted-by-ping/
I'm not sure whether QNAP Linux based operating system includes bash and fping. If so, the script is fine. If you replace the domain name with europe3.vpn.airdns.org you will get the server IP 3 in Europe with the quickest ping, so you cut out the slow ones. Maybe it's overkill for what you need and adds complexity, but it may come handy for other similar tasks.
 

Wow... This is great! I don't mind a little overkill and suspect this will just fast forward me a little. Thanks for the share! 

Share this post


Link to post
13 hours ago, DarkKman said:
16 hours ago, Quallian said:

Hi! A nice bash script by @gzoido https://airvpn.org/forums/topic/47513-script-update-your-airvpn-configuration-with-working-ips-sorted-by-ping/
I'm not sure whether QNAP Linux based operating system includes bash and fping. If so, the script is fine. If you replace the domain name with europe3.vpn.airdns.org you will get the server IP 3 in Europe with the quickest ping, so you cut out the slow ones. Maybe it's overkill for what you need and adds complexity, but it may come handy for other similar tasks.
 

Wow... This is great! I don't mind a little overkill and suspect this will just fast forward me a little. Thanks for the share! 

You're welcome! I was wrong though, europe3.all.vpn.airdns.org is the correct name you can enter when you edit the script. With the other name I wrongly gave you the script would have only one address to consider so it wouldn't help at all. With this name the script can calculate the ping to all Europe server entry 3 addresses.

Share this post


Link to post
1 hour ago, Quallian said:

You're welcome! I was wrong though, europe3.all.vpn.airdns.org is the correct name you can enter when you edit the script. With the other name I wrongly gave you the script would have only one address to consider so it wouldn't help at all. With this name the script can calculate the ping to all Europe server entry 3 addresses.

I haven't had a chance to test this out so no harm done :) And thanks again for sharing the script and the domain to use... Very much appreciated. I'll report back with my QNAP findings once actioned!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Security Check
    Play CAPTCHA Audio
    Refresh Image

×
×
  • Create New...