Currently every domain name resolves to my primary server, primary.example.com
. So for example, if I ping randomdomain123.blah
I get:
PING primary.example.com` (1.2.3.4) 56(84) bytes of data.
but am expecting a 'host not found' error.
Initially I thought it was because I had search example.com
in my /etc/resolv.conf
. However, after removing that pinging randomdomain123.blah
still resolves to my primary domain. Restarting the server had no effect either.
I have nothing specified in /etc/hosts
.
Running hostname
from another server in the cluster gives secondary.example.com
.
I use Route 53 as the DNS provider, and relevant DNS seems to be:
example.com. A 1.2.3.4
primary.example.com. A 1.2.3.4
*.primary.example.com. CNAME primary.example.com
*.example.com. CNAME www.example.com
www.example.com. CNAME primary.example.com
So is this a local networking misconfiguration or some DNS problem? (or both?)
Update: The reason I want/need a wildcard is that I run a webapp of this domain so customer1.example.com etc. need to resolve to this machine and it needs to be automatic - so I wanted to avoid having to change the DNS after each new customer signs up.
Update 2: My /etc/resolv.conf
is currently as follows (since I commented out the search line):
### Hetzner Online AG installimage
# nameserver config
nameserver 213.133.99.99
nameserver 213.133.100.100
nameserver 213.133.98.98
nameserver 2a01:4f8:0:a102::add:9999
nameserver 2a01:4f8:0:a0a1::add:1010
nameserver 2a01:4f8:0:a111::add:9898
# search example.com
Update 3: Running dig randomdomain123.blah +trace
gives:
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6 <<>> randomdomain123.blah +trace
;; global options: +cmd
;; Received 12 bytes from 213.133.99.99#53(213.133.99.99) in 0 ms
Update 4: I can confirm that ping randomdomain123.blah.
with the final dot gives:
ping: unknown host randomdomain123.blah.
So does that mean that from a Java app on this machine, I need to append dots and use a URL like http://randomdomain123.blah./somepage.html
to ever generate a HostNotFoundException?
/etc/resolv.conf
to your question.