Total Pageviews

Tuesday 17 March 2020

利用dns proxy程序:ts-dns解决dns污染问题

在mac机器上。
wget https://github.com/wolf-joe/ts-dns/releases/download/v0.6.0/ts-dns_0.6.0_Darwin_x86_64.tar.gz
mkdir ts-dns_0.6.0_Darwin_x86_64
mv ts-dns_0.6.0_Darwin_x86_64.tar.gz ts-dns_0.6.0_Darwin_x86_64
cd ts-dns_0.6.0_Darwin_x86_64
tar xvf ts-dns_0.6.0_Darwin_x86_64.tar.gz

yudeMacBook-Air:ts-dns_0.6.0_Darwin_x86_64 brite$ ls
LICENSE ts-dns
README.md ts-dns-full.toml
cnip.txt ts-dns.toml
gfwlist.txt ts-dns_0.6.0_Darwin_x86_64.tar.gz
yudeMacBook-Air:ts-dns_0.6.0_Darwin_x86_64 brite$ nano ts-dns.toml
yudeMacBook-Air:ts-dns_0.6.0_Darwin_x86_64 brite$ cat ts-dns.toml
# Telescope DNS Configure File
# https://github.com/wolf-joe/ts-dns

listen = ":53"
gfwlist = "gfwlist.txt"
cnip = "cnip.txt"

[groups]
  [groups.clean]
  dns = ["119.29.29.29", "223.5.5.5", "114.114.114.114"]

  [groups.dirty]
  socks5 = "127.0.0.1:1080"
  dns = ["8.8.8.8", "8.8.4.4"]
yudeMacBook-Air:ts-dns_0.6.0_Darwin_x86_64 brite$ sudo ./ts-dns -c ts-dns.toml

配置文件里的socks5 = "127.0.0.1:1080"的意思是使用本地机器上的socks5 proxy(比如ss)转发DNS请求8.8.8.88.8.4.4,所以你需要在本地机器上先运行某个socks5 proxy(比如ss)。


运用例子:
cd ~/minivtun/src && ./start-minivtun.sh

sudo route delete default && sudo route add default 10.7.0.1 && sudo route add vps-public-ip 192.168.1.1

sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1

cd ~/ts-dns_0.6.0_Darwin_x86_64 && sudo ./ts-dns -c ts-dns.toml

(需要在本地机器上先运行某个socks5 proxy,比如ss)

然后即可用minivtun-vpn畅通无阻的翻墙。