I cannot ping or mount using hostname of server on domain network.
Server is almost fresh install, just using apache, mysql, php for webhosting.
If I ping server with its hostname it result with this error:
Temporary failure in name resolution
Pinging ip address works.
If I try to mount server with hostname:
mount error: could not resolve address for server_name: Unknown error
If I tried to ping FQDN of server, it also resulted with same error
ping server_name.domain_name.local
Temporary failure in name resolution
After I changed symlink from
resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
to
resolv.conf -> /run/systemd/resolve/resolv.conf
using
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
with help from answer here Ubuntu 18.04 .local domain dns lookup not working
The real issue is that Ubuntu 18.04 has its resolv.conf sym-linked to a stub file that points to the localhost for name resolution. Localhost DNS name resolution means that the system refuses to check the supplied DNS server for .local names, believing (incorrectly) that such names are invalid.
I can now ping FQDN, but pinging hostname still doesn't work.
I can see now that system is using correct DNS server (not that default localhost ip):
resolvectl status
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: uplink
Link 2 (eth0)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: ip_of_my_dns_server_on_lan
DNS Servers: ip_of_my_dns_server_on_lan
What to do to be able ping hostname? (and mount using hostname etc.)