Instalando bind/named e desabilitando suporte ipv6

Instalar o bind utilizando o yum:

yum install bind caching-nameserver

chkconfig named on
service named restart

Use seu editor de textos favorito e edite o arquivo /etc/named.caching-nameserver.conf
Após a linha: memstatistics-file “/var/named.conf”; adicione o seguinte:

forwarders { 8.8.8.8; 8.8.4.4; }; //Atente-se aos ponto-e-vírgula pois se errar, o named não starta

Note que usei DNS do Google, mas você pode adicionar mais DNS usando a notação de DNS SERVER seguido de ;

Após isso, você deve alterar o seu /etc/resolv.conf da seguinte forma:

nameserver 127.0.0.1

Note que o resolv.conf aponta única e exclusivamente para localhost, pois aqui faremos todas as consultas e manteremos em cache.

PS: Se você usa algum cliente para obter o ip da maquina via dhcp, por exemplo dhcp-client, lembre-se de desativar a opção de sobreescrever o resolve.conf (USEDNS=NO);

Após isso, vamos reiniciar o cache do DNS:

service named restart
rndc flush
rndc reload

Após reinicie seu Asterisk, e faça os testes de consulta de DNS (usando DIG, nslookup ou qualquer outra ferramenta)

Desabilitando ipv6
Após receber dezenas de mensagens no messages resolvi buscar a causa e descobri que era o suporte a ipv6 ativado no named/bind9/bind
/var/log/messages

Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘C.ROOT-SERVERS.NET/AAAA/IN’: 199.7.83.42#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘C.ROOT-SERVERS.NET/AAAA/IN’: 192.203.230.10#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘D.ROOT-SERVERS.NET/AAAA/IN’: 192.36.148.17#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘E.ROOT-SERVERS.NET/AAAA/IN’: 192.36.148.17#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘D.ROOT-SERVERS.NET/AAAA/IN’: 128.8.10.90#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘E.ROOT-SERVERS.NET/AAAA/IN’: 128.8.10.90#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘G.ROOT-SERVERS.NET/AAAA/IN’: 128.8.10.90#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘I.ROOT-SERVERS.NET/AAAA/IN’: 128.8.10.90#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘G.ROOT-SERVERS.NET/AAAA/IN’: 192.112.36.4#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘I.ROOT-SERVERS.NET/AAAA/IN’: 192.112.36.4#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘B.ROOT-SERVERS.NET/AAAA/IN’: 192.203.230.10#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘L.ROOT-SERVERS.NET/AAAA/IN’: 128.8.10.90#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘B.ROOT-SERVERS.NET/AAAA/IN’: 2001:500:1::803f:235#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘L.ROOT-SERVERS.NET/AAAA/IN’: 192.112.36.4#53
Jun 9 15:08:58 localhost named[28737]: error (network unreachable) resolving ‘B.ROOT-SERVERS.NET/AAAA/IN’: 2001:500:2f::f#53

Minha versão do named:

named -v
BIND 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6_3.6

Enfim, vários sites documentava escrever em /etc/sysconfig/named a opção:
OPTIONS=”-4″
Porem ao restartar o named sempre falhava o start

Buscando mais afundo achei esse documento que dizia:

http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/hints-daemons-bind.html

22.1.1.2. Disable BIND named for listening on IPv6 address
To disable IPv6 for listening, following options are requested to change
options {
# sure other options here, too
listen-on-v6 { none; };
};

Após, as mensagens aparentemente diminuiram mas nao cessaram.

Por fim resolvi comentar essa linha e voltar com a opção:
Comentar a linha abaixo em /etc/named.conf

// listen-on-v6 port 53 { ::1; };

E ao final do arquivo /etc/sysconfig/named adicianar a linha:
OPTIONS=”-4″
(verifique se as aspas foi inserida corretamente pois ao copiar e colar as vezes há problemas, se o bind não startar insira as aspas manualmente ao inves de CTRL C CTRL V)

DESABILITAR A OPCAO DE SEGURANCA ABAIXO:

Por fim realizei um restart do serviço e funcionou.

DESATIVAR em named.conf:

dnssec-enable no;
dnssec-validation no;

/etc/init.d/named restart
Parando o named: [ OK ]
Iniciando o named: [ OK ]

Deixe um comentário