Asterisk DNS Requirement
Asterisk has a requirement that it always must have access to DNS queries. If Asterisk cannot access a DNS all phone registrations fail. This has been a big problem and reported on many forums. There have been many answers, most saying don’t use FQDN but use IP addresses instead. This causes other problems more specifically when a VSP changes the IP address of their SIP proxy you will not be able to access it if you have assigned the IP address statically rather than by DNS.
To fix this problem we can simply use bind (Berkeley Internet Name Domain). Using bind we can setup a DNS cache server. If the internet or the DNS server that we currently use should go down DNS queries can still be made as bind will cache all queries.
The first step is to configure bind to your specific requirements. To do this we need to create or edit the file /etc/named.conf. This file in its simplest form just needs to exist so bind can start.
Create the file if it does not exist
touch /etc/named.conf
Now for most business you will want to forward specific zones to certain name servers. To do this use the following example which will forward all lookups for domain mydomain.local to 192.168.1.1
zone "mydomain.local" { type forward; forwarders { 192.168.1.1; }; };
Once you have created the file and entered any required forwarders we can start the service and make sure it starts and boot.
service named start chkconfig --levels 2345 named on
Now edit the file /etc/resolv.conf and change the IP address of the name server to 127.0.0.1.
The final step is to make sure that all your IP phones have a DNS entry to that of your Asterisk server.
You are now done. Once you Asterisk server caches all the domain names you can lose your internet and or name servers and Asterisk will still function.