Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
no-dns network matches random names [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
jesnow
l33t
l33t


Joined: 26 Apr 2006
Posts: 892

PostPosted: Wed Nov 18, 2020 12:03 am    Post subject: no-dns network matches random names [solved] Reply with quote

This is a strange behavior:

I run a small network at home and the router takes care of forwarding dns requests. Between hosts I use entries in /etc/hosts and fixed ip addresses, so i don't have to run bind. I don't want to run bind. BUT if a make a typo in a host name, my router seems to send the request to some random server:

Code:

jesnow@merckx ~ $ ping xyzzy
PING xyzzy (23.202.231.169) 56(84) bytes of data.
64 bytes from a23-202-231-169.deploy.static.akamaitechnologies.com (23.202.231.169): icmp_seq=1 ttl=50 time=56.0 ms
64 bytes from a23-202-231-169.deploy.static.akamaitechnologies.com (23.202.231.169): icmp_seq=2 ttl=50 time=55.9 ms
64 bytes from a23-202-231-169.deploy.static.akamaitechnologies.com (23.202.231.169): icmp_seq=3 ttl=50 time=56.0 ms
^C
--- xyzzy ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 55.930/55.963/55.989/0.024 ms
jesnow@merckx ~ $ ping 8348jffjk
PING 8348jffjk (23.217.138.110) 56(84) bytes of data.
64 bytes from a23-217-138-110.deploy.static.akamaitechnologies.com (23.217.138.110): icmp_seq=1 ttl=51 time=54.3 ms
64 bytes from a23-217-138-110.deploy.static.akamaitechnologies.com (23.217.138.110): icmp_seq=2 ttl=51 time=54.3 ms
64 bytes from a23-217-138-110.deploy.static.akamaitechnologies.com (23.217.138.110): icmp_seq=3 ttl=51 time=53.6 ms
64 bytes from a23-217-138-110.deploy.static.akamaitechnologies.com (23.217.138.110): icmp_seq=4 ttl=51 time=53.8 ms
64 bytes from a23-217-138-110.deploy.static.akamaitechnologies.com (23.217.138.110): icmp_seq=5 ttl=51 time=54.0 ms
^C
--- 8348jffjk ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4004ms
rtt min/avg/max/mdev = 53.627/54.005/54.297/0.268 ms
jesnow@merckx ~ $ ping bartali
PING bartali (192.168.1.116) 56(84) bytes of data.
64 bytes from bartali (192.168.1.116): icmp_seq=1 ttl=64 time=0.102 ms
64 bytes from bartali (192.168.1.116): icmp_seq=2 ttl=64 time=0.100 ms
64 bytes from bartali (192.168.1.116): icmp_seq=3 ttl=64 time=0.065 ms
^C
--- bartali ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2033ms
rtt min/avg/max/mdev = 0.065/0.089/0.102/0.017 ms
jesnow@merckx ~ $



Bartali is the local server, and the other two are random. This seems like it's not the behavior I want. Why would *anyone* want it to do that? I'm not sure what router setting to disable to prevent it from matching names without a domain.

Any insight gratefully accepted. For now it seems like a quirk.

Jon.


Last edited by jesnow on Mon Dec 14, 2020 3:46 am; edited 1 time in total
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Wed Nov 18, 2020 1:08 am    Post subject: Reply with quote

Interesting!

I get
Code:
# ping xyzzy
ping: xyzzy: No address associated with hostname

Please post your file '/etc/resolv.conf' and the output of
Code:
dig xyzzy
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23066

PostPosted: Wed Nov 18, 2020 2:25 am    Post subject: Reply with quote

There is a known defect with some ISPs that they mishandle DNS requests for non-existent domains. Instead of returning NXDOMAIN as they should, they return an A record pointing to some server they control, in the hope that the request came from a web browser that they can mislead into connecting to that server. The resulting server is usually infested with ads and may, if you are lucky, attempt to guess what you meant and suggest that to you - all in Javascript-laden HTML, of course. This behavior breaks a variety of conforming clients, among them web browsers and mail transport agents, which expect that requesting resolution of a non-existent domain will result in an answer that the domain does not exist. Such ISPs consider this misbehavior a "feature" or a "service to their users" and adamantly insist that they are doing a good thing and that you should just live with their DNS resolver being broken.
Back to top
View user's profile Send private message
jesnow
l33t
l33t


Joined: 26 Apr 2006
Posts: 892

PostPosted: Wed Nov 18, 2020 3:09 pm    Post subject: Reply with quote

That looks correct:

https://hackercodex.com/guide/how-to-stop-isp-dns-server-hijacking/

I'm going to have to think about how to fix that.

Wow.

JS.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23066

PostPosted: Wed Nov 18, 2020 5:47 pm    Post subject: Reply with quote

If the broken ISP nameserver is returning consistent addresses for the override, you might be able to configure your local resolver to rewrite responses with that A record to report NXDOMAIN to your client. Failing that, you could add an unreachable route to the bad addresses, so that traffic is stopped locally before getting to them. (This is not as good as NXDOMAIN, as clients will still wrongly think the host exists.)
Back to top
View user's profile Send private message
AlexJGreen
Tux's lil' helper
Tux's lil' helper


Joined: 19 Sep 2018
Posts: 149

PostPosted: Wed Nov 18, 2020 6:29 pm    Post subject: Reply with quote

_

Last edited by AlexJGreen on Mon Dec 28, 2020 3:01 am; edited 1 time in total
Back to top
View user's profile Send private message
jesnow
l33t
l33t


Joined: 26 Apr 2006
Posts: 892

PostPosted: Sat Nov 21, 2020 11:14 pm    Post subject: Reply with quote

Yes.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23066

PostPosted: Sat Nov 21, 2020 11:51 pm    Post subject: Reply with quote

That suggests the ISP does not intercept / redirect DNS traffic, but does mishandle requests that you send directly to them. In some rare cases, you can opt out of this DNS mangling, after which your ISP will handle DNS queries correctly. How to do this is very ISP-specific though.
Back to top
View user's profile Send private message
jesnow
l33t
l33t


Joined: 26 Apr 2006
Posts: 892

PostPosted: Sun Nov 22, 2020 2:38 am    Post subject: Reply with quote

I have to go look for the "Route my dns typos intended for the local net to random outside servers" check box and clear it!
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23066

PostPosted: Sun Nov 22, 2020 5:31 am    Post subject: Reply with quote

One option, which may or may not be available, would be to direct your local resolver not to delegate unqualified hostnames up to the ISP. This wouldn't help when you incorrectly request nosuchdomain.org, but it would stop nosuchhost from resolving.
Back to top
View user's profile Send private message
jesnow
l33t
l33t


Joined: 26 Apr 2006
Posts: 892

PostPosted: Mon Dec 14, 2020 3:46 am    Post subject: Reply with quote

Solution: It's actually very simple: Don't use your router as a nameserver. Use for example 4.4.4.4 or 8.8.8.8, they don't do that.

in /etc/resolv.conf:
Code:
domain vesarius.net
nameserver 8.8.8.8
#nameserver 2600:1700:a90:1b20::1
 


Seems to work.

Jon.
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Mon Dec 14, 2020 1:58 pm    Post subject: Reply with quote

Better yet net-dns/dnsmasq
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum