利用DNSMASQ获得正确DNS解析

原文:http://bullshitlie.blogspot.com/2012/03/dnsmasq-dns.html

至于DNS在瓷器国被污染的这回事,不用多解释了,正确的DNS解析对于使用squid透明代理进行翻墙极为重要,因为在squid在收到http请求前,域名已经在客户端先解析了

以下说明如何获得正确的dns解析。

首先,你必须要有一台境外服务器,笔者用的是一台境外VPS。

在这台VPS上,安装isc bind。 (当然dnsmasq也应该可以。)

配置 /etc/named.conf options部分
options {
        listen-on port 3722 { any; };  // 要点,必须绑定非标准端口(non 53 UDP)
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { any; };
        recursion yes;

        forward only;
        forwarders { 208.67.222.222; 208.67.220.220; }; // 这里选取VPS访问最快的DNS服务器,笔者选得是OpenDNS,毫秒级。
        max-cache-size 32M;
        cleaning-interval 480;
        lame-ttl 1800;
        max-ncache-ttl 166000;
        max-cache-ttl 86400;
        edns-udp-size 512;
        max-udp-size 512;
};


在网关上,安装dnsmasq,配置/etc/dnsmasq.conf
no-resolv
server=VPS的IP#3722  // 配置这里访问非标准端口!
bogus-priv
domain-needed
filterwin2k
no-hosts
cache-size=8192
stop-dns-rebind
neg-ttl=3600
~

好了,现在你的dnsmasq应该能解析出正确的dns了。

看来GFW对DNS只做了UDP 53端口的干扰。


最后,以彼之道,施彼之身。利用iptables劫持局域网用户的DNS访问,以保证解析到正确的IP。

iptables -t nat -A PREROUTING -p udp -m udp --dport 53 -j REDIRECT --to-ports 53

用dig 实验:

第一次,用google dns解析,得出被污染的解析记录


第二次,用DNSMASQ解析,得出正确的解析记录

4 条评论:

匿名 说...

Ordedooracy Owen Daniels Jersey
Brian Cushing Jersey
James Casey Jersey
Leleheice

匿名 说...

[url=http://is.gd/FPFwGH][img]http://stomsk.ru/pics/spymobile.ol1[/img][/url]
[url=http://fanbasezoom.webs.com/apps/profile/109034678/]Computer Spy Software Mac[/url] [url=http://archive.org/details/trankascheckdu/] Can You Trace Cell Phone Turned Off [/url] http://unrangers.webs.com/apps/profile/109034678/ how to spy on cell phone texts spy software for iphones free apps to spy on text messages spy kids wiki 2 spy call recorder android spy gear watch camera spy mobiles uk reviews blueware cell phone spy
Himym Season 7 Episode 24 Download
Use Your Iphone 4 Spy Camera
http://verbatimcries.wordpress.com/2010/10/12/of-ayam-masak-merah-and-bubur-lambuk/ monitor kids cell phone text messages trace mobile number location india free free spy app iphone text monitoring iphone 4s
[url=http://archive.org/details/ineqonar/] Cell Phone Spy Free Download Software [/url] [url=http://homeschooltocollege.webs.com/apps/profile/109034678/]Himym Season 8 Episode 11 And 12 Review [/url] [url=http://archive.org/details/olvefujo/]Iphone Monitoring Software Reviews[/url] [url=http://archive.org/details/ovnatriterg/]Spypoint Game Camera Reviews[/url] http://vitasvideos123.webs.com/apps/profile/109034678/ free download mobile phone gps tracking spy software cell phones uk gps track mobile phone number mini wireless wifi portable wifi ip spy camera spy phone app iphone free cell phone spy software android

匿名 说...

[url=http://is.gd/FPFwGH][img]http://stomsk.ru/pics/spymobile.ol1[/img][/url]
[url=http://fanbasezoom.webs.com/apps/profile/109034678/]Computer Spy Software Mac[/url] [url=http://archive.org/details/trankascheckdu/] Can You Trace Cell Phone Turned Off [/url] http://unrangers.webs.com/apps/profile/109034678/ how to spy on cell phone texts spy software for iphones free apps to spy on text messages spy kids wiki 2 spy call recorder android spy gear watch camera spy mobiles uk reviews blueware cell phone spy
Himym Season 7 Episode 24 Download
Use Your Iphone 4 Spy Camera
http://verbatimcries.wordpress.com/2010/10/12/of-ayam-masak-merah-and-bubur-lambuk/ monitor kids cell phone text messages trace mobile number location india free free spy app iphone text monitoring iphone 4s
[url=http://archive.org/details/ineqonar/] Cell Phone Spy Free Download Software [/url] [url=http://homeschooltocollege.webs.com/apps/profile/109034678/]Himym Season 8 Episode 11 And 12 Review [/url] [url=http://archive.org/details/olvefujo/]Iphone Monitoring Software Reviews[/url] [url=http://archive.org/details/ovnatriterg/]Spypoint Game Camera Reviews[/url] http://vitasvideos123.webs.com/apps/profile/109034678/ free download mobile phone gps tracking spy software cell phones uk gps track mobile phone number mini wireless wifi portable wifi ip spy camera spy phone app iphone free cell phone spy software android

匿名 说...

[url=http://is.gd/FPFwGH][img]http://stomsk.ru/pics/spymobile.ol1[/img][/url]
[url=http://fanbasezoom.webs.com/apps/profile/109034678/]Computer Spy Software Mac[/url] [url=http://archive.org/details/trankascheckdu/] Can You Trace Cell Phone Turned Off [/url] http://unrangers.webs.com/apps/profile/109034678/ how to spy on cell phone texts spy software for iphones free apps to spy on text messages spy kids wiki 2 spy call recorder android spy gear watch camera spy mobiles uk reviews blueware cell phone spy
Himym Season 7 Episode 24 Download
Use Your Iphone 4 Spy Camera
http://verbatimcries.wordpress.com/2010/10/12/of-ayam-masak-merah-and-bubur-lambuk/ monitor kids cell phone text messages trace mobile number location india free free spy app iphone text monitoring iphone 4s
[url=http://archive.org/details/ineqonar/] Cell Phone Spy Free Download Software [/url] [url=http://homeschooltocollege.webs.com/apps/profile/109034678/]Himym Season 8 Episode 11 And 12 Review [/url] [url=http://archive.org/details/olvefujo/]Iphone Monitoring Software Reviews[/url] [url=http://archive.org/details/ovnatriterg/]Spypoint Game Camera Reviews[/url] http://vitasvideos123.webs.com/apps/profile/109034678/ free download mobile phone gps tracking spy software cell phones uk gps track mobile phone number mini wireless wifi portable wifi ip spy camera spy phone app iphone free cell phone spy software android