Looks like WordPress doesn’t like to ask the system DNS servers
Is the system name for that DB server in your DNS?
Yes, the DNS has the DB server. WordPress doesn’t even ask the DNS, that’s why I assume there is a bug.
WordPress calls the normal network stack so if the DB host is resolved in the DNS then it will be used. Are you sure you have it typed correctly in wp-config.php?
This works:
/** MySQL hostname */
define( ‘DB_HOST’, ‘172.16.1.1’ );
This doesn’t:
/** MySQL hostname */
define( ‘DB_HOST’, ‘db.local.net’ );
At the Terminal:
root@mariadb-client# host db.local.net
db.local.net has address 172.16.1.1
Tcpdumping while trying to access the page just shows there is no attempt to resolve the name:
root@mariadb-client# tcpdump -i ens160 port 53
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens160, link-type EN10MB (Ethernet), capture size 65535 bytes
Nothing.
Is there any way, necessity or bug to tell WordPress which DNS server to use?
Does your web server had contact the right dns server for you local network?
without db.local.net in your hosts file, what do you see for
nslookup db.local.net?
is your local name server in /etc/resolv.conf?
root@mariadb-client# cat /etc/resolv.conf
search local.net
nameserver 172.16.1.2
nameserver 172.16.1.3
root@mariadb-client# nslookup db.local.net
Server: 172.16.1.2
Address: 172.16.1.2#53
Name: db.local.net
Address: 172.16.1.1
Dang, well, that all looks right. WordPress *should* be using it. Let me consult.
This is solved now – restarting the Apache server ‘fixed’ it. Way too simple…