0

When I misspell a domain name, the DNS servers of my ISP provider resolve the domain name to an IP address of a web server that tells you "we're sorry, the address you typed does not exist" together with some ads.

For example:

$ dig abcdefghijklmo.com           # using the DNS from my ISP
...
;; ANSWER SECTION:
abcdefghijklmo.com. 0   IN  A   31.199.53.9
...

$ dig abcdefghijklmo.com @8.8.8.8  # using Google's DNS
... no "ANSWER SECTION" ...

As you can see, I'm getting that useless A record instead of an empty answer. I want to get rid of that record.

From my computer I can see that the DNS server is 192.168.1.1, which is the address of my router. I could change from 192.168.1.1 to 8.8.8.8, but I would lose the ability of resolving names within my LAN, so it is not an option. My router cannot be configured in any way, I cannot change it and I do not want to run a name server on another device. I contacted my ISP and they have explicitly said that they won't help me.

TL;DR: I must use 192.168.1.1 as name server, but I want to filter out answers containing A 31.199.53.9. How can I do that?


I'm using Ubuntu Desktop 15.04 with NetworkManager and dnsmasq.

4
  • 1
    That's what I call DNS spoofing... What unbelievable crappy ISP is this?! – Nephente Oct 9 '15 at 17:00
  • If you must use the gateway as DNS, can't you set a different DNS there instead of your ISPs? – Nephente Oct 9 '15 at 17:14
  • @Nephente: unfortunately no. I cannot configure my router in any way. – user16538 Oct 9 '15 at 17:25
  • @user16538 you might not be able to configure the router, but have you considered configuring your ubuntu machine to use custom dns ? – Sergiy Kolodyazhnyy Oct 10 '15 at 17:14
0

The solution is to use /etc/hosts entry on your Ubuntu.

  1. Make sure in /etc/nsswitch.conf on dns line the first option is files.
  2. Add line in /etc/hosts:
 abcdefghijklmo.com    ip_address
2
  • I want an NXDOMAIN error when resolving abcdefghijklmo.com. I do not want it to resolve another IP address. – user16538 Oct 9 '15 at 17:27
  • no you cant. to get NXDOMAIN error the entry must be deleted from DNS. NXDOMAIN or other DNS error are feedback from DNS server. – Aizuddin Zali Oct 9 '15 at 17:32

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.