After connect to VPN can't see local network devices by name

I have a Windows 10 machine where I've installed VPN client. It is HMA fully automatic client so not much I could do wrong.

When VPN is connected - I can't access my NAS device using it's network name MYNAS. At the same time I can access it by IP address - it works fine, transfer speed is high.

Once I disconnect from the VPN - the NAS is available by name immidiatelly.

So my question is - how can I fix or at least debug it?

Thanks!

2

3 Answers

A workaround would be to edit your local hosts file to hard code the hostname mynas to be associated with it's ip address.

  1. Copy the file hosts from C:\Windows\System32\drivers\etc\ to your desktop.

  2. Open the file from your desktop with Notepad.

  3. On a new line after/below everything that is already in there type...

192.168.1.100 mynas

Where mynas is the hostname you currently use to access the NAS, and 192.168.1.100 is the current local IP address of your NAS.

  1. Save and close the hosts file.

  2. Right-Click the edited hosts file on your desktop and select Copy.

  3. In file manager navigate to the directory C:\Windows\System32\drivers\etc\

  4. Paste the edited hosts file here and say yes to overwrite the existing file.

  5. Restart the computer then test.

When you try to reach a hostname, the computer will first check this file, then if it does not find a matching entry it will proceed on to check with your DNS instead, so by editing this file we in a sense create a hardcoded local DNS entry.

Keep in mind that you must update the hosts file again manually each time the NAS device IP or name changes.

This will also only affect the local computer, you must repeat the steps on any other local computer you want to also have the same hostname/ip association setup on.

4

First of all, I'd like to draw more attention to what a VPN really is. I am assuming that, by VPN, you mean something like this: OVPN - Free VPN Provider.

If this is not the case, please ignore everything I say.

First of all, how a VPN works is. VPNs are basically encrypted proxy servers.

A VPN client (after encrypting them, of course) forwards all of your data to the VPN server, where it is decrypted and the server executes the request. This request returns content, and that content is forwarded (after being encrypted) back to the VPN client, where you decrypt the return content and read it.

The problem I think I see is that your NAS device is on your Local Area Network (LAN). This means that the hostname (mynas) is on your router's DNS.

This means that you can access the device by this hostname (mynas), as long as you are asking the router for the IP of the NAS (all hostnames need to be converted into an IP address with a DNS in order for requests to happen).

Only the router knows where on Earth (or in this case the internet) mynas is.

The problem

Your VPN server doesn't ask your router for DNS (that's normal). Instead, it asks something like Google's DNS (8.8.8.8).

This means that it won't ask your router to access its DNS database.

The router is the only person (DNS) who knows where your NAS is locally. Google's DNS (that I've assumed your VPN server is using to fetch IPs) throws back an error at your VPN server, saying that it can't find mynas.

How to fix this problem

If you want to access your NAS by typing into your browser or ftp://mynas, you need to register the domain mynas. I hate to break it to you, but that's not possible. There needs to be a suffix like .com.

However, what you can do is you can register a public (instead of local) domain name (eg. mynas.com) so that any DNS (including Google's) will know where to find the NAS.

Yay! Everyone can find the IP of the NAS from anywhere (including the VPN server)!

Ways to solve this problem

You probably don't want to get a domain name just for your NAS (do you?), making that option invalid (but you could get one for free from Freenom)

FINAL ANSWER: You shouldn't use a VPN to access something on your local area network. There is no point in doing such a thing. The only reason to use a VPN while accessing your NAS on your own network is if: * You want to hide your IP address from your own devices (are you logging yourself? Do you not trust yourself with your own privacy?) OR * You want to demonstrate your trust to your VPN service provider * You want more traffic to happen through the internet

As you can see, both these excuses are pretty lame :D. (What I am trying to say is don't use a VPN to access some device on your local network)

4

My last version of this was not very helpful. How to debug name resolution on the LAN when VPN is active on Windows:

  1. Without VPN running, ping MYNAS. You should get a response from the IP.
  2. With VPN running, ping MYNAS. If you get a response, then windows has cached the name / address of the nas. If you get a host not found, but can still ping the nas by IP address, then the VPN is blocking the name protocol, maybe netBIOS. Windows 10 networking is probably unaware that you are on a VPN.
  3. Verify this by disconnecting from VPN and ping MYNAS by name again.

Without setting static IP address for the nas and a HOSTS file on the PC, then name-based local networking is only possible with a DNS server. Maybe a different topic to set that up.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like