I have the following problem:
if I ping a non existent domain name I get a reply from an IP address
# ping nosuchdomain.common
PING nosuchdomain.common.myrealdomain.com (192.168.1.1) 56(84) bytes of data.
64 bytes from myrealdomain.com (192.168.1.1): icmp_req=1 ttl=59 time=0.184 ms
Anyway, what I would want to happen would be to have the resolver work like this
#ping nosuchdomain.common
ping: unknown host nosuchdomain.common
My /etc/resolv.conf looks like this now:
# nameserver config
nameserver 8.8.8.8
Any idea where I should look to make the resolver return "unknown host"?
Normaly you should end a Domain Name with a dot, if you don't do this your resolver try to attach a search Domain from you network config (for example from DHCP)
Your example with
nosuchdomain.common
should be written asnosuchdomain.common.
To find out the reason where is set the search domain, you can use a static IP and set a different DNS Server and than you should not get a search domain. You should check you /etc/network/interfaces config for a search-domain parameter:
Thanks all for your suggestions, I accidentally found a solution to my problem and that is to explicitly add this line in /etc/resolv.conf
search .com
Once I did this it started working as expected.
I guess the resolver has a default
search
as the domain of what is defined in/etc/hostname
to which it adds whatever domain it cannot resolve directly.And as my DNS for this domain was configured with wildcard it explains why the made up domains were resolved to a certain IP.