5

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?

4
  • Updated the question with better explanation. Nov 28, 2014 at 10:22
  • 3
    Please don't munge domain names when you're asking about DNS issues, it makes it a lot harder to troubleshoot. And if you do munge them, don't just pick a random domain name that belongs to someone else - use example.com which is meant for this.
    – Jenny D
    Nov 28, 2014 at 11:03
  • @JennyD Roger that. Nov 28, 2014 at 12:15
  • 1
    Please add the contents of /etc/resolv.conf to your question.
    – Andrew B
    Nov 28, 2014 at 19:33

2 Answers 2

5
+50

Your problem is the search field in /etc/resolv.conf combined with your * record. You mentioned that you already tried to remove that setting. But it turns out that omitting it from /etc/resolv.conf, does not mean that the search feature will be turned off.

If absent from /etc/resolv.conf the search setting will default to the domain from your hostname.

I don't know if there is an official way to completely disable the search feature, but this appeared to work:

search .

Alternatively, you can point your search to a domain without a * record, which could contain a few other records for your convenience. For example:

search search.example.com

Then you can create records such as server1.search.example.com but not *.search.example.com.

1
  • Thanks! Adding the search . line did the trick! Dec 8, 2014 at 8:55
3

It looks like you have configured a wildcard DNS record, a so called catch it all configuration: *.example.com is CNAMEs to www.example.com which in turn is a CNAME for primary.example.com which then resoves to 1.2.3.4

That is not a very sane setup, please also see: http://en.wikipedia.org/wiki/Wildcard_DNS_record.

6
  • Thanks - will check it out, plus added an explanation on why I have the wildcard. Nov 28, 2014 at 10:55
  • But how can randomdomain123.blah ever map to *.example.com in the first place? Nov 28, 2014 at 11:20
  • @Peter - I presume something is appending a 'default' extension making it treat it like randomdomain123.blah.example.com Nov 28, 2014 at 12:15
  • 1
    @NicCottrell - please do a dig randomdomain123.blah +trace
    – r_3
    Nov 28, 2014 at 12:41
  • 1
    dns domain suffix on the client. I think if you ping randomdomain123.blah. with the trailing dot then you will get the expected behavior
    – JamesRyan
    Nov 28, 2014 at 12:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .