Internet going down takes Asterisk with it

Hello,
I am aware that there is a known issue with Asterisk, in that it will stop working if the internet connection is unavailable and there is a requirement for DNS lookups. I have a system with FreePBX Distro 10.13.66-13 and am having some issues.

When the internet connection goes down, Asterisk stops responding entirely and even phones on the same LAN can’t communicate with each other, or the server. If I disable my SIP trunks (so no lookups are taking place), the issue does not happen - so I am confident this is the same problem with DNS lookup.

From what I have read online, the solution to this in Distro is with dnsmasq. I have checked and this is installed. I made some changes to the dnsmasq settings yesterday as follows, following a search of other threads here.

System admin module -> DNS - Only server is 127.0.0.1

/etc/dnsmasq.conf:
server=8.8.8.8
server=8.8.4.4

/etc/resolv.conf:
nameserver 127.0.0.1

I have run dnsmasq --test and this shows ‘Syntax check OK’. If I dig google.com:

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.3 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57553
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;google.com. IN A

;; ANSWER SECTION:
google.com. 160 IN A 216.58.206.110

;; Query time: 26 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jul 7 09:24:26 2017
;; MSG SIZE rcvd: 44

Despite these changes (and dig supposedly showing that the lookup is OK), I get the following errors when the internet goes down and Asterisk does not function:

[2017-07-06 18:24:00] ERROR[2767] netsock2.c: getaddrinfo(“MY-SIP-SERVER”, “(null)”, …): Temporary failure in name resolution
[2017-07-06 18:24:00] WARNING[2767] acl.c: Unable to lookup ‘MY-SIP-SERVER’
[2017-07-06 18:24:00] NOTICE[2767] chan_sip.c: – Registration for ‘[email protected]’ timed out, trying again (Attempt #4)

My question is, is there something I’m missing here? I’m scratching my head with this one - I do need Asterisk to work if the internet goes down as internal traffic is just as important as external.

Thank you

Hi again, does anyone have any ideas regarding this? I have tried as many things as I can think of at the moment and still can’t work it out.

Another simpler approach is to just use IP addresses for your SIP registration strings.

Thanks Lorne, unfortunately we have to avoid this as the FQDN is pointing to a group of SIP servers and any one of them could be made primary at any time. That would leave us registering to a SIP server which is not receiving inbound calls.

I have a provider with multiple “failed over” inbound (and outbound) servers. I set up a separate trunk to each one by IP address and I’ve never had a problem with this, and I’ve been doing it since Asterisk 1.4. Yes, it is a lot more work on your part, it is reasonable and possible to set your system up to avoid using FQDN for your provider’s network.