PJSIP DNS Resolve (Continued)

Continuing the discussion from PJSIP DNS resolve:

I am still experiencing problems so I proceeded with dns packet capture that was suggested in the first place.

Directly on the PBX:

tcpdump -i any -vvv port 53

The DNS Servers set are only the 2 DNS Servers of OTE below.

[root@pbx ~]# cat /etc/resolv.conf
# Configuration automatically generated via Sysadmin RPM
# MODIFICATIONS TO THIS FILE WILL BE OVERWRITTEN.
# Generated at: Thu, 08 Jun 2023 14:53:53 +0000
nameserver 195.167.21.200
nameserver 195.167.22.200

After examination of the capture I am seeing the following requests:

  1. The ones that are expected:
...
18:38:15.439634 IP (tos 0x0, ttl 64, id 27466, offset 0, flags [DF], proto UDP (17), length 59)
    pbx-local-hostname.local.36327 > 195.167.21.200.domain: [bad udp cksum 0x559e -> 0x5227!] 37226+ A? ims.otenet.gr. (31)
18:38:15.464726 IP (tos 0xfc, ttl 59, id 26692, offset 0, flags [none], proto UDP (17), length 103)
    195.167.21.200.domain > pbx-local-hostname.local.36327: [udp sum ok] 37226* q: A? ims.otenet.gr. 1/1/0 ims.otenet.gr. [1h] A 195.167.16.182 ns: ims.otenet.gr. [1h] NS bvoip-ims-ns1.otenet.gr. (75)
18:38:15.464859 IP (tos 0x0, ttl 64, id 27477, offset 0, flags [DF], proto UDP (17), length 59)
    pbx-local-hostname.local.47380 > 195.167.21.200.domain: [bad udp cksum 0x559e -> 0xaa46!] 62237+ AAAA? ims.otenet.gr. (31)
18:38:15.490955 IP (tos 0xfc, ttl 58, id 26694, offset 0, flags [none], proto UDP (17), length 120)
    195.167.21.200.domain > pbx-local-hostname.local.47380: [udp sum ok] 62237* q: AAAA? ims.otenet.gr. 0/1/0 ns: ims.otenet.gr. [1h] SOA bvoip-ims-ns1.otenet.gr. hostmaster.bvoip-ims-ns1.otenet.gr. 2020012301 10800 3600 1814400 86400 (92)
18:38:15.491052 IP (tos 0x0, ttl 64, id 27496, offset 0, flags [DF], proto UDP (17), length 72)
    pbx-local-hostname.local.59815 > 195.167.21.200.domain: [bad udp cksum 0x55ab -> 0x0a00!] 2182+ AAAA? ims.otenet.gr.cust.local. (44)
18:38:15.517448 IP (tos 0xb8, ttl 58, id 26711, offset 0, flags [none], proto UDP (17), length 147)
    195.167.21.200.domain > pbx-local-hostname.local.59815: [udp sum ok] 2182 NXDomain q: AAAA? ims.otenet.gr.cust.local. 0/1/0 ns: . [1m42s] SOA a.root-servers.net. nstld.verisign-grs.com. 2023060800 1800 900 604800 86400 (119)
18:38:15.517565 IP (tos 0x0, ttl 64, id 27502, offset 0, flags [DF], proto UDP (17), length 69)
    pbx-local-hostname.local.50772 > 195.167.21.200.domain: [bad udp cksum 0x55a8 -> 0x6c2e!] 29487+ SRV? _sip._udp.ims.otenet.gr. (41)
18:38:15.530106 IP (tos 0x0, ttl 64, id 27508, offset 0, flags [DF], proto UDP (17), length 73)
    pbx-local-hostname.local.42434 > 195.167.21.200.domain: [bad udp cksum 0x55ac -> 0x3092!] 20854+ PTR? 200.21.167.195.in-addr.arpa. (45)
18:38:15.543718 IP (tos 0xb8, ttl 58, id 26736, offset 0, flags [none], proto UDP (17), length 218)
    195.167.21.200.domain > pbx-local-hostname.local.50772: [udp sum ok] 29487* q: SRV? _sip._udp.ims.otenet.gr. 2/1/2 _sip._udp.ims.otenet.gr. [1h] SRV kole-sbc2bck.ims.otenet.gr.:5060 20 1, _sip._udp.ims.otenet.gr. [1h] SRV nyma-sbc2.ims.otenet.gr.:5060 10 1 ns: ims.otenet.gr. [1h] NS bvoip-ims-ns1.otenet.gr. ar: nyma-sbc2.ims.otenet.gr. [1h] A 195.167.16.182, kole-sbc2bck.ims.otenet.gr. [1h] A 195.167.16.181 (190)
18:38:15.543832 IP (tos 0x0, ttl 64, id 27520, offset 0, flags [DF], proto UDP (17), length 72)
    pbx-local-hostname.local.39287 > 195.167.21.200.domain: [bad udp cksum 0x55ab -> 0xaa8c!] 21681+ A? kole-sbc2bck.ims.otenet.gr. (44)
...
  1. And Here are the ones that are unexpected. For some reason I get reply from google dns even though I have not set that up, as show in /etc/resolv.conf above.
...
19:00:07.802148 IP (tos 0xfc, ttl 59, id 17861, offset 0, flags [none], proto UDP (17), length 157)
    195.167.21.200.domain > pbx-local-hostname.local.60652: [udp sum ok] 22274 NXDomain q: AAAA? nyma-sbc2.ims.otenet.gr.cust.local. 0/1/0 ns: . [10m] SOA a.root-servers.net. nstld.verisign-grs.com. 2023060800 1800 900 604800 86400 (129)
19:00:11.195424 IP (tos 0x0, ttl 64, id 30702, offset 0, flags [none], proto UDP (17), length 70)
    pbx-local-hostname.local.56540 > dns.google.domain: [bad udp cksum 0x4650 -> 0x3917!] 47261+ [1au] NAPTR? ims.otenet.gr. ar: . OPT UDPsize=4096 DO (42)
19:00:11.195483 IP (tos 0x0, ttl 64, id 35184, offset 0, flags [none], proto UDP (17), length 80)
    pbx-local-hostname.local.5438 > 195.167.21.200.domain: [bad udp cksum 0x55b3 -> 0x882c!] 30727+ [1au] SRV? _sip._udp.ims.otenet.gr. ar: . OPT UDPsize=4096 DO (52)
19:00:11.195529 IP (tos 0x0, ttl 64, id 30703, offset 0, flags [none], proto UDP (17), length 70)
    pbx-local-hostname.local.58664 > dns.google.domain: [bad udp cksum 0x4650 -> 0x3ee7!] 52353+ [1au] A? ims.otenet.gr. ar: . OPT UDPsize=4096 DO (42)
19:00:11.220824 IP (tos 0x0, ttl 112, id 43650, offset 0, flags [none], proto UDP (17), length 86)
    dns.google.domain > pbx-local-hostname.local.58664: [udp sum ok] 52353 q: A? ims.otenet.gr. 1/0/1 ims.otenet.gr. [5h49m56s] A 195.167.16.30 ar: . OPT UDPsize=512 DO (58)
19:00:11.223612 IP (tos 0xfc, ttl 58, id 19501, offset 0, flags [none], proto UDP (17), length 229)
    195.167.21.200.domain > pbx-local-hostname.local.5438: [udp sum ok] 30727* q: SRV? _sip._udp.ims.otenet.gr. 2/1/3 _sip._udp.ims.otenet.gr. [1h] SRV kole-sbc2bck.ims.otenet.gr.:5060 20 1, _sip._udp.ims.otenet.gr. [1h] SRV nyma-sbc2.ims.otenet.gr.:5060 10 1 ns: ims.otenet.gr. [1h] NS bvoip-ims-ns1.otenet.gr. ar: nyma-sbc2.ims.otenet.gr. [1h] A 195.167.16.182, kole-sbc2bck.ims.otenet.gr. [1h] A 195.167.16.181, . OPT UDPsize=4096 DO (201)
19:00:11.286737 IP (tos 0x0, ttl 113, id 51643, offset 0, flags [none], proto UDP (17), length 121)
    dns.google.domain > pbx-local-hostname.local.56540: [udp sum ok] 47261 q: NAPTR? ims.otenet.gr. 0/1/1 ns: ims.otenet.gr. [30m] SOA ns1.otenet.gr. hostmaster.ns1.otenet.gr. 2022052303 10800 3600 1814400 3600 ar: . OPT UDPsize=512 DO (93)
19:00:11.287018 IP (tos 0x0, ttl 64, id 30734, offset 0, flags [none], proto UDP (17), length 80)
    pbx-local-hostname.local.16661 > dns.google.domain: [bad udp cksum 0x465a -> 0xe567!] 3939+ [1au] A? nyma-sbc2.ims.otenet.gr. ar: . OPT UDPsize=4096 DO (52)
19:00:11.287066 IP (tos 0x0, ttl 64, id 14321, offset 0, flags [none], proto UDP (17), length 83)
    pbx-local-hostname.local.42951 > 195.167.22.200.domain: [bad udp cksum 0x56b6 -> 0x5e25!] 26657+ [1au] A? kole-sbc2bck.ims.otenet.gr. ar: . OPT UDPsize=4096 DO (55)
19:00:11.310262 IP (tos 0x0, ttl 113, id 2389, offset 0, flags [none], proto UDP (17), length 96)
    dns.google.domain > pbx-local-hostname.local.16661: [udp sum ok] 3939 q: A? nyma-sbc2.ims.otenet.gr. 1/0/1 nyma-sbc2.ims.otenet.gr. [5h28m26s] A 195.167.16.30 ar: . OPT UDPsize=512 DO (68)
...

Pastebin: https://pastebin.com/YPjgnfCq with password 7cLJrD8cLn.

Reminder of importnat IP Addresses:

#OTE DNS SERVER
#Can only be reached through OTE Equipment
195.167.21.200
195.167.22.200

#FQDN of OTE SBC
ims.otenet.gr

#ims.otenet.gr BUSINESS SBC IPs
#Can only be reached through OTE Equipment
195.167.16.181
195.167.16.182

#ims.otenet.gr CONSUMER SBC IPs
195.167.16.29
195.167.16.30

In the meantime I have set 2 trunks of OTE.
One with chan_PJSIP and one with chan_SIP.

The chan_SIP trunk is registered all this time without any problem.
Screenshot from sngrep

The chan_PJSIP is acting…weird. The name resolution changes name every once in a while. Here is a typical screenshot from sngrep.
RE-REMINDER => in order to resolve ims.otenet.gr to BUSINESS IP, it has to request to OTE DNS SERVERS, which are the ONLY DNS that are set on linux level. Any other attempt to resolve ims.otenet.gr will resolve into the CONSUMER IP.

Seems like it’s a PJSIP related I-don’t-want-to-call-it-problem.

Edit: Also, for the love of me, I can’t find where it gets to request name resolution from dns.google.domain.

The REGISTER would be using the core DNS support. If the res_resolver_unbound module is loaded then it would use the configuration from /etc/asterisk/resolver_unbound.conf. A difference between chan_pjsip and chan_sip is that chan_pjsip will resolve when the request is sent. The chan_sip module resolves when the config loaded/reloaded, and never again. It won’t change its IP address.

Thanks for the answer.

I can see the module is loaded.

pbx*CLI> module show like res_resolver_unbound.so
Module                         Description                              Use Count  Status      Support Level
res_resolver_unbound.so        Unbound DNS Resolver Support             1          Running              core
1 modules loaded

There is configuration loaded as below. which was a step to try and resolve the issue. So I will remove the entry last nameserver entry and see how it goes.

[root@pbx ~]# cat /etc/asterisk/resolver_unbound.conf
[general]
nameserver = 195.167.21.200
nameserver = 195.167.22.200
nameserver = 8.8.8.8
resolv =

Edit: To add, so from what I understand in order to ask from 8.8.8.8, the previous 2 nameservers must have failed to provide address resolution. Am I getting this correct?

At the time the documentation and the implementation was done yes, though failed can mean the server failed to respond, or did not provide a result. It’s also possible the behavior of the underlying library changed afterwards. We just give it the configured values, and it does the rest. If you don’t want any possibility of queries going to a configured nameserver, then remove it. Using a caching local resolver can also yield more control over where queries go.

Thank you for the clarification.

So far so good. I will wait to see how it behaves and will mark solution if all are good!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.