Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望支持外网用TCP,内网用UDP #23

Open
tony1016 opened this issue Aug 8, 2015 · 11 comments
Open

希望支持外网用TCP,内网用UDP #23

tony1016 opened this issue Aug 8, 2015 · 11 comments

Comments

@tony1016
Copy link

tony1016 commented Aug 8, 2015

单位是代理服务器上网,对于外网只能转发TCP请求。因此外网的DNS用TCP没有问题,但是内网又是UDP请求,这种配置好像不支持

@henices
Copy link
Owner

henices commented Aug 8, 2015

目前的版本已经支持这个功能了。

配置文件中指定 "internal_dns_server": ["192.168.1.1:53"] 这个就是内网dns服务器的地址和端口,
"internal_domain": ["intra"], 这个就是需要内网dns服务器解析的域名,对于内网的DNS服务器发送的是UDP的请求,而对其他外网的地址的解析还是使用TCP。

@henices henices added the Feature label Aug 8, 2015
@tony1016
Copy link
Author

但是很奇怪,我的配置如下
{
"socket_timeout": 20,
"host": "0.0.0.0",
"port": 53,
"tcp_dns_server": [
"8.8.8.8:53"],
"enable_server_switch": true,
"speed_test" : true,
"enable_lru_cache": true,
"lru_cache_size" : 100,
"udp_mode" : false,
"daemon_process" : false,
"internal_dns_server": ["182.1.1.33"],
"internal_domain":["bankcomm.com"]
}


之后用dig测试:dig mysdc.bankcomm.com
C:\Users\Programmer>dig mysdc.bankcomm.com

; <<>> DiG 9.9.3-P1 <<>> mysdc.bankcomm.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 40720
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1024
;; QUESTION SECTION:
;mysdc.bankcomm.com. IN A

;; AUTHORITY SECTION:
bankcomm.com. 1201 IN SOA 3dnsdx3.bankcomm.com. hostmaster
.bankcomm.com. 1108 10800 3600 604800 86400

;; Query time: 259 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Aug 10 09:49:30 中国标准时间 2015
;; MSG SIZE rcvd: 102

浏览器无法访问内网

但是 dig mysdc.bankcomm.com @182.1.1.33,则是

C:\Users\Programmer>dig mysdc.bankcomm.com @182.1.1.33

; <<>> DiG 9.9.3-P1 <<>> mysdc.bankcomm.com @182.1.1.33
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49842
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;mysdc.bankcomm.com. IN A

;; ANSWER SECTION:
mysdc.bankcomm.com. 3600 IN A 182.1.56.231

;; Query time: 6 msec
;; SERVER: 182.1.1.33#53(182.1.1.33)
;; WHEN: Mon Aug 10 09:52:38 中国标准时间 2015
;; MSG SIZE rcvd: 63

@henices
Copy link
Owner

henices commented Aug 10, 2015

"internal_domain":["bankcomm.com"] -> "internal_domain":["*bankcomm.com"]
"internal_dns_server": ["182.1.1.33"] -> "internal_dns_server": ["182.1.1.33:53"]

改改看

@tony1016
Copy link
Author

我是 "internal_domain":["* bankcomm.com _"],_被markdown了

@henices
Copy link
Owner

henices commented Aug 13, 2015

可以使用了没? @tony1016

@tony1016
Copy link
Author

不可以啊,我又没有改什么,之前就有加星号,只不过被markdown当做重点了

@henices
Copy link
Owner

henices commented Aug 13, 2015

internal_dns_server": ["182.1.1.33:53"] 这个也改了? 你的配置文件少了 :53

@tony1016
Copy link
Author

也试过了,没有效果

@henices
Copy link
Owner

henices commented Aug 13, 2015

"daemon_process" : false , 使用 python tcpdns.py -f tcpdns.json -d 进入调试模式,看看有出错信息没有?

@tony1016
Copy link
Author

[2015-08-15 15:43:17,095][DEBUG] domain:mysdc.bankcomm.com, qtype:0

没有任何错误信息

@henices
Copy link
Owner

henices commented Aug 17, 2015

输出应该类似:

[2015-08-17 17:52:33,385][DEBUG] domain:ipa.intra.site.com, qtype:1
[2015-08-17 17:52:33,386][DEBUG] server: 192.168.1.1 port:53

server 和 port 那行的内容是什么?

还有这个qtype 怎么是0啊,你能用wireshark 给我抓个正常的包吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants