sorry for being noob here, but I've been googling for so long and found so many different solutions and guides about this problem, that it completely does my head in and just confuses me instead of helping
I have an "allrounder" standalone server at the office, running many many services by itself (emails/postfix/imap, webserver, samba (with AD), ftp, ssh, etc.) - and now OpenVPN. OS is Ubuntu 18.04. It is behind an old cheap router, in a subnet with the office computers it serves.
The entire "ecosystem" relies on the server's name (hostname and netbios name are the same): windows clients attach samba shares via "\\servername\sharename" URLs, many files are linked to in excel tables that way, scripts use that, email clients acces the local imap server as "servername:143", and send emails through local postfix which is again referred to by the servername. Etc.
Now, when I connect to the server with a windows client using the OpenVPN GUI, the connection works, but there's no name resolution at all. (I'm using dnsmasq on the server itself). Internet does not work over the VPN either but that is actually right so.
I can access samba and its shares through "\\10.8.0.1\", and send emails through postfix if I use the 10.8.0.1 IP instead of the server name, etc.
My goal is: the server should be referred to or accessed by the same hostname, regardless of wheter the user is in the office and connects to the network locally, or is at home and connects to the server via oVPN, seamlessly, without having to reconfigure anything.
So I guess a simple client side hostfile hack is not possible.
I'm really not sure about the whole routing and ip forwarding and so on. I tied them but probably wrong. I'm also reading something about this being a resolved bug on ubuntu 18.?
Any kind help is appreciated.
proto udp4
dev tun
ca ca.crt
cert servername.crt
key servername.key # This file should be kept secret
dh dh2048.pem
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist /var/log/openvpn/ipp.txt
push "dhcp-option DNS 192.168.2.10"
keepalive 10 120
tls-auth ta.key 0 # This file is secret
cipher AES-256-CBC
auth SHA256
user nobody
group nogroup
persist-key
persist-tun
status /var/log/openvpn/openvpn-status.log
verb 3
explicit-exit-notify 1
dev tun
proto udp4
remote dyndns.host.na.me 2194
resolv-retry infinite
nobind
user nobody
group nogroup
persist-key
persist-tun
remote-cert-tls server
key-direction 1
cipher AES-256-CBC
auth SHA256
verb 3
<ca>
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
</ca>
<cert>
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
</key>
<tls-auth>
-----BEGIN OpenVPN Static key V1-----
...
-----END OpenVPN Static key V1-----
</tls-auth>