I've installed dnsmasq DNS server on ubuntu instance and added domain name in the configurations. It is working fine except that it is resolving unkown hosts the same way it will do for the domain name.

Here is my configurations:


# domain name


/etc/hosts localhost www.google.com
10.10.1.x testhost

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

I've installed nginx server on the "example" instance, so I expect to see the default page when I send GET request to the port 80 and this is working as planned:

curl example.com

<!DOCTYPE html>
<title>Welcome to nginx!</title>

On the "testhost" instance I've installed simple server that returns "hello world", this is working fine as well.

curl testhost.example.com

hello world

However, when I request an non existing host, it is redircted to the "example" host: curl random-string-asfasfasfasf.example.com

<!DOCTYPE html>
<title>Welcome to nginx!</title>

How can I prevent this behaviour?


Remove the address= line and put the example.com hosts you want to resolve in /etc/hosts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.