Update ReadMe.md
This commit is contained in:
355
ReadMe.md
355
ReadMe.md
@@ -1,5 +1,5 @@
|
||||
SmartDNS
|
||||
==============
|
||||
# SmartDNS
|
||||
|
||||

|
||||
SmartDNS是一个运行在本地的DNS服务器,SmartDNS接受本地客户端的DNS查询请求,从多个上游DNS服务器获取DNS查询结果,并将访问速度最快的结果返回个客户端,避免DNS污染,提高网络访问速度。
|
||||
同时支持指定特定域名IP地址,并高性匹配,达到过滤广告的效果。
|
||||
@@ -7,8 +7,8 @@ SmartDNS是一个运行在本地的DNS服务器,SmartDNS接受本地客户端
|
||||
|
||||
支持树莓派,openwrt,华硕路由器等设备。
|
||||
|
||||
软件效果展示
|
||||
==============
|
||||
## 软件效果展示
|
||||
|
||||
**阿里DNS**
|
||||
使用阿里DNS查询百度IP,并检测结果。
|
||||
|
||||
@@ -43,7 +43,8 @@ rtt min/avg/max/mdev = 31.014/31.094/31.175/0.193 ms
|
||||
```
|
||||
|
||||
**smartdns**
|
||||
使用阿里SmartDNS查询百度IP,并检测结果。
|
||||
使用阿里SmartDNS查询百度IP,并检测结果。
|
||||
|
||||
```shell
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup www.baidu.com
|
||||
Server: 192.168.1.1
|
||||
@@ -67,45 +68,51 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
||||
|
||||
从对比看出,smartdns找到访问www.baidu.com最快的IP地址,这样访问百度比阿里DNS速度快5倍。
|
||||
|
||||
特性
|
||||
## 特性
|
||||
|
||||
--------------
|
||||
1. **多DNS上游服务器**
|
||||
|
||||
1. **多DNS上游服务器**
|
||||
支持配置多个上游DNS服务器,并同时进行查询,即使其中有DNS服务器异常,也不会影响查询。
|
||||
|
||||
1. **返回最快IP地址**
|
||||
2. **返回最快IP地址**
|
||||
支持从域名所属IP地址列表中查找到访问速度最快的IP地址,并返回给客户端,避免DNS污染,提高网络访问速度。
|
||||
|
||||
1. **支持非标准端口**
|
||||
3. **支持非标准端口**
|
||||
支持非53端口查询,支持TCP查询,有效避免DNS污染。
|
||||
|
||||
1. **特定域名IP地址指定**
|
||||
4. **特定域名IP地址指定**
|
||||
支持指定域名的IP地址,达到广告过滤效果,避免恶意网站的效果。
|
||||
|
||||
1. **域名高性能后缀匹配**
|
||||
5. **域名高性能后缀匹配**
|
||||
支持域名后缀匹配模式,简化过滤配置,过滤20万条记录时间<1ms
|
||||
|
||||
1. **Linux多平台支持**
|
||||
6. **Linux多平台支持**
|
||||
支持标准Linux系统(树莓派),openwrt系统各种固件,华硕路由器原生固件。
|
||||
|
||||
1. **支持IPV4, IPV6双栈**
|
||||
7. **支持IPV4, IPV6双栈**
|
||||
支持IPV4,IPV6网络,支持查询A, AAAA记录。
|
||||
|
||||
1. **高性能,占用资源少**
|
||||
8. **高性能,占用资源少**
|
||||
多线程异步IO模式,cache缓存查询结果。
|
||||
|
||||
架构
|
||||
-------------
|
||||

|
||||
## 架构
|
||||
|
||||
--------------
|
||||
|
||||

|
||||
|
||||
1. SmartDNS接收本地网络设备的DNS查询请求,如PC,手机的查询请求。
|
||||
2. SmartDNS将查询请求发送到多个上游DNS服务器,可采用标准UDP查询,非标准端口UDP查询,及TCP查询。
|
||||
3. 上游DNS服务器返回域名对应的Server IP地址列表。SmartDNS检测与本地网络访问速度最快的Server IP。
|
||||
4. 将访问速度最快的Server IP返回给本地客户端。
|
||||
|
||||
## 使用
|
||||
|
||||
使用
|
||||
==============
|
||||
--------------
|
||||
|
||||
### 下载配套安装包
|
||||
|
||||
下载配套安装包
|
||||
--------------
|
||||
下载配套版本的SmartDNS安装包,对应安装包配套关系如下。
|
||||
|
||||
@@ -126,175 +133,196 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
||||
|openwrt LEDE|smartdns.xxxxxxxxx.arm_cortex-a7_neon-vfpv4.ipk|支持arm A7核心CPU的路由器
|
||||
|openwrt LUCI|luci-app-smartdns.xxxxxxxxx.xxxx.all.ipk|openwrt管理统一界面
|
||||
|
||||
* openwrt系统CPU架构比较多,上述表格未列出所有支持系统,请查看CPU架构后下载。
|
||||
* merlin梅林固件理论和华硕固件一直,所以根据硬件类型安装相应的ipk包即可。(梅林暂时未验证,有问题提交issue)
|
||||
* CPU架构可在路由器管理界面找到,查看方法:
|
||||
登录路由器,点击`System`->`Software`,点击`Configuration` Tab页面,在opkg安装源中可找到对应软件架构,下载路径中可找到,如下,架构为ar71xx
|
||||
* openwrt系统CPU架构比较多,上述表格未列出所有支持系统,请查看CPU架构后下载。
|
||||
* merlin梅林固件理论和华硕固件一直,所以根据硬件类型安装相应的ipk包即可。(梅林暂时未验证,有问题提交issue)
|
||||
* CPU架构可在路由器管理界面找到,查看方法:
|
||||
登录路由器,点击`System`->`Software`,点击`Configuration` Tab页面,在opkg安装源中可找到对应软件架构,下载路径中可找到,如下,架构为ar71xx
|
||||
|
||||
```
|
||||
src/gz chaos_calmer_base http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/base
|
||||
```
|
||||
```shell
|
||||
src/gz chaos_calmer_base http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/base
|
||||
```
|
||||
|
||||
请在Release页面下载:[此处下载](https://github.com/pymumu/smartdns/releases)
|
||||
请在Release页面下载:[此处下载](https://github.com/pymumu/smartdns/releases)
|
||||
|
||||
### 标准Linux系统安装(树莓派, X86_64系统)
|
||||
|
||||
标准Linux系统安装(树莓派, X86_64系统)
|
||||
--------------
|
||||
|
||||
1. 安装
|
||||
下载配套安装包`smartdns.xxxxxxxx.armhf.deb`,并上传到Linux系统中。 执行如下命令安装
|
||||
|
||||
```
|
||||
dpkg -i smartdns.xxxxxxxx.armhf.deb
|
||||
```
|
||||
下载配套安装包`smartdns.xxxxxxxx.armhf.deb`,并上传到Linux系统中。 执行如下命令安装
|
||||
|
||||
2. 修改配置
|
||||
安装完成后,可配置smartdns的上游服务器信息。具体配置参数参考`配置参数`说明。
|
||||
一般情况下,只需要增加`server [IP]:port`, `server-tcp [IP]:port`配置项
|
||||
尽可能配置多个上游DNS服务器,包括国内外的服务器。
|
||||
```shell
|
||||
dpkg -i smartdns.xxxxxxxx.armhf.deb
|
||||
```
|
||||
|
||||
```
|
||||
vi /etc/smartdns/smartdns.conf
|
||||
```
|
||||
1. 修改配置
|
||||
|
||||
3. 启动服务
|
||||
安装完成后,可配置smartdns的上游服务器信息。具体配置参数参考`配置参数`说明。
|
||||
一般情况下,只需要增加`server [IP]:port`, `server-tcp [IP]:port`配置项
|
||||
尽可能配置多个上游DNS服务器,包括国内外的服务器。
|
||||
|
||||
```
|
||||
systemctl enable smartdns
|
||||
systemctl start smartdns
|
||||
```
|
||||
```shell
|
||||
vi /etc/smartdns/smartdns.conf
|
||||
```
|
||||
|
||||
4. 将DNS请求转发的SmartDNS解析。
|
||||
修改本地路由器的DNS服务器,将DNS服务器配置为SmartDNS。
|
||||
* 登录到本地网络的路由器中,配置树莓派分配静态IP地址。
|
||||
* 修改WAN口或者DHCP DNS为树莓派IP地址。
|
||||
注意:
|
||||
I. 每款路由器配置方法不尽相同,请百度搜索相关的配置方法。
|
||||
II. 华为等路由器可能不支持配置DNS为本地IP,请修改PC端,手机端DNS服务器为树莓派IP。
|
||||
1. 启动服务
|
||||
|
||||
5. 检测服务是否配置成功。
|
||||
使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||
```shell
|
||||
systemctl enable smartdns
|
||||
systemctl start smartdns
|
||||
```
|
||||
|
||||
```
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
1. 将DNS请求转发的SmartDNS解析。
|
||||
|
||||
Non-authoritative answer:
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
修改本地路由器的DNS服务器,将DNS服务器配置为SmartDNS。
|
||||
* 登录到本地网络的路由器中,配置树莓派分配静态IP地址。
|
||||
* 修改WAN口或者DHCP DNS为树莓派IP地址。
|
||||
注意:
|
||||
I. 每款路由器配置方法不尽相同,请百度搜索相关的配置方法。
|
||||
II. 华为等路由器可能不支持配置DNS为本地IP,请修改PC端,手机端DNS服务器为树莓派IP。
|
||||
|
||||
1. 检测服务是否配置成功。
|
||||
|
||||
使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||
|
||||
```shell
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
|
||||
Non-authoritative answer:
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
|
||||
openwrt/LEDE
|
||||
|
||||
--------------
|
||||
1. 安装
|
||||
将软件使用winscp上传到路由器的/root目录,执行如下命令安装
|
||||
|
||||
```
|
||||
opkg install smartdns.xxxxxxxx.xxxx.ipk
|
||||
opkg install luci-app-smartdns.xxxxxxxx.xxxx.all.ipk
|
||||
```
|
||||
1. 安装
|
||||
|
||||
2. 修改配置
|
||||
登陆openwrt管理页面,打开Services->SmartDNS进行配置。
|
||||
* 在Upstream Servers增加上游DNS服务器配置,将以配置多个国内外DNS服务器。
|
||||
* 在Domain Address指定特定域名的IP地址,可用于广告屏蔽。
|
||||
将软件使用winscp上传到路由器的/root目录,执行如下命令安装
|
||||
|
||||
3. 启动服务
|
||||
勾选配置页面中的`Enable(启用)`来启动SmartDNS
|
||||
```shell
|
||||
opkg install smartdns.xxxxxxxx.xxxx.ipk
|
||||
opkg install luci-app-smartdns.xxxxxxxx.xxxx.all.ipk
|
||||
```
|
||||
|
||||
4. 检测服务是否配置成功
|
||||
使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||
1. 修改配置
|
||||
|
||||
```
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
登陆openwrt管理页面,打开Services->SmartDNS进行配置。
|
||||
* 在Upstream Servers增加上游DNS服务器配置,将以配置多个国内外DNS服务器。
|
||||
* 在Domain Address指定特定域名的IP地址,可用于广告屏蔽。
|
||||
|
||||
Non-authoritative answer:
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
1. 启动服务
|
||||
勾选配置页面中的`Enable(启用)`来启动SmartDNS
|
||||
|
||||
5. 注意:
|
||||
* 如已经安装chinaDNS,建议将chinaDNS的上游配置为SmartDNS。
|
||||
* SmartDNS默认情况,将53端口的请求转发到SmartDNS的本地端口,由`Redirect`配置选项控制。
|
||||
1. 检测服务是否配置成功
|
||||
|
||||
6. 界面提示重定向失败:
|
||||
* 检查iptable,ip6table命令是否正确安装。
|
||||
* openwrt 15.01系统不支持IPV6重定向,如网络需要支持IPV6,请将DNSMASQ上游改为smartdns,或者将smartdns的端口改为53,并停用dnsmasq。
|
||||
* LEDE之后系统,请安装IPV6的nat转发驱动。点击`system`->`Software`,点击`update lists`更新软件列表后,安装`ip6tables-mod-nat`
|
||||
* 使用如下命令检查路由规则是否生效。
|
||||
使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||
|
||||
```
|
||||
iptables -t nat -L PREROUTING | grep REDIRECT
|
||||
```
|
||||
```shell
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
|
||||
Non-authoritative answer:
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
|
||||
1. 注意:
|
||||
* 如已经安装chinaDNS,建议将chinaDNS的上游配置为SmartDNS。
|
||||
* SmartDNS默认情况,将53端口的请求转发到SmartDNS的本地端口,由`Redirect`配置选项控制。
|
||||
|
||||
1. 界面提示重定向失败:
|
||||
* 检查iptable,ip6table命令是否正确安装。
|
||||
* openwrt 15.01系统不支持IPV6重定向,如网络需要支持IPV6,请将DNSMASQ上游改为smartdns,或者将smartdns的端口改为53,并停用dnsmasq。
|
||||
* LEDE之后系统,请安装IPV6的nat转发驱动。点击`system`->`Software`,点击`update lists`更新软件列表后,安装`ip6tables-mod-nat`
|
||||
* 使用如下命令检查路由规则是否生效。
|
||||
|
||||
```shell
|
||||
iptables -t nat -L PREROUTING | grep REDIRECT
|
||||
```
|
||||
|
||||
华硕路由器原生固件
|
||||
|
||||
--------------
|
||||
1. 准备
|
||||
在使用此软件时,需要确认路由器是否支持U盘,并准备好U盘一个。
|
||||
|
||||
1. 启用SSH登录
|
||||
登录管理界面,点击`系统管理`->点击`系统设置`,配置`Enable SSH`为`Lan Only`。
|
||||
SSH登录用户名密码与管理界面相同。
|
||||
1. 准备
|
||||
|
||||
2. 下载`Download Master`
|
||||
在管理界面点击`USB相关应用`->点击`Download Master`下载。
|
||||
下载完成后,启用`Download Master`,如果不需要下载功能,此处可以卸载`Download Master`,但要保证卸载前Download Master是启用的。
|
||||
在使用此软件时,需要确认路由器是否支持U盘,并准备好U盘一个。
|
||||
|
||||
3. 安装SmartDNS
|
||||
将软件使用winscp上传到路由器的`/tmp/mnt/sda1`目录。(或网上邻居复制到sda1共享目录)
|
||||
|
||||
```
|
||||
ipkg install smartdns.xxxxxxx.mipsbig.ipk
|
||||
```
|
||||
1. 启用SSH登录
|
||||
|
||||
4. 重启路由器生效服务
|
||||
待路由器启动后,使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||
登录管理界面,点击`系统管理`->点击`系统设置`,配置`Enable SSH`为`Lan Only`。
|
||||
SSH登录用户名密码与管理界面相同。
|
||||
|
||||
```
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
1. 下载`Download Master`
|
||||
|
||||
Non-authoritative answer:
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
在管理界面点击`USB相关应用`->点击`Download Master`下载。
|
||||
下载完成后,启用`Download Master`,如果不需要下载功能,此处可以卸载`Download Master`,但要保证卸载前Download Master是启用的。
|
||||
|
||||
5. 额外说明
|
||||
上述过程,smartdns将安装到U盘根目录,采用optware的模式运行。
|
||||
其目录结构如下: (此处仅列出smartdns相关文件)
|
||||
|
||||
```
|
||||
U盘
|
||||
└── asusware.mipsbig
|
||||
├── bin
|
||||
├── etc
|
||||
| ├── smartdns
|
||||
| | └── smartdns.conf
|
||||
| └── init.d
|
||||
| └── S50smartdns
|
||||
├── lib
|
||||
├── sbin
|
||||
├── usr
|
||||
| └── sbin
|
||||
| └── smartdns
|
||||
....
|
||||
```
|
||||
如要修改配置,可以ssh登录路由器,使用vi命令修改
|
||||
1. 安装SmartDNS
|
||||
|
||||
```
|
||||
vi /opt/etc/smartdns/smartdns.conf
|
||||
```
|
||||
将软件使用winscp上传到路由器的`/tmp/mnt/sda1`目录。(或网上邻居复制到sda1共享目录)
|
||||
|
||||
也可以通过网上邻居修改,网上邻居共享目录`sda1`看不到`asusware.mipsbig`目录,但可以直接在`文件管理器`中输入`asusware.mipsbig\etc\init.d`访问。
|
||||
|
||||
```
|
||||
\\192.168.1.1\sda1\asusware.mipsbig\etc\init.d
|
||||
```
|
||||
```shell
|
||||
ipkg install smartdns.xxxxxxx.mipsbig.ipk
|
||||
```
|
||||
|
||||
配置参数
|
||||
==============
|
||||
1. 重启路由器生效服务
|
||||
|
||||
待路由器启动后,使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||
|
||||
```shell
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
|
||||
Non-authoritative answer:
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
|
||||
1. 额外说明
|
||||
|
||||
上述过程,smartdns将安装到U盘根目录,采用optware的模式运行。
|
||||
其目录结构如下: (此处仅列出smartdns相关文件)
|
||||
|
||||
```shell
|
||||
U盘
|
||||
└── asusware.mipsbig
|
||||
├── bin
|
||||
├── etc
|
||||
| ├── smartdns
|
||||
| | └── smartdns.conf
|
||||
| └── init.d
|
||||
| └── S50smartdns
|
||||
├── lib
|
||||
├── sbin
|
||||
├── usr
|
||||
| └── sbin
|
||||
| └── smartdns
|
||||
....
|
||||
```
|
||||
|
||||
如要修改配置,可以ssh登录路由器,使用vi命令修改
|
||||
|
||||
```shell
|
||||
vi /opt/etc/smartdns/smartdns.conf
|
||||
```
|
||||
|
||||
也可以通过网上邻居修改,网上邻居共享目录`sda1`看不到`asusware.mipsbig`目录,但可以直接在`文件管理器`中输入`asusware.mipsbig\etc\init.d`访问
|
||||
|
||||
```shell
|
||||
\\192.168.1.1\sda1\asusware.mipsbig\etc\init.d
|
||||
```
|
||||
|
||||
## 配置参数
|
||||
|
||||
--------------
|
||||
|
||||
|参数|功能|默认值|配置值|例子|
|
||||
|--|--|--|--|--|
|
||||
@@ -313,27 +341,36 @@ vi /opt/etc/smartdns/smartdns.conf
|
||||
|server-tcp|上游TCP DNS|无|[IP][:port],可重复| server-tcp 8.8.8.8:53
|
||||
|address|指定域名IP地址|无|address /domain/ip| address /www.example.com/1.2.3.4
|
||||
|
||||
[Donate](#Donate)
|
||||
==============
|
||||
## [Donate](#Donate)
|
||||
|
||||
--------------
|
||||
|
||||
如果你觉得此项目对你有帮助,请捐助我们,以使项目能持续发展,更加完善。
|
||||
* PayPal
|
||||
|
||||
### PayPal
|
||||
|
||||
[](https://paypal.me/PengNick/)
|
||||
|
||||
* Alipay 支付宝
|
||||
### Alipay 支付宝
|
||||
|
||||

|
||||
|
||||
* Wechat 微信
|
||||
### Wechat 微信
|
||||
|
||||

|
||||
|
||||
声明
|
||||
==============
|
||||
## 声明
|
||||
|
||||
--------------
|
||||
|
||||
* `SmartDNS`著作权归属Nick Peng (pymumu at gmail.com)。
|
||||
* `SmartDNS`为免费软件,用户可以非商业性地复制和使用`SmartDNS`。
|
||||
* 禁止将 `SmartDNS` 用于商业用途。
|
||||
* 使用本软件的风险由用户自行承担,在适用法律允许的最大范围内,对因使用本产品所产生的损害及风险,包括但不限于直接或间接的个人损害、商业赢利的丧失、贸易中断、商业信息的丢失或任何其它经济损失,不承担任何责任。
|
||||
* 本软件不会未经用户同意收集任何用户信息。
|
||||
|
||||
## 说明
|
||||
|
||||
--------------
|
||||
|
||||
说明
|
||||
==============
|
||||
目前代码未开源,后续根据情况开源。
|
||||
|
||||
355
ReadMe_zh-CN.md
355
ReadMe_zh-CN.md
@@ -1,5 +1,5 @@
|
||||
SmartDNS
|
||||
==============
|
||||
# SmartDNS
|
||||
|
||||

|
||||
SmartDNS是一个运行在本地的DNS服务器,SmartDNS接受本地客户端的DNS查询请求,从多个上游DNS服务器获取DNS查询结果,并将访问速度最快的结果返回个客户端,避免DNS污染,提高网络访问速度。
|
||||
同时支持指定特定域名IP地址,并高性匹配,达到过滤广告的效果。
|
||||
@@ -7,8 +7,8 @@ SmartDNS是一个运行在本地的DNS服务器,SmartDNS接受本地客户端
|
||||
|
||||
支持树莓派,openwrt,华硕路由器等设备。
|
||||
|
||||
软件效果展示
|
||||
==============
|
||||
## 软件效果展示
|
||||
|
||||
**阿里DNS**
|
||||
使用阿里DNS查询百度IP,并检测结果。
|
||||
|
||||
@@ -43,7 +43,8 @@ rtt min/avg/max/mdev = 31.014/31.094/31.175/0.193 ms
|
||||
```
|
||||
|
||||
**smartdns**
|
||||
使用阿里SmartDNS查询百度IP,并检测结果。
|
||||
使用阿里SmartDNS查询百度IP,并检测结果。
|
||||
|
||||
```shell
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup www.baidu.com
|
||||
Server: 192.168.1.1
|
||||
@@ -67,45 +68,51 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
||||
|
||||
从对比看出,smartdns找到访问www.baidu.com最快的IP地址,这样访问百度比阿里DNS速度快5倍。
|
||||
|
||||
特性
|
||||
## 特性
|
||||
|
||||
--------------
|
||||
1. **多DNS上游服务器**
|
||||
|
||||
1. **多DNS上游服务器**
|
||||
支持配置多个上游DNS服务器,并同时进行查询,即使其中有DNS服务器异常,也不会影响查询。
|
||||
|
||||
1. **返回最快IP地址**
|
||||
2. **返回最快IP地址**
|
||||
支持从域名所属IP地址列表中查找到访问速度最快的IP地址,并返回给客户端,避免DNS污染,提高网络访问速度。
|
||||
|
||||
1. **支持非标准端口**
|
||||
3. **支持非标准端口**
|
||||
支持非53端口查询,支持TCP查询,有效避免DNS污染。
|
||||
|
||||
1. **特定域名IP地址指定**
|
||||
4. **特定域名IP地址指定**
|
||||
支持指定域名的IP地址,达到广告过滤效果,避免恶意网站的效果。
|
||||
|
||||
1. **域名高性能后缀匹配**
|
||||
5. **域名高性能后缀匹配**
|
||||
支持域名后缀匹配模式,简化过滤配置,过滤20万条记录时间<1ms
|
||||
|
||||
1. **Linux多平台支持**
|
||||
6. **Linux多平台支持**
|
||||
支持标准Linux系统(树莓派),openwrt系统各种固件,华硕路由器原生固件。
|
||||
|
||||
1. **支持IPV4, IPV6双栈**
|
||||
7. **支持IPV4, IPV6双栈**
|
||||
支持IPV4,IPV6网络,支持查询A, AAAA记录。
|
||||
|
||||
1. **高性能,占用资源少**
|
||||
8. **高性能,占用资源少**
|
||||
多线程异步IO模式,cache缓存查询结果。
|
||||
|
||||
架构
|
||||
-------------
|
||||

|
||||
## 架构
|
||||
|
||||
--------------
|
||||
|
||||

|
||||
|
||||
1. SmartDNS接收本地网络设备的DNS查询请求,如PC,手机的查询请求。
|
||||
2. SmartDNS将查询请求发送到多个上游DNS服务器,可采用标准UDP查询,非标准端口UDP查询,及TCP查询。
|
||||
3. 上游DNS服务器返回域名对应的Server IP地址列表。SmartDNS检测与本地网络访问速度最快的Server IP。
|
||||
4. 将访问速度最快的Server IP返回给本地客户端。
|
||||
|
||||
## 使用
|
||||
|
||||
使用
|
||||
==============
|
||||
--------------
|
||||
|
||||
### 下载配套安装包
|
||||
|
||||
下载配套安装包
|
||||
--------------
|
||||
下载配套版本的SmartDNS安装包,对应安装包配套关系如下。
|
||||
|
||||
@@ -126,175 +133,196 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
||||
|openwrt LEDE|smartdns.xxxxxxxxx.arm_cortex-a7_neon-vfpv4.ipk|支持arm A7核心CPU的路由器
|
||||
|openwrt LUCI|luci-app-smartdns.xxxxxxxxx.xxxx.all.ipk|openwrt管理统一界面
|
||||
|
||||
* openwrt系统CPU架构比较多,上述表格未列出所有支持系统,请查看CPU架构后下载。
|
||||
* merlin梅林固件理论和华硕固件一直,所以根据硬件类型安装相应的ipk包即可。(梅林暂时未验证,有问题提交issue)
|
||||
* CPU架构可在路由器管理界面找到,查看方法:
|
||||
登录路由器,点击`System`->`Software`,点击`Configuration` Tab页面,在opkg安装源中可找到对应软件架构,下载路径中可找到,如下,架构为ar71xx
|
||||
* openwrt系统CPU架构比较多,上述表格未列出所有支持系统,请查看CPU架构后下载。
|
||||
* merlin梅林固件理论和华硕固件一直,所以根据硬件类型安装相应的ipk包即可。(梅林暂时未验证,有问题提交issue)
|
||||
* CPU架构可在路由器管理界面找到,查看方法:
|
||||
登录路由器,点击`System`->`Software`,点击`Configuration` Tab页面,在opkg安装源中可找到对应软件架构,下载路径中可找到,如下,架构为ar71xx
|
||||
|
||||
```
|
||||
src/gz chaos_calmer_base http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/base
|
||||
```
|
||||
```shell
|
||||
src/gz chaos_calmer_base http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/base
|
||||
```
|
||||
|
||||
请在Release页面下载:[此处下载](https://github.com/pymumu/smartdns/releases)
|
||||
请在Release页面下载:[此处下载](https://github.com/pymumu/smartdns/releases)
|
||||
|
||||
### 标准Linux系统安装(树莓派, X86_64系统)
|
||||
|
||||
标准Linux系统安装(树莓派, X86_64系统)
|
||||
--------------
|
||||
|
||||
1. 安装
|
||||
下载配套安装包`smartdns.xxxxxxxx.armhf.deb`,并上传到Linux系统中。 执行如下命令安装
|
||||
|
||||
```
|
||||
dpkg -i smartdns.xxxxxxxx.armhf.deb
|
||||
```
|
||||
下载配套安装包`smartdns.xxxxxxxx.armhf.deb`,并上传到Linux系统中。 执行如下命令安装
|
||||
|
||||
2. 修改配置
|
||||
安装完成后,可配置smartdns的上游服务器信息。具体配置参数参考`配置参数`说明。
|
||||
一般情况下,只需要增加`server [IP]:port`, `server-tcp [IP]:port`配置项
|
||||
尽可能配置多个上游DNS服务器,包括国内外的服务器。
|
||||
```shell
|
||||
dpkg -i smartdns.xxxxxxxx.armhf.deb
|
||||
```
|
||||
|
||||
```
|
||||
vi /etc/smartdns/smartdns.conf
|
||||
```
|
||||
1. 修改配置
|
||||
|
||||
3. 启动服务
|
||||
安装完成后,可配置smartdns的上游服务器信息。具体配置参数参考`配置参数`说明。
|
||||
一般情况下,只需要增加`server [IP]:port`, `server-tcp [IP]:port`配置项
|
||||
尽可能配置多个上游DNS服务器,包括国内外的服务器。
|
||||
|
||||
```
|
||||
systemctl enable smartdns
|
||||
systemctl start smartdns
|
||||
```
|
||||
```shell
|
||||
vi /etc/smartdns/smartdns.conf
|
||||
```
|
||||
|
||||
4. 将DNS请求转发的SmartDNS解析。
|
||||
修改本地路由器的DNS服务器,将DNS服务器配置为SmartDNS。
|
||||
* 登录到本地网络的路由器中,配置树莓派分配静态IP地址。
|
||||
* 修改WAN口或者DHCP DNS为树莓派IP地址。
|
||||
注意:
|
||||
I. 每款路由器配置方法不尽相同,请百度搜索相关的配置方法。
|
||||
II. 华为等路由器可能不支持配置DNS为本地IP,请修改PC端,手机端DNS服务器为树莓派IP。
|
||||
1. 启动服务
|
||||
|
||||
5. 检测服务是否配置成功。
|
||||
使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||
```shell
|
||||
systemctl enable smartdns
|
||||
systemctl start smartdns
|
||||
```
|
||||
|
||||
```
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
1. 将DNS请求转发的SmartDNS解析。
|
||||
|
||||
Non-authoritative answer:
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
修改本地路由器的DNS服务器,将DNS服务器配置为SmartDNS。
|
||||
* 登录到本地网络的路由器中,配置树莓派分配静态IP地址。
|
||||
* 修改WAN口或者DHCP DNS为树莓派IP地址。
|
||||
注意:
|
||||
I. 每款路由器配置方法不尽相同,请百度搜索相关的配置方法。
|
||||
II. 华为等路由器可能不支持配置DNS为本地IP,请修改PC端,手机端DNS服务器为树莓派IP。
|
||||
|
||||
1. 检测服务是否配置成功。
|
||||
|
||||
使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||
|
||||
```shell
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
|
||||
Non-authoritative answer:
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
|
||||
openwrt/LEDE
|
||||
|
||||
--------------
|
||||
1. 安装
|
||||
将软件使用winscp上传到路由器的/root目录,执行如下命令安装
|
||||
|
||||
```
|
||||
opkg install smartdns.xxxxxxxx.xxxx.ipk
|
||||
opkg install luci-app-smartdns.xxxxxxxx.xxxx.all.ipk
|
||||
```
|
||||
1. 安装
|
||||
|
||||
2. 修改配置
|
||||
登陆openwrt管理页面,打开Services->SmartDNS进行配置。
|
||||
* 在Upstream Servers增加上游DNS服务器配置,将以配置多个国内外DNS服务器。
|
||||
* 在Domain Address指定特定域名的IP地址,可用于广告屏蔽。
|
||||
将软件使用winscp上传到路由器的/root目录,执行如下命令安装
|
||||
|
||||
3. 启动服务
|
||||
勾选配置页面中的`Enable(启用)`来启动SmartDNS
|
||||
```shell
|
||||
opkg install smartdns.xxxxxxxx.xxxx.ipk
|
||||
opkg install luci-app-smartdns.xxxxxxxx.xxxx.all.ipk
|
||||
```
|
||||
|
||||
4. 检测服务是否配置成功
|
||||
使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||
1. 修改配置
|
||||
|
||||
```
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
登陆openwrt管理页面,打开Services->SmartDNS进行配置。
|
||||
* 在Upstream Servers增加上游DNS服务器配置,将以配置多个国内外DNS服务器。
|
||||
* 在Domain Address指定特定域名的IP地址,可用于广告屏蔽。
|
||||
|
||||
Non-authoritative answer:
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
1. 启动服务
|
||||
勾选配置页面中的`Enable(启用)`来启动SmartDNS
|
||||
|
||||
5. 注意:
|
||||
* 如已经安装chinaDNS,建议将chinaDNS的上游配置为SmartDNS。
|
||||
* SmartDNS默认情况,将53端口的请求转发到SmartDNS的本地端口,由`Redirect`配置选项控制。
|
||||
1. 检测服务是否配置成功
|
||||
|
||||
6. 界面提示重定向失败:
|
||||
* 检查iptable,ip6table命令是否正确安装。
|
||||
* openwrt 15.01系统不支持IPV6重定向,如网络需要支持IPV6,请将DNSMASQ上游改为smartdns,或者将smartdns的端口改为53,并停用dnsmasq。
|
||||
* LEDE之后系统,请安装IPV6的nat转发驱动。点击`system`->`Software`,点击`update lists`更新软件列表后,安装`ip6tables-mod-nat`
|
||||
* 使用如下命令检查路由规则是否生效。
|
||||
使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||
|
||||
```
|
||||
iptables -t nat -L PREROUTING | grep REDIRECT
|
||||
```
|
||||
```shell
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
|
||||
Non-authoritative answer:
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
|
||||
1. 注意:
|
||||
* 如已经安装chinaDNS,建议将chinaDNS的上游配置为SmartDNS。
|
||||
* SmartDNS默认情况,将53端口的请求转发到SmartDNS的本地端口,由`Redirect`配置选项控制。
|
||||
|
||||
1. 界面提示重定向失败:
|
||||
* 检查iptable,ip6table命令是否正确安装。
|
||||
* openwrt 15.01系统不支持IPV6重定向,如网络需要支持IPV6,请将DNSMASQ上游改为smartdns,或者将smartdns的端口改为53,并停用dnsmasq。
|
||||
* LEDE之后系统,请安装IPV6的nat转发驱动。点击`system`->`Software`,点击`update lists`更新软件列表后,安装`ip6tables-mod-nat`
|
||||
* 使用如下命令检查路由规则是否生效。
|
||||
|
||||
```shell
|
||||
iptables -t nat -L PREROUTING | grep REDIRECT
|
||||
```
|
||||
|
||||
华硕路由器原生固件
|
||||
|
||||
--------------
|
||||
1. 准备
|
||||
在使用此软件时,需要确认路由器是否支持U盘,并准备好U盘一个。
|
||||
|
||||
1. 启用SSH登录
|
||||
登录管理界面,点击`系统管理`->点击`系统设置`,配置`Enable SSH`为`Lan Only`。
|
||||
SSH登录用户名密码与管理界面相同。
|
||||
1. 准备
|
||||
|
||||
2. 下载`Download Master`
|
||||
在管理界面点击`USB相关应用`->点击`Download Master`下载。
|
||||
下载完成后,启用`Download Master`,如果不需要下载功能,此处可以卸载`Download Master`,但要保证卸载前Download Master是启用的。
|
||||
在使用此软件时,需要确认路由器是否支持U盘,并准备好U盘一个。
|
||||
|
||||
3. 安装SmartDNS
|
||||
将软件使用winscp上传到路由器的`/tmp/mnt/sda1`目录。(或网上邻居复制到sda1共享目录)
|
||||
|
||||
```
|
||||
ipkg install smartdns.xxxxxxx.mipsbig.ipk
|
||||
```
|
||||
1. 启用SSH登录
|
||||
|
||||
4. 重启路由器生效服务
|
||||
待路由器启动后,使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||
登录管理界面,点击`系统管理`->点击`系统设置`,配置`Enable SSH`为`Lan Only`。
|
||||
SSH登录用户名密码与管理界面相同。
|
||||
|
||||
```
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
1. 下载`Download Master`
|
||||
|
||||
Non-authoritative answer:
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
在管理界面点击`USB相关应用`->点击`Download Master`下载。
|
||||
下载完成后,启用`Download Master`,如果不需要下载功能,此处可以卸载`Download Master`,但要保证卸载前Download Master是启用的。
|
||||
|
||||
5. 额外说明
|
||||
上述过程,smartdns将安装到U盘根目录,采用optware的模式运行。
|
||||
其目录结构如下: (此处仅列出smartdns相关文件)
|
||||
|
||||
```
|
||||
U盘
|
||||
└── asusware.mipsbig
|
||||
├── bin
|
||||
├── etc
|
||||
| ├── smartdns
|
||||
| | └── smartdns.conf
|
||||
| └── init.d
|
||||
| └── S50smartdns
|
||||
├── lib
|
||||
├── sbin
|
||||
├── usr
|
||||
| └── sbin
|
||||
| └── smartdns
|
||||
....
|
||||
```
|
||||
如要修改配置,可以ssh登录路由器,使用vi命令修改
|
||||
1. 安装SmartDNS
|
||||
|
||||
```
|
||||
vi /opt/etc/smartdns/smartdns.conf
|
||||
```
|
||||
将软件使用winscp上传到路由器的`/tmp/mnt/sda1`目录。(或网上邻居复制到sda1共享目录)
|
||||
|
||||
也可以通过网上邻居修改,网上邻居共享目录`sda1`看不到`asusware.mipsbig`目录,但可以直接在`文件管理器`中输入`asusware.mipsbig\etc\init.d`访问。
|
||||
|
||||
```
|
||||
\\192.168.1.1\sda1\asusware.mipsbig\etc\init.d
|
||||
```
|
||||
```shell
|
||||
ipkg install smartdns.xxxxxxx.mipsbig.ipk
|
||||
```
|
||||
|
||||
配置参数
|
||||
==============
|
||||
1. 重启路由器生效服务
|
||||
|
||||
待路由器启动后,使用`nslookup -querytype=ptr 127.0.0.1`查询域名
|
||||
看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效
|
||||
|
||||
```shell
|
||||
pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 127.0.0.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
|
||||
Non-authoritative answer:
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
|
||||
1. 额外说明
|
||||
|
||||
上述过程,smartdns将安装到U盘根目录,采用optware的模式运行。
|
||||
其目录结构如下: (此处仅列出smartdns相关文件)
|
||||
|
||||
```shell
|
||||
U盘
|
||||
└── asusware.mipsbig
|
||||
├── bin
|
||||
├── etc
|
||||
| ├── smartdns
|
||||
| | └── smartdns.conf
|
||||
| └── init.d
|
||||
| └── S50smartdns
|
||||
├── lib
|
||||
├── sbin
|
||||
├── usr
|
||||
| └── sbin
|
||||
| └── smartdns
|
||||
....
|
||||
```
|
||||
|
||||
如要修改配置,可以ssh登录路由器,使用vi命令修改
|
||||
|
||||
```shell
|
||||
vi /opt/etc/smartdns/smartdns.conf
|
||||
```
|
||||
|
||||
也可以通过网上邻居修改,网上邻居共享目录`sda1`看不到`asusware.mipsbig`目录,但可以直接在`文件管理器`中输入`asusware.mipsbig\etc\init.d`访问
|
||||
|
||||
```shell
|
||||
\\192.168.1.1\sda1\asusware.mipsbig\etc\init.d
|
||||
```
|
||||
|
||||
## 配置参数
|
||||
|
||||
--------------
|
||||
|
||||
|参数|功能|默认值|配置值|例子|
|
||||
|--|--|--|--|--|
|
||||
@@ -313,27 +341,36 @@ vi /opt/etc/smartdns/smartdns.conf
|
||||
|server-tcp|上游TCP DNS|无|[IP][:port],可重复| server-tcp 8.8.8.8:53
|
||||
|address|指定域名IP地址|无|address /domain/ip| address /www.example.com/1.2.3.4
|
||||
|
||||
[Donate](#Donate)
|
||||
==============
|
||||
## [Donate](#Donate)
|
||||
|
||||
--------------
|
||||
|
||||
如果你觉得此项目对你有帮助,请捐助我们,以使项目能持续发展,更加完善。
|
||||
* PayPal
|
||||
|
||||
### PayPal
|
||||
|
||||
[](https://paypal.me/PengNick/)
|
||||
|
||||
* Alipay 支付宝
|
||||
### Alipay 支付宝
|
||||
|
||||

|
||||
|
||||
* Wechat 微信
|
||||
### Wechat 微信
|
||||
|
||||

|
||||
|
||||
声明
|
||||
==============
|
||||
## 声明
|
||||
|
||||
--------------
|
||||
|
||||
* `SmartDNS`著作权归属Nick Peng (pymumu at gmail.com)。
|
||||
* `SmartDNS`为免费软件,用户可以非商业性地复制和使用`SmartDNS`。
|
||||
* 禁止将 `SmartDNS` 用于商业用途。
|
||||
* 使用本软件的风险由用户自行承担,在适用法律允许的最大范围内,对因使用本产品所产生的损害及风险,包括但不限于直接或间接的个人损害、商业赢利的丧失、贸易中断、商业信息的丢失或任何其它经济损失,不承担任何责任。
|
||||
* 本软件不会未经用户同意收集任何用户信息。
|
||||
|
||||
## 说明
|
||||
|
||||
--------------
|
||||
|
||||
说明
|
||||
==============
|
||||
目前代码未开源,后续根据情况开源。
|
||||
|
||||
Reference in New Issue
Block a user