5

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
  • Can you ping any other devices by hostname? It sounds like the DNS settings for your VPN are setup incorrectly, you need to set it up so that points to the local DNS server when connected.
    – Aardwolf
    Mar 16, 2020 at 20:09
  • No, I can't ping other devices by name, but once I disconnect VPN they become available by name. Yeah, I guess it has to do with DNS I just cave no clue how to do what you are suggesting. Would appreciate an advice :) Thanks.
    – SmxCde
    Mar 17, 2020 at 0:59

3 Answers 3

4
+25

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
  • Thank you for your answer but this is not exactly what I am looking for. Using an alias is not better than using an IP address. I am trying to solve the underlying problem with visibility. If IP Address changes - I will have to update the alias, also I do not see any devices on my network until the VPN is disconnected. What I am trying to achieve is to make my computer to work on local network like there is no VPN, while VPN should be used for all the internet connections.
    – SmxCde
    Mar 24, 2020 at 8:44
  • You see, NAS is just one example, but I'd like to solve the problem in general, for all the local devices I have or will have on my network in the future.
    – SmxCde
    Mar 24, 2020 at 8:56
  • @SmxCde ... This solves the problem because when the client is connected to the VPN, it checks the hosts files first and if it can resolve from there it does. When connected to the VPN, it is checking the company's VPN DNS servers and NAS cannot be resolved so it fails. There may be a fix on the VPN configuration side depending on how the VPN server enforces the client settings. This is Durry42 has the correct answer unless you can adjust the VPN client configuration and potentially VPN server enforced VPN client settings pushed per each connection. Mar 27, 2020 at 5:52
  • It may be called split-mode or something like that depending on the VPN solution you are using. I'm not sure if it's the same as split-tunneling or not since it's DNS specific but you should be able to tell the configs what DNS servers to use for the subnet on the VPN and to use the home defined VPN for IP addresses not on the VPN subnet. Now if there is overlap in the home private and VPN private subnets, that may be a different story but not sure what VPN solution you are using. Do you have VPN admins you can ask these questions for this VPN you connect? Is it a company VPN or what? Mar 27, 2020 at 6:02
0

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 http://mynas/ 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
  • I am little confused by your answer. In the beginning I thought you got it right, your final punch line is correct (i should not use VPN for local resources) but somehow you missed that this is the essence if my question. Let me reiterate: I need to use VPN on that computer (for internet connections) but (as you got it right!) I want to go to devices on my local network directly. This is what I am asking - once I connected to VPN my local network is not fully accessible (names not resolving), how can I fix that? And yes, of course I wont register domain for that, it is pointless. Thanks tho.
    – SmxCde
    Mar 24, 2020 at 8:52
  • @SmxCde I got the same vibe as you reading over the post then seemed like a rant or something at the bottom. I was thinking about DNS suffixes such as home.local versus when connected to the VPN perhaps it configuring a VPN/company DNS suffix such as company.org on the network adapters. But if you had an internal DNS server setup that resolved the home.local hosts if NAS.home.local would always be resolvable regardless of being connected to the VPN as long as you use the fully qualified domain name like that. I can't test this to confirm but a thought how it may be possible internally. Mar 27, 2020 at 6:09
  • @SmxCde ... I wasn't sure if already having the home.local DNS suffix defined on the adapter and then when it is connected if that'd make any difference. I also wasn't sure if you could adjust the VPN adapter DNS settings once connected and see if changing the primary or maybe add your internal as a secondary or even third DNS server helped without any suffixes. I assume you can ping the home DNS server IP addresses when connected to the VPN. I know I've worked around this sort of issue before but not sure if it was a site VPN long ago rather than a client connection. Mar 27, 2020 at 6:15
  • @SmxCde Yes, that too. Adjusting your VPN's DNS settings would be a little more practical, if possible.
    – idontknow
    Mar 27, 2020 at 20:35
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .