Asterisk slow to load and run if DNS server is not available

thetechgroup
thetechgroup used Ask the Experts™
on
I am running a couple of asterisk servers.  They are set to use a local DNS server - which forwards unknown domains to an external DNS.  I am seeing the following issues with Asterisk and DNS and any help is appreciated.

1. If the external resolution DNS is not available, when I try to load the dialplan, it takes a very long time.  you can see it loading 1 line at a time every few seconds.

2. If the local DNS server is down for any reason even after the asterisk load, it starts acting slow and erratic.

Is this an Asterisk issue or a CentOS issue.  And what can I do to avoid these slowdowns if the DNS's are down.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I would suggest you run a caching only nameserver on the asterisk box. You can set a forwarder to your regular DNS server aswell if you wish.

Author

Commented:
Would you then point the resolv to the local DNS instead of the general DNS?  Seems like that could work.  Do you have any idea what it is looking for that causes it to slow down considerably?
Yes you would point resolv.conf to the loopback address 127.0.0.1.
I am not sure whats causing it to slow down. You could run tcpdump on port 53 so it shows you all the dns requests.
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Author

Commented:
Sounds like a good idea.  Let me try and report back.
Ron MalmsteadInformation Services Manager

Commented:
You could try changing trunk host registrations, to IP address rather than Hostname...then it won't need to resolve them.

See this article and tell me if you think it might apply to your situation.
http://www.voip-info.org/wiki/view/Asterisk+SIP+srvlookup
Ron MalmsteadInformation Services Manager

Commented:
...also, how about these options in sip.conf...

http://www.asteriskdocs.org/html/apas02.html

externhost
externhost takes a fully qualified domain name as its argument. If Asterisk is behind NAT, the SIP header will normally use the private IP address assigned to the server. If you set this option, Asterisk will perform periodic DNS lookups on the hostname and replace the private IP address with the IP address returned from the DNS lookup.

    externhost=my.hostname.tld

 Warning
The use of externhost is not recommended in production systems, because if the IP address of the server changes, the wrong IP address will be set in the SIP headers until the next lookup is performed. The use of externip is recommended instead.
 

externip
externip takes an IP address as its argument. If Asterisk is behind NAT, the SIP header will normally use the private IP address assigned to the server. The remote server will not know how to route back to this address; thus, it must be replaced with a valid, routable address.

    externip=216.239.39.104

Author

Commented:
Actually, all our trunk registrations are IP based and we do not use externip or externhost.  The production PBX's do not reside behind a NAT.  Is it possibly not an Asterisk issue, but a LINUX requirement to have a valid and live DNS active at all times?
Ron MalmsteadInformation Services Manager

Commented:
Have you checked /var/log/asterisk/messages   for any errors?

Or /var/log/messages for system errors?

Author

Commented:
I still have not had a chance to install bind on the asterisk boxes yet.  Other issues came ahead, but this is still a modification we would like to make. What is the best way to configure bind as a caching server?
Depends on the distribution. If you are running Centos/Redhat then there is a package called caching-nameserver or something similarly named which you just install and set to start automatically.

Author

Commented:
Thanks.  That makes perfect sense.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial