3

When I RDP into a machine on my client's network, there are a bunch of PCs on the network I can access by name (e.g. for SVN servers, Jenkins, etc).

However when I connect over VPN on my local PC none of these machine names are resolvable, but I can ping their IP addresses without issues.

Is this something I need to set up manually or an issue with the VPN configuration?

10
  • Have you tried adding them to your host file on your pc? Restart and then try to connect by name? May 3, 2016 at 10:44
  • I have a feeling this might be the answer, it's not something I know about though I hear hostfiles mentioned from time to time in relation to DNS and so on
    – Mr. Boy
    May 3, 2016 at 10:57
  • Did you check the DNS server settings for VPN connection? Do you use Windows? May 3, 2016 at 11:00
  • 1
    If you want to give it a shot try adding 1 or two of the Remote computers ip address along with the hostname Follow This Guide if it works for you add the rest. May 3, 2016 at 11:12
  • 3
    Windows machines on a lan use NetBIOS to do host name resolution, not dns. The NetBIOS will not propagate over the VPN without some nasty configuration. Your choices are update the hosts file to explicitly call out the IP / hostname settings, install a dns server on a machine on the remote lan and configure your VPN client to point at that and not the vpns dns server, or set up netbios routing over the VPN. Unless you enjoy this stuff, i would do the host name option.
    – Argonauts
    May 3, 2016 at 15:01

3 Answers 3

3

I'm not an IT professional but this worked in my company.

On Windows 10, if you have an internal DNS server, you should add it to the DNS servers that the VPN provide. On Windows Server you can setup a DNS server with authority over local names, google is your friend.

Alternatively, the clients can do that on their VPN connection:

  • open Control Panel, Network and sharing Center, Change Adapter Settings
  • Right click on your VPN connection, Properties, Networking
  • Select the TCP/IPv4 option (whatever is called on your locale)
  • click on Properties, Advanced...
  • go to DNS tab
  • Add your internal LAN server DNS address, e.g. 10.0.10.1
  • Optional: in the edit box "DNS suffix for this connection:" add the DNS suffix, example yourcompany.local
  • apply and exit
  • disconnect and reconnect the VPN if it was connected

Now, you can access an internal pc with computername.yourcompany.local or, if you added the suffix before, just computername, for instance \\computername in windows explorer, or computername:8080 in the browser for a service on 8080, or with remote desktop.

0

Inside VPN properties you need to specify the server in DNS. Or edit hosts file with IP address to correlate with host name.

0

Your /etc/resolv.conf file defines where your computer should look to resolve hostnames into IP addresses. The basic problem is that /etc/resolv.conf doesn't get updated when you run openvpn by default.

Here's what you need to do to fix the problem.

1.) Append the following onto your server.conf file on your OpenVPN server machine (typically located at /etc/openvpn/server.conf) to have the server to the client where to look to convert hostnames to IP addresses.

push "dhcp-option DNS 192.168.1.1"
push "dhcp-option DOMAIN mylocaldomain.lan"

2.) Install resolvconf on your client machine and link the standard resolv.conf to resolvconf's version with the following commands to have a function capable of modifying resolv.conf

sudo apt install resolvconf
sudo mv /etc/resolv.conf /etc/resolv.conf.orig
sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf

3.) Append the following to the bottom of your client.ovpn file to run resolvconf whenver the OpenVPN server is connected to or disconnected from.

up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf

4.) Whenever you run openvpn you'll have to do so with the -script-security 2 flag to allow openvpn to run resolvconf. Here is an example call

sudo openvpn --script-security 2 --config /path/to/client.ovpn

You can read a more detailed version of the above instructions with some example code of my (working) OpenVPN server here: https://steamforge.net/wiki/index.php/How_to_configure_OpenVPN_to_resolve_local_DNS_%26_hostnames

2
  • 2
    I would be appreciated if your answer was all inclusive. While it’s fine to provide references within an answer, it’s always better, to have all relevant content required to answer the question within the answer body. Link only answers are typically just deleted, since most often, those answers eventually are unhelpful once the links stop working
    – Ramhound
    Jul 9, 2019 at 23:52
  • 1
    Fair enough. I've updated the answer to include all the necessary commands as well as a better description of what's going on.
    – begleysm
    Jul 11, 2019 at 19:45

You must log in to answer this question.

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