OpenVPN Access to Hostnames vs IP Address

Thank you Will for all the time and effort you put into your videos and the forum, been indispensable for a beginner like me! And too, wish you the best as you build this all out into fulltime career.

I am a typical home user, lots of pictures, videos, documents, decided to migrate to a nas to manage and better protect. Found your YouTube site, watched your videos on the DS1522+ and ordered one. All has gone incredibly smooth. Love it. I do have one question regarding OpenVPN I cannot find the answer to anywhere.

All the family Windows computers and laptops use hostnames for mapped drives to the nas shares, when at home on the lan works seamlessly. Installed OpenVPN on the DS1522+ and my laptop so I could access content when away from home and access my local lan. All works perfectly. Except, I am unable to access the mapped drives using the host name(s). If I remap the network drives to the fix IP address of the DS1522+, no problem (both through OpenVPN and at home on the lan).

Is there a setting or configuration I am missing so when using OpenVPN to the DS1522+ I can access my lan as if I am at the house? That is using the host names for the shares and other devices rather than their respective ip addresses on my lan?

Thank you…

1 Like

How is your DNS setup? Are you running an internal DNS server?

Will created a video (on DSM 6 as a while ago) on how to setup an internal DNS server so hostnames work internally and externally.

What is the DNS server you’re using when connected to your VPN too?

I would like to setup a DNS Server internally but I’m just so time poor and I know all the important IP’s off the top of my head so it would be more just for fun.

Short answer: no, there is no setting that you overlooked.

Long answer: although a VPN connection is much like you are on the local network, there is one distinct difference: name resolution via VPN does not work. That is by design.

You can work around this limitation through a so-called hosts file, that is on every computer. Hosts files are the predecessor of a full-fledged DNS server. By putting the name and IP address of your NAS in that file, you can use the server name while connecting via VPN.

James-melb, thank you for your response, I am not running an internal DNS server, Spectrum is my ISP, I logged into my router admin page and my Domain Name Server defaults to their DNS servers. It doesn’t appear Spectrum allows you to change that, interesting. I did watch Will’s video on setting up an internal DNS Server. It certainly would be pushing my skillset, but I am fairly confident I could do it, and may very well give it a try. (which may end up to be my next need help post)

Paul – Thank you for the bottom-line answer. Very helpful. What you explain makes complete sense. Glad to hear it wasn’t me (as it usually is) and I am not the only one who must configure mapped drives similarly when VPN.

Greatly appreciate the help,

Mark

As a matter of follow up, and for those in the future who searched and found this, I did as you suggested, I went into my laptop, edited the Windows 11 hosts file to point my DS1522+ hostname to the fixed IP address on my LAN. Perfect, all now works seamlessly on the LAN and outside the house on OpenVPN. I realize it is all somewhat semantic (hostname or IP), but it is nice to have my entire home ecosystem mapped and programed the same, whether at the house or on OpenVPN. Thanks again for the help!

@Paul and @james-melb Thanks for helping out! I was slammed!

So @nas4me2 there is one thing you can do, if you are trying to get around this for multiple machines.

@Paul is absolute correct ^, but there is a cheese way of getting around this, if you already have everything mapped via hostname. What you can do is setup your Synology as a DNS server, and add a zone for .local. Here you can add any DNS records for the things you have like nas.local pointing to the NAS’s local IP. You would not want to set your entire LAN to use this as a DNS server, but you can set it so that anyone connecting to the openvpn server uses the Synology as the DNS server. Then you can set the search domain on the openVPN server to be .local.

I have had to do this in the past to get around office’s that have setup local web servers using hostnames for redirects, rather than DNS addresses. The parameters you would edit in the openVPN config file are:

dhcp-option DNS 192.168.1.123 #Local IP of Synology
dhcp-option DOMAIN local

It’s fun to mess around with if you are looking to tinker

1 Like

Thanks @Will , that is an awesome tip you shared and I am thrilled to test this out. Thanks again.

1 Like

Thank you Will, I actually think that might be in the realm of my abilities, seems straightforward enough. And too, ever since installing the Synology NAS, I have enjoyed tinkering and learning. Right now, because this is all so new for me and out of an abundance of caution, I am the only one with remote VPN in. Although I am sure my wife will be soon behind me…and then the real test - the kids!

1 Like

I have this question too. I want to be able to resolve hostname.local from a VPN connection. Can you show how to implement the .local zone? Its not making sense, how were sort of commandeering a TLD-like thing called .local — the DSM DNS panels reject a bare .local and force you to enter a something.tld

Thanks so much Will. Ive gotten so much from your videos.

So you should just be able to set the domain name to local and start using that to resolve subcomponents. Does this help:

Thanks Will. That indeed helped! I just wasn’t understanding the grammar of it and it seems really dumb now that i see the solution haha. I didn’t know you could have a domain name with no .TLD Thanks again for showing the spelling and punctuation.

So after correcting several other errors I finally got it working 100%. BTW the DNS server didnt like it when my .opvn file had a 2nd DNS server — it resolved the first connection to hostname.local for half a second then quit.

Happy to help man! Yeah its a clunky setup, that only works because we are forcing it to!

So you definitely only want a single DNS server here as if you have two DNS servers with local records, things will get weird. In this case you also dont really need the redundancy, if the NAS goes down, the VPN tunnel will go down as well so you dont need to worry about having DNS on it!

Hey @Will, I got a new DS1621+. I got it all setup, and then followed your instructions for the OpenVPN in “Setup Synology OpenVPN Server.” But, now I can’t connect to my DSM desktop: https://10-0-0-143.dbe4876.direct.quickconnect.to:5001/. Got myself in trouble I’m afraid. :frowning:

I’m getting…

This site can’t be reached

10-0-0-143.dbe4876.direct.quickconnect.to took too long to respond.

Try:

ERR_CONNECTION_TIMED_OUT

When I went through the DDNS part of the procedure I created the hostname: ds1621new.synology.me

My SMB connectivity is still working via iMac Finder, I can open my home folder and create folders/files, etc. But I can no longer open the DSM desktop in my Brave browser as I did before.

ADDENDUM:
Did reset of admin & network. Back in. Whew! :slight_smile: