OpenVPN and DNS. How to?

I'm using OpenVPN to set up a VPN to connect my laptop at home to my workplace LAN. I want to be able to refer my workplace computers by their name and not by their IP but I can't.

This is my situation:

Workplace LAN:

  • Address space: 192.168.101.0/24
  • Router address: 192.168.101.1

Home LAN:

  • Address space: 192.168.1.0/24
  • Router address: 192.168.1.1

VPN:

  • Address space: 10.100.1.0/24
  • OpenVPN server address: 10.100.1.1

All machines are running Microsoft Windows.

At my workplace, the PC running as the OpenVPN server is 192.168.101.50 (and 10.100.1.1 in the VPN), and its machine name is workplaceserver.

At my workplace the name workplaceserver is resolved to address 192.168.101.50, but in the vpn client the name workplaceserver can't be resolved, I want it to be resolved to 10.100.1.1. How should I configure OpenVPN in order to achieve that?


You can use your office DNS (if you have one), instead if the default DNS you are using. To do so, you have to add this option to OpenVPN server (see docs)

push "dhcp-option DNS 10.x.x.x"