Comments (13)
直接改 ChinaDNS 所在机器的 hosts 即可。
from chinadns-python.
实测好像没有效果...
root@zmbox:~# cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 zmbox
10.0.3.100 sync.dd.local
The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
root@zmbox:# ps -ef | grep china# dig @127.0.0.1 sync.dd.local
root 23303 1 0 12:43 pts/10 00:00:00 /usr/sbin/chinadns -l /etc/chinadns/iplist.txt -c /etc/chinadns/chnroute.txt -p 53
root 24318 10865 0 16:14 pts/10 00:00:00 grep --color=auto china
root@zmbox:
; <<>> DiG 9.9.5-3-Ubuntu <<>> @127.0.0.1 sync.dd.local
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 65195
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;sync.dd.local. IN A
;; AUTHORITY SECTION:
. 10663 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2014091501 1800 900 604800 86400
;; Query time: 4013 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Sep 16 16:14:27 CST 2014
;; MSG SIZE rcvd: 117
from chinadns-python.
你用的这个不是 python 版吧。openwrt 用 dnsmasq 设置 chinadns 为上级 dns 即可。然后用 dnsmasq 设置内网解析。
from chinadns-python.
多谢.我去多挂一层....
from chinadns-python.
好像 dnsmasq 不支持非标准端口的 上游dns 服务器的??? 我google 未果...求大大帮助
from chinadns-python.
@kuyagic dnsmasq 配置文件里写 server=127.0.0.1#5353
就行了(5353是端口号)。
另外改 hosts 后记得是重启生效吧。
from chinadns-python.
@aa65535 好像我dnsmasq.conf 里这么写了 好像还是无效的.我也觉得很神奇....待我再研究下...
from chinadns-python.
@kuyagic 要用 chinadns 做上游就不要其他的 server=
参数了。
另外看一下 chinadns 监听的端口是不是 5353 ,
另外需要把 init script 里的 iptables 那里去掉。
from chinadns-python.
@aa65535 init script 里的iptables 已经去掉
server= 应该就一个吧.
chinadns 监听端口是5353
from chinadns-python.
@aa65535
我upstream 文件里 记录了 a.com 为1.1.1.1 和 server=127.0.0.1#5353的
然后执行下面的命令 和输出
root@zmbox:/etc/dnsmasq.d# dig a.com
; <<>> DiG 9.9.5-3-Ubuntu <<>> a.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19644
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;a.com. IN A
;; ANSWER SECTION:
a.com. 0 IN A 1.1.1.1
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Sep 16 16:58:51 CST 2014
;; MSG SIZE rcvd: 39
root@zmbox:/etc/dnsmasq.d# dig www.twitter.com
; <<>> DiG 9.9.5-3-Ubuntu <<>> www.twitter.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46349
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.twitter.com. IN A
;; ANSWER SECTION:
www.twitter.com. 13686 IN A 37.61.54.158
;; Query time: 8 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Sep 16 16:58:56 CST 2014
;; MSG SIZE rcvd: 60
root@zmbox:/etc/dnsmasq.d# dig +cmd www.twitter.com @127.0.0.1 -p 5353
; <<>> DiG 9.9.5-3-Ubuntu <<>> +cmd www.twitter.com @127.0.0.1 -p 5353
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16190
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.twitter.com. IN A
;; ANSWER SECTION:
www.twitter.com. 536 IN CNAME twitter.com.
twitter.com. 21 IN A 199.59.150.39
twitter.com. 21 IN A 199.59.149.230
twitter.com. 21 IN A 199.59.148.10
twitter.com. 21 IN A 199.59.149.198
;; Query time: 80 msec
;; SERVER: 127.0.0.1#5353(127.0.0.1)
;; WHEN: Tue Sep 16 16:59:15 CST 2014
;; MSG SIZE rcvd: 122
from chinadns-python.
把你的 /etc/dnsmasq.conf 和 /etc/dnsmasq.d/ 下每个文件都贴出来看看。
from chinadns-python.
dnsmasq.conf 就一行有效代码
conf-dir=/etc/dnsmasq.d
dnsmasq.d 下 有2个文件
lxc 内容如下
Tell any system-wide dnsmasq instance to make sure to bind to interfaces
instead of listening on 0.0.0.0
WARNING: changes to this file will get lost if lxc is removed.
bind-interfaces
except-interface=lxcbr0
upstream 内容如下
server=127.0.0.1#5353
address=/a.com/1.1.1.1
from chinadns-python.
@clowwindy
@aa65535
在dnsmasq.conf 里启用了 no-resolv 后就可以了
谢谢各位大大
from chinadns-python.
Related Issues (20)
- 请问errno 10054是什么意思? HOT 2
- support to specify a list of domains to use specific DNS servers HOT 1
- Any plan to make it support IPv6 DNS servers? HOT 5
- windows下经常报错然后进程就挂了 HOT 4
- Can it require the newer version of shadowsocks?
- 上海长城宽带,貌似失败 HOT 3
- Cannot start chinadns HOT 1
- Windows 安装py版本出现错误 HOT 1
- 如果不安装怎么启动chinadns? HOT 2
- TCP Only Support HOT 1
- windows版 如何修改dns的BIND_ADDR和BIND_PORT HOT 5
- 我访问http://www.iteye.com/ 这个网站 必出[Errno 10054] HOT 1
- 貌似 gfw 又新加入一 ip HOT 2
- Query via Shadowsocks HOT 5
- chinadns.c:537 sendto: Destination address required HOT 1
- new bad ips HOT 9
- windows版的 chinadns 怎么更新ip呀 HOT 1
- Not stable in OpenWrt HOT 1
- iplist Update HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chinadns-python.