Assume that you use Ubuntu. First download&install dnsmasq:
1 |
apt-get install dnsmasq |
Then modify the config file: /etc/dnsmasq.conf, add the following lines (Assume that you want to use port 5050 for DNS service):
1 2 3 4 |
port=5050 server=X.X.X.X server=X.X.X.X ... |
DO NOT USE PORT 53! If you do that, you’ll be fucked by the GFW.
Add firewall rule if necessary (Assume that you use UFW):
1 |
ufw allow 5050 |
Finally, enable&run:
1 |
service dnsmasq start |
Test it on your PC:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
dig @X.X.X.X -p 5050 www.youtube.com ; <<>> DiG 9.10-P1 <<>> @X.X.X.X -p 5050 www.youtube.com ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4971 ;; flags: qr rd ra; QUERY: 1, ANSWER: 12, AUTHORITY: 0, ADDITION ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;www.youtube.com. IN A ;; ANSWER SECTION: www.youtube.com. 61398 IN CNAME youtube-ui.l.google.com youtube-ui.l.google.com. 98 IN A 173.194.117.233 youtube-ui.l.google.com. 98 IN A 173.194.117.238 youtube-ui.l.google.com. 98 IN A 173.194.117.230 youtube-ui.l.google.com. 98 IN A 173.194.117.232 youtube-ui.l.google.com. 98 IN A 173.194.117.224 youtube-ui.l.google.com. 98 IN A 173.194.117.226 youtube-ui.l.google.com. 98 IN A 173.194.117.229 youtube-ui.l.google.com. 98 IN A 173.194.117.225 youtube-ui.l.google.com. 98 IN A 173.194.117.227 youtube-ui.l.google.com. 98 IN A 173.194.117.231 youtube-ui.l.google.com. 98 IN A 173.194.117.228 ;; Query time: 161 msec ;; SERVER: X.X.X.X#5050(X.X.X.X) ;; WHEN: Sun Nov 16 00:37:18 2014 ;; MSG SIZE rcvd: 254 |
Enjoy~
PS:经读者反馈,dnsmasq貌似不支持压缩指针变异,使用chinadns如果启动时候加了-m的话,会造成无法解析。有此情况的读者还请换用pdnsd。
引用: Shadowsocks+ChinaDNS实现OpenWRT路由器自动翻墙
引用: Shadowsocks + GfwList 实现 OpenWRT 路由器自动翻墙
引用: Shadowsocks + Redsocks 实现 OpenWRT 路由器自动翻墙
引用: 玩转 Shadowsocks - 本博客文章合集目录 - 飞羽博客
引用: Shadowsocks + ChnRoute 实现 OpenWRT 路由器自动翻墙 (转自飞羽博客) | Charles' Collection
引用: How-To ~ OpenWRT + Shadowsocks + ChinaDNS for phones to access outside