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.ph..._%26_hostnames