解决DNS污染
<h3>解决DNS污染</h3>
<h5>添加本机DNS服务</h5>
<pre><code>grep "127.0.0.1" /etc/resolv.conf||sed -i '1,/^nameserver/s/nameserver/nameserver 127.0.0.1\nnameserver/' /etc/resolv.conf</code></pre>
<p>dnsmasq</p>
<pre><code>apt-get install dnsmasq
nano /etc/dnsmasq.conf
dnsmasq配置文件:
</code></pre>
<pre><code>listen-address=127.0.0.1
listen-address=192.168.xx.xxx //你的网关地址
cache-size=102400
conf-dir=/etc/dnsmasq.d</code></pre>
<h4>墙内墙外域名分开查询</h4>
<pre><code>git clone https://github.com/cokebar/gfwlist2dnsmasq
cd gfwlist2dnsmasq
./gfwlist2dnsmasq.sh -d 127.0.0.1 -p 5353 -o dnsmasq_gfwlist.conf
//5353 是V2ray配置的转发dns查询端口号
mkdir /etc/dnsmasq.d
cp dnsmasq_gfwlist.conf /etc/dnsmasq.d
cd /etc/dnsmasq.d
wget https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf</code></pre>
<p>很奇怪我这里114DNS突然不能解析网易云音乐的媒体文件服务器了,所以用114DNS听不了网易云音乐,看了下dnsmasq的记录居然是查询了网易ipv6的地址可是114不是ipv6/ipv4双栈的服务器,所以要在accelerated-domains.china.conf里改一下:</p>
<p>把server=/126.net/114.114.114.114和server=/163.com/114.114.114.114改成server=/126.net/202.120.2.101和server=/163.com/202.120.2.101</p>
<p>然后重启dnsmasq</p>
<pre><code>service dnsmasq restart</code></pre>