Ho scoperto che il mio ISP (verizon) sta intercettando tutto il traffico DNS sulla porta 53.
Utilizzando iptables, voglio reindirizzare tutto il traffico di ricerca DNS su un IP e una porta specifici (5353). Qualsiasi tentativo di connessione del mio computer a un altro computer sulla porta 53 deve essere reindirizzato a 23.226.230.72:5353.
Per verificare il server DNS e la porta che sto tentando di utilizzare, ho eseguito questo comando.
~$ dig +short serverfault.com @23.226.230.72 -p5353
198.252.206.16
Questa è la regola di iptables che sto cercando di usare.
iptables -t nat -A OUTPUT -p udp -m udp --dport 53 -j DNAT --to-destination 23.226.230.72:5353
Dopo aver aggiunto quella regola, non vengono trovate tutte le ricerche DNS. Restituzione dei ping del sito Web unknown host
. Le pagine Web indicano "Server non trovato".
~$ mtr serverfault.com
Failed to resolve host: Name or service not known
Voglio che il mio DNS per le ricerche venga estratto da 23.226.230.72:5353. Come posso far funzionare la regola iptables?
MODIFICARE
Dimostrazione di intercettazione DNS (porta 53) da parte del mio ISP. Traccia l'output da scavare a 23.226.230.72 tramite la porta 5353 e quindi la 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
I miei attuali iptables. 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
qui
8.8.8.8
e8.8.4.4