Descobri que meu ISP (verizon) está interceptando todo o tráfego DNS na porta 53.
Usando o iptables, desejo redirecionar todo o tráfego de pesquisa de DNS para um IP e uma porta específicos (5353). Qualquer tentativa de conexão com outro computador na porta 53 deve ser redirecionada para 23.226.230.72:5353.
Para verificar o servidor DNS e a porta que estou tentando usar, executei este comando.
~$ dig +short serverfault.com @23.226.230.72 -p5353
198.252.206.16
Esta é a regra do iptables que estou tentando usar.
iptables -t nat -A OUTPUT -p udp -m udp --dport 53 -j DNAT --to-destination 23.226.230.72:5353
Depois de adicionar essa regra, todas as pesquisas de DNS não são encontradas. Os pings do site retornam unknown host
. As páginas da Web dizem 'Servidor não encontrado'.
~$ mtr serverfault.com
Failed to resolve host: Name or service not known
Desejo que minhas pesquisas de DNS sejam extraídas de 23.226.230.72:5353. Como posso fazer a regra iptables funcionar?
EDITAR
Demonstração de interceptação de DNS (porta 53) pelo meu ISP. Rastreie a saída de dig para 23.226.230.72 via porta 5353 e, em seguida, porta 53.
~$ dig +trace stackexchange.com @23.226.230.72 -p5353
; <<>> DiG 9.9.5-3-Ubuntu <<>> +trace stackexchange.com @23.226.230.72 -p5353
;; global options: +cmd
. 86395 IN NS ns7.opennic.glue.
. 86395 IN NS ns4.opennic.glue.
. 86395 IN NS ns3.opennic.glue.
. 86395 IN NS ns5.opennic.glue.
. 86395 IN NS ns2.opennic.glue.
. 86395 IN NS ns10.opennic.glue.
. 86395 IN NS ns1.opennic.glue.
. 86395 IN NS ns6.opennic.glue.
. 86395 IN NS ns8.opennic.glue.
dig: couldn't get address for 'ns8.opennic.glue': no more
~$ dig +trace stackexchange.com @23.226.230.72 -p53
; <<>> DiG 9.9.5-3-Ubuntu <<>> +trace stackexchange.com @23.226.230.72 -p53
;; global options: +cmd
. 7440 IN NS f.root-servers.net.
. 7440 IN NS d.root-servers.net.
. 7440 IN NS j.root-servers.net.
. 7440 IN NS i.root-servers.net.
. 7440 IN NS g.root-servers.net.
. 7440 IN NS k.root-servers.net.
. 7440 IN NS a.root-servers.net.
. 7440 IN NS h.root-servers.net.
. 7440 IN NS e.root-servers.net.
. 7440 IN NS m.root-servers.net.
. 7440 IN NS c.root-servers.net.
. 7440 IN NS b.root-servers.net.
. 7440 IN NS l.root-servers.net.
;; Received 239 bytes from 23.226.230.72#53(23.226.230.72) in 2948 ms
stackexchange.com. 215 IN A 198.252.206.16
;; Received 62 bytes from 192.228.79.201#53(b.root-servers.net) in 116 ms
Minhas tabelas de ip atuais. iptables-save
~# iptables-save
# Generated by iptables-save v1.4.21 on Tue Jul 15 23:06:52 2014
*mangle
:PREROUTING ACCEPT [79950528:41742899703]
:INPUT ACCEPT [78748282:41360159554]
:FORWARD ACCEPT [13:5427]
:OUTPUT ACCEPT [85455483:57472640071]
:POSTROUTING ACCEPT [85480442:57475512901]
-A POSTROUTING -o lxcbr0 -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill
COMMIT
# Completed on Tue Jul 15 23:06:52 2014
# Generated by iptables-save v1.4.21 on Tue Jul 15 23:06:52 2014
*nat
:PREROUTING ACCEPT [71:18713]
:INPUT ACCEPT [7:474]
:OUTPUT ACCEPT [109:7855]
:POSTROUTING ACCEPT [109:7855]
:DOCKER - [0:0]
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.17.0.0/16 ! -d 172.17.0.0/16 -j MASQUERADE
-A POSTROUTING -s 10.0.3.0/24 ! -d 10.0.3.0/24 -j MASQUERADE
COMMIT
# Completed on Tue Jul 15 23:06:52 2014
# Generated by iptables-save v1.4.21 on Tue Jul 15 23:06:52 2014
*filter
:INPUT ACCEPT [78748139:41360144354]
:FORWARD ACCEPT [13:5427]
:OUTPUT ACCEPT [85454926:57472600172]
:fail2ban-ssh - [0:0]
:fail2ban-vsftpd - [0:0]
-A INPUT -p tcp -m multiport --dports 21,20,990,989 -j fail2ban-vsftpd
-A INPUT -p tcp -m multiport --dports 22,6622 -j fail2ban-ssh
-A INPUT -i lxcbr0 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i lxcbr0 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -i lxcbr0 -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i lxcbr0 -p udp -m udp --dport 67 -j ACCEPT
-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i docker0 ! -o docker0 -j ACCEPT
-A FORWARD -i docker0 -o docker0 -j ACCEPT
-A FORWARD -o lxcbr0 -j ACCEPT
-A FORWARD -i lxcbr0 -j ACCEPT
-A fail2ban-ssh -j RETURN
-A fail2ban-vsftpd -j RETURN
COMMIT
iptables rules
aqui
8.8.8.8
e8.8.4.4