基于 4 个 8 撸了一个 CDN 友好的 DNS

2017-01-24 18:32:41 +08:00
 lbp0200

https://github.com/lbp0200/PRCDNS

  1. 只支持 TCP ,防止二级运营商搞事
  2. CDN 友好, img.alicdn.com 返回大陆地址

拿 opendns 做测试对比

dig @23.106.151.177 +tcp -p 3535 google.com.hk #PRCDNS
dig @208.67.222.222 +tcp -p 443 google.com.hk #opendns

dig @23.106.151.177 +tcp -p 3535 img.alicdn.com #PRCDNS
dig @208.67.222.222 +tcp -p 443 img.alicdn.com #opendns

测试 IP 仅供测试, DDoS 留情

14987 次点击
所在节点    DNS
75 条回复
lbp0200
2017-01-28 10:00:58 +08:00
@q0000x 一年内不会关, prcdns 需要 Python3.5 ,我也不清楚如何安装到 openwrt 上。文档我一点点写吧。
lbp0200
2017-01-28 10:41:45 +08:00
@q0000x 可以将 114 作为备用,
server {
label = "prcdns"; //设置 PRCDNS 作为上游服务器
ip = 23.106.151.177;
timeout = 10;
port = 3535;
}
server {
label = "114dns"; //备用 114DNS 作为上游服务器
ip = 114.114.114.114,114.114.115.115;
timeout = 10;
port = 53;
}
q0000x
2017-01-28 17:03:14 +08:00
@lbp0200 我先试试把 py 撸到 openwrt 上,如果可以再联系继续
q0000x
2017-01-28 17:41:11 +08:00
@lbp0200 py3.4 行不行?
lbp0200
2017-01-28 21:22:50 +08:00
@q0000x 不行
q0000x
2017-01-29 01:57:59 +08:00
@lbp0200 3.6 不知道行不行,看到你 setup 里写了 3.6 路由上已经把 3.6 的 py 撸好运行后提示

我是吧 setup.py 、 setup.config 下载到路由上执行

root@OpenWrt:~# /tmp/setup.py
/tmp/setup.py: line 2: A setuptools based setup module.
: not found
/tmp/setup.py: line 5: from: not found
/tmp/setup.py: line 6: from: not found
/tmp/setup.py: line 8: from: not found
/tmp/setup.py: line 10: syntax error: unexpected "("
lbp0200
2017-01-29 09:45:01 +08:00
@q0000x 3.6 没问题,看错误信息,可能是因为缺少 pip
q0000x
2017-01-29 11:28:06 +08:00
@lbp0200 python3-pip 已经安装过了, python3-setuptools 这个也有
lbp0200
2017-01-29 16:38:31 +08:00
@q0000x 我也不知道了,你可以尝试修改代码
q0000x
2017-01-29 21:53:54 +08:00
@lbp0200 问题是我不会 py...
q0000x
2017-01-30 01:22:43 +08:00
@lbp0200 能撸个 3.4 的吗,我这个 openwrt 上只有 3.4 的能正常运行, 3.6 那个估计是不兼容
maojy1989
2017-02-07 12:01:03 +08:00
遇到一个很尴尬的问题,我在 centos7 上安装 Python3.5.1 然后 pip install PRCDNS 当我用 yum 安装 Supervisor 的时候遇到问题了 Supervisor 启动不起来
pkg_resources.DistributionNotFound: The 'supervisor==3.1.3' distribution was not found and is required by the application

搜了很久也没找到怎么解决这个问题了,然后想试试用 pip install Supervisor 得到以下结果

ollecting supervisor
Downloading supervisor-3.3.1.tar.gz (415kB)
100% |████████████████████████████████| 419kB 2.4MB/s
Complete output from command python setup.py egg_info:
Supervisor requires Python 2.4 or later but does not work on any version of Python 3. You are using version 3.5.1 (default, Feb 7 2017, 03:41:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]. Please install using a supported version.

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-qadut3c0/supervisor/

好像是 supervisor 不支持 python3 这就很尴尬了,怎么搞?
maojy1989
2017-02-07 13:07:12 +08:00
已经解决了,果然把默认 python 换成 3.5 不是个好主意 好多地方要把 #!/usr/bin/python 换成 #!/usr/bin/python2.7
mike163
2017-02-09 13:56:17 +08:00
不能支持 udp 吗?这样可以用 dnsmasq 直接访问了
lbp0200
2017-02-09 14:43:52 +08:00
@mike163 不支持
q0000x
2017-02-11 09:28:39 +08:00
@lbp0200 话说我在你的博客上怎么找不到你的微信

python3 PRCDNS
python3: can't open file 'PRCDNS': [Errno 2] No such file or directory

pip3 install PRCDNS
Requirement already satisfied: PRCDNS in /opt/python-3.6.0/lib/python3.6/site-packages
Requirement already satisfied: asyncio in /opt/python-3.6.0/lib/python3.6/site-packages (from PRCDNS)
Requirement already satisfied: aiohttp in /opt/python-3.6.0/lib/python3.6/site-packages (from PRCDNS)
Requirement already satisfied: aiodns in /opt/python-3.6.0/lib/python3.6/site-packages (from PRCDNS)
Requirement already satisfied: cchardet in /opt/python-3.6.0/lib/python3.6/site-packages (from PRCDNS)
Requirement already satisfied: dnslib in /opt/python-3.6.0/lib/python3.6/site-packages (from PRCDNS)
Requirement already satisfied: argparse in /opt/python-3.6.0/lib/python3.6/site-packages (from PRCDNS)
Requirement already satisfied: IPy in /opt/python-3.6.0/lib/python3.6/site-packages (from PRCDNS)
Requirement already satisfied: chardet in /opt/python-3.6.0/lib/python3.6/site-packages (from aiohttp->PRCDNS)
Requirement already satisfied: multidict>=2.1.4 in /opt/python-3.6.0/lib/python3.6/site-packages (from aiohttp->PRCDNS)
Requirement already satisfied: async_timeout>=1.1.0 in /opt/python-3.6.0/lib/python3.6/site-packages (from aiohttp->PRCDNS)
Requirement already satisfied: yarl>=0.8.1 in /opt/python-3.6.0/lib/python3.6/site-packages (from aiohttp->PRCDNS)
Requirement already satisfied: pycares>=1.0.0 in /opt/python-3.6.0/lib/python3.6/site-packages (from aiodns->PRCDNS)

直接 PRCDNS 的话就是一个光标一直在闪,不能进行任何操作了
q0000x
2017-02-11 09:29:40 +08:00
@lbp0200 debian7 x64
lbp0200
2017-02-11 11:18:50 +08:00
@q0000x 对,这样程序就运行起来了,可以测试下,需要一直运行的话,搭配 supervisor
q0000x
2017-02-11 12:46:18 +08:00
@lbp0200 晕,没有任何提示我还以为挂了,又重新安装环境坐等你回复呢
q0000x
2017-02-11 13:28:08 +08:00
@lbp0200 通常情况下不关机重启不用 supervisor 也没关系吧?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://tanronggui.xyz/t/336726

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX