Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #184222 > unrolled thread

Weird resolver problem in Debian 8

Started byTorbjorn Pettersson <tobbe@strul.nu>
First post2017-07-25 16:40 +0200
Last post2017-07-25 19:30 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.debian.user


Contents

  Weird resolver problem in Debian 8 Torbjorn Pettersson <tobbe@strul.nu> - 2017-07-25 16:40 +0200
    Re: Weird resolver problem in Debian 8 Torbjorn Pettersson <tobbe@strul.nu> - 2017-07-25 16:50 +0200
    Re: Weird resolver problem in Debian 8 Henrique de Moraes Holschuh <hmh@debian.org> - 2017-07-25 17:50 +0200
      Re: Weird resolver problem in Debian 8 Torbjörn Pettersson <tobbe@strul.nu> - 2017-07-25 19:30 +0200

#184222 — Weird resolver problem in Debian 8

FromTorbjorn Pettersson <tobbe@strul.nu>
Date2017-07-25 16:40 +0200
SubjectWeird resolver problem in Debian 8
Message-ID<u79a9-3YE-5@gated-at.bofh.it>
Hello folks,
I came upon a weird problem with the resolver on Debian 8.

root@myserver:~# cat /etc/resolv.conf
search strul.nu
nameserver 192.168.10.20
nameserver 192.168.20.20
sortlist 192.168.20.0/255.255.254.0

root@myserver:~# grep -i hosts /etc/nsswitch.conf
hosts:          files dns

root@myserver:~# grep -i mailgw /etc/hosts
root@myserver:~#




Checking addresses in dns:

root@myserver:~# host mailgw.strul.nu
mailgw.strul.nu has address 192.168.10.11
mailgw.strul.nu has address 192.168.20.11

And ping works the way it is supposed to, every time I run it. That is,
it uses the address suggested by the sortlist:

root@myserver:~# ping mailgw.strul.nu
PING mailgw.strul.nu (172.26.20.11) 56(84) bytes of data.
64 bytes from mailgw10.strul.nu (172.26.20.11): icmp_seq=1
ttl=64 time=0.132 ms
64 bytes from mailgw10.strul.nu (172.26.20.11): icmp_seq=2
ttl=64 time=0.133 ms

Same result regardless of how many times I run it. Great,
but telnet, however, chooses one of the a records at "random".


root@myserver:~# telnet mailgw.strul.nu smtp
Trying 172.26.20.11...
Connected to mailgw.strul.nu.
Escape character is '^]'.
220 mailgw10.strul.nu ESMTP

....

root@myserver:~# telnet mailgw.strul.nu smtp
Trying 172.26.10.11...


Anyone experienced something similar, or know what could be wrong?
In my head this should be handled by libc both for telnet and ping, so
the behavior should be the same?
Also, of course "telnet" in this case isn't really the problem, it's
just an example. The problem in this case is exim4, which behaves like
telnet, not like ping.

Regards
Torbjorn

[toc] | [next] | [standalone]


#184223

FromTorbjorn Pettersson <tobbe@strul.nu>
Date2017-07-25 16:50 +0200
Message-ID<u79jQ-420-5@gated-at.bofh.it>
In reply to#184222

On 25/07/17 16:32, Torbjorn Pettersson wrote:
> Hello folks,
> I came upon a weird problem with the resolver on Debian 8.
>
> root@myserver:~# cat /etc/resolv.conf
> search strul.nu
> nameserver 192.168.10.20
> nameserver 192.168.20.20
> sortlist 192.168.20.0/255.255.254.0
>
> root@myserver:~# grep -i hosts /etc/nsswitch.conf
> hosts:          files dns
>
> root@myserver:~# grep -i mailgw /etc/hosts
> root@myserver:~#
>
>
>
>
> Checking addresses in dns:
>
> root@myserver:~# host mailgw.strul.nu
> mailgw.strul.nu has address 192.168.10.11
> mailgw.strul.nu has address 192.168.20.11
>
> And ping works the way it is supposed to, every time I run it. That is,
> it uses the address suggested by the sortlist:
>

Oups. I see that I made some errors in transcribing this for email.
Corrected it below:
> root@myserver:~# ping mailgw.strul.nu
> PING mailgw.strul.nu (192.168.20.11) 56(84) bytes of data.
> 64 bytes from mailgw10.strul.nu (192.168.20.11): icmp_seq=1
> ttl=64 time=0.132 ms
> 64 bytes from mailgw10.strul.nu (192.168.20.11): icmp_seq=2
> ttl=64 time=0.133 ms
>
> Same result regardless of how many times I run it. Great,
> but telnet, however, chooses one of the a records at "random".
>
>
> root@myserver:~# telnet mailgw.strul.nu smtp
> Trying 192.168.20.11...
> Connected to mailgw.strul.nu.
> Escape character is '^]'.
> 220 mailgw10.strul.nu ESMTP
>
> ....
>
> root@myserver:~# telnet mailgw.strul.nu smtp
> Trying 192.168.10.11...
>
>
> Anyone experienced something similar, or know what could be wrong?
> In my head this should be handled by libc both for telnet and ping, so
> the behavior should be the same?
> Also, of course "telnet" in this case isn't really the problem, it's
> just an example. The problem in this case is exim4, which behaves like
> telnet, not like ping.
>
> Regards
> Torbjorn
>

[toc] | [prev] | [next] | [standalone]


#184225

FromHenrique de Moraes Holschuh <hmh@debian.org>
Date2017-07-25 17:50 +0200
Message-ID<u7afW-4DI-57@gated-at.bofh.it>
In reply to#184222
On Tue, 25 Jul 2017, Torbjorn Pettersson wrote:
> Same result regardless of how many times I run it. Great,
> but telnet, however, chooses one of the a records at "random".

DNS sortlist works mostly for apps using outdated APIs.  telnet in
stretch has long moved to the new APIs that are IPv6-enabled properly,
and therefore they will use *all* A and AAAA records returned from the
DNS lookup (so *dns* sort order doesn't matter since it will consider
every result regardless of the order) and select which ones to try first
based on several hardcoded rules *and* (in glibc's case) local
configuration related to IPv6+IPv4 source address selection.

Please configure your network preference ordering in /etc/gai.conf, and
it should work for the majority of the stuff in Debian.  In fact, you
can even configure ipv4 ranges (or all of it) to be prefered over some
ipv6 ranges (or all of it), etc.

-- 
  Henrique Holschuh

[toc] | [prev] | [next] | [standalone]


#184230

FromTorbjörn Pettersson <tobbe@strul.nu>
Date2017-07-25 19:30 +0200
Message-ID<u7bOG-5HE-13@gated-at.bofh.it>
In reply to#184225
Ah, ok.
Thank you! I was rather confused for a while there.


Regards
Torbjorn



On 25/07/17 17:46, Henrique de Moraes Holschuh wrote:
> On Tue, 25 Jul 2017, Torbjorn Pettersson wrote:
>> Same result regardless of how many times I run it. Great,
>> but telnet, however, chooses one of the a records at "random".
> DNS sortlist works mostly for apps using outdated APIs.  telnet in
> stretch has long moved to the new APIs that are IPv6-enabled properly,
> and therefore they will use *all* A and AAAA records returned from the
> DNS lookup (so *dns* sort order doesn't matter since it will consider
> every result regardless of the order) and select which ones to try first
> based on several hardcoded rules *and* (in glibc's case) local
> configuration related to IPv6+IPv4 source address selection.
>
> Please configure your network preference ordering in /etc/gai.conf, and
> it should work for the majority of the stuff in Debian.  In fact, you
> can even configure ipv4 ranges (or all of it) to be prefered over some
> ipv6 ranges (or all of it), etc.
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web