Update ReadMe
This commit is contained in:
135
ReadMe_zh-CN.md
135
ReadMe_zh-CN.md
@@ -43,7 +43,7 @@ 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
|
||||
@@ -70,8 +70,6 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
||||
|
||||
## 特性
|
||||
|
||||
--------------
|
||||
|
||||
1. **多DNS上游服务器**
|
||||
支持配置多个上游DNS服务器,并同时进行查询,即使其中有DNS服务器异常,也不会影响查询。
|
||||
|
||||
@@ -98,8 +96,6 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
||||
|
||||
## 架构
|
||||
|
||||
--------------
|
||||
|
||||

|
||||
|
||||
1. SmartDNS接收本地网络设备的DNS查询请求,如PC,手机的查询请求。
|
||||
@@ -109,11 +105,10 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
||||
|
||||
## 使用
|
||||
|
||||
--------------
|
||||
|
||||
### 下载配套安装包
|
||||
|
||||
--------------
|
||||
|
||||
下载配套版本的SmartDNS安装包,对应安装包配套关系如下。
|
||||
|
||||
|系统 |安装包|说明
|
||||
@@ -134,7 +129,7 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
||||
|openwrt LUCI|luci-app-smartdns.xxxxxxxxx.xxxx.all.ipk|openwrt管理统一界面
|
||||
|
||||
* openwrt系统CPU架构比较多,上述表格未列出所有支持系统,请查看CPU架构后下载。
|
||||
* merlin梅林固件理论和华硕固件一直,所以根据硬件类型安装相应的ipk包即可。(梅林暂时未验证,有问题提交issue)
|
||||
* merlin梅林固件理论和华硕固件一致,所以根据硬件类型安装相应的ipk包即可。(梅林暂时未验证,有问题提交issue)
|
||||
* CPU架构可在路由器管理界面找到,查看方法:
|
||||
登录路由器,点击`System`->`Software`,点击`Configuration` Tab页面,在opkg安装源中可找到对应软件架构,下载路径中可找到,如下,架构为ar71xx
|
||||
|
||||
@@ -159,8 +154,8 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
||||
1. 修改配置
|
||||
|
||||
安装完成后,可配置smartdns的上游服务器信息。具体配置参数参考`配置参数`说明。
|
||||
一般情况下,只需要增加`server [IP]:port`, `server-tcp [IP]:port`配置项
|
||||
尽可能配置多个上游DNS服务器,包括国内外的服务器。
|
||||
一般情况下,只需要增加`server [IP]:port`, `server-tcp [IP]:port`配置项,
|
||||
尽可能配置多个上游DNS服务器,包括国内外的服务器。配置参数请查看`配置参数`章节。
|
||||
|
||||
```shell
|
||||
vi /etc/smartdns/smartdns.conf
|
||||
@@ -180,7 +175,7 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
||||
* 修改WAN口或者DHCP DNS为树莓派IP地址。
|
||||
注意:
|
||||
I. 每款路由器配置方法不尽相同,请百度搜索相关的配置方法。
|
||||
II. 华为等路由器可能不支持配置DNS为本地IP,请修改PC端,手机端DNS服务器为树莓派IP。
|
||||
II.华为等路由器可能不支持配置DNS为本地IP,请修改PC端,手机端DNS服务器为树莓派IP。
|
||||
|
||||
1. 检测服务是否配置成功。
|
||||
|
||||
@@ -196,7 +191,7 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
|
||||
1.0.0.127.in-addr.arpa name = smartdns.
|
||||
```
|
||||
|
||||
openwrt/LEDE
|
||||
### openwrt/LEDE
|
||||
|
||||
--------------
|
||||
|
||||
@@ -211,45 +206,93 @@ openwrt/LEDE
|
||||
|
||||
1. 修改配置
|
||||
|
||||
登陆openwrt管理页面,打开Services->SmartDNS进行配置。
|
||||
* 在Upstream Servers增加上游DNS服务器配置,将以配置多个国内外DNS服务器。
|
||||
* 在Domain Address指定特定域名的IP地址,可用于广告屏蔽。
|
||||
登录openwrt管理页面,打开`Services`->`SmartDNS`进行配置。
|
||||
* 在`Upstream Servers`增加上游DNS服务器配置,建议配置多个国内外DNS服务器。
|
||||
* 在`Domain Address`指定特定域名的IP地址,可用于广告屏蔽。
|
||||
|
||||
1. 启用服务
|
||||
|
||||
SmartDNS服务生效方法有两种,`一种是直接作为主DNS服务`;`另一种是作为dnsmasq的上游`。
|
||||
默认情况下,SmartDNS采用第一种方式。如下两种方式根据需求选择即可。
|
||||
|
||||
1. 启用方法一:作为主DNS(默认方案)
|
||||
|
||||
* **启用smartdns的53端口重定向**
|
||||
|
||||
登录路由器,点击`Services`->`SmartDNS`,勾选`Redirect`选项,启用53端口转发。
|
||||
|
||||
* **检测转发服务是否配置成功**
|
||||
|
||||
使用`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.
|
||||
```
|
||||
|
||||
* **界面提示重定向失败**
|
||||
|
||||
* 检查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
|
||||
```
|
||||
* 如转发功能不正常,请使用方法二:作为DNSMASQ的上游。
|
||||
|
||||
1. 方法二:作为DNSMASQ的上游
|
||||
|
||||
* **停用smartdns的53端口重定向**
|
||||
|
||||
登录路由器,点击`Services`->`SmartDNS`,去勾选`Redirect`选项,停用53端口转发。
|
||||
|
||||
* **将dnsmasq的请求发送到smartdns**
|
||||
|
||||
登录路由器,点击`Network`->`DHCP and DNS`,修改`DNS forwardings(DNS转发)`为:
|
||||
|
||||
```shell
|
||||
/#/127.0.0.1#5353
|
||||
```
|
||||
|
||||
其中`#5353`为smartdns的服务端口号,未修改的情况下,默认为5353。
|
||||
|
||||
* **检测上游服务是否配置成功**
|
||||
|
||||
使用`nslookup`查询`www.baidu.com`域名,查看结果中百度的IP地址是否`只有一个`,如有多个IP地址返回,则表示未生效,请多尝试几个域名检查。
|
||||
|
||||
```shell
|
||||
pi@raspberrypi:~ $ nslookup www.baidu.com 192.168.1.1
|
||||
Server: 192.168.1.1
|
||||
Address: 192.168.1.1#53
|
||||
|
||||
Non-authoritative answer:
|
||||
www.baidu.com canonical name = www.a.shifen.com.
|
||||
Name: www.a.shifen.com
|
||||
Address: 14.215.177.38
|
||||
```
|
||||
|
||||
1. 启动服务
|
||||
|
||||
勾选配置页面中的`Enable(启用)`来启动SmartDNS
|
||||
|
||||
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. 注意:
|
||||
|
||||
* 如已经安装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
|
||||
```
|
||||
|
||||
华硕路由器原生固件
|
||||
### 华硕路由器原生固件/梅林固件
|
||||
|
||||
--------------
|
||||
|
||||
说明:梅林固件派生自华硕固件,理论上可以直接使用华硕配套的安装包使用。但目前未经验证,如有问题,请提交issue。
|
||||
|
||||
1. 准备
|
||||
|
||||
在使用此软件时,需要确认路由器是否支持U盘,并准备好U盘一个。
|
||||
@@ -322,8 +365,6 @@ openwrt/LEDE
|
||||
|
||||
## 配置参数
|
||||
|
||||
--------------
|
||||
|
||||
|参数|功能|默认值|配置值|例子|
|
||||
|--|--|--|--|--|
|
||||
|server-name|DNS服务器名称|操作系统主机名/smartdns|符合主机名规格的字符串|server-name smartdns
|
||||
@@ -331,20 +372,18 @@ openwrt/LEDE
|
||||
|cache-size|域名结果缓存个数|512|数字|cache-size 512
|
||||
|rr-ttl|域名结果TTL|远程查询结果|大于0的数字|rr-ttl 600
|
||||
|rr-ttl-min|允许的最小TTL值|远程查询结果|大于0的数字|rr-ttl-min 60
|
||||
|rr-ttl-max|允许的最大TTL值|远程查询结果|大于0的数组|rr-ttl-max 600
|
||||
|rr-ttl-max|允许的最大TTL值|远程查询结果|大于0的数字|rr-ttl-max 600
|
||||
|log-level|设置日志级别|error|error,warn,info,debug|log-level error
|
||||
|log-file|日志文件路径|/var/log/smartdns.log|路径|log-file /var/log/smartdns.log
|
||||
|log-size|日志大小|128K|数字+K,M,G|log-size 128K
|
||||
|log-num|日志归档个数|2|数字|log-num 2
|
||||
|conf-file|附加配置文件|无|文件路径|conf-file /etc/smartdns/smartdns.more.conf
|
||||
|server|上游UDP DNS|114.114.114.114|[ip][:port],可重复| server 8.8.8.8:53
|
||||
|server|上游UDP DNS|无|[ip][:port],可重复| server 8.8.8.8:53
|
||||
|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)
|
||||
|
||||
--------------
|
||||
|
||||
如果你觉得此项目对你有帮助,请捐助我们,以使项目能持续发展,更加完善。
|
||||
|
||||
### PayPal
|
||||
@@ -361,8 +400,6 @@ openwrt/LEDE
|
||||
|
||||
## 声明
|
||||
|
||||
--------------
|
||||
|
||||
* `SmartDNS`著作权归属Nick Peng (pymumu at gmail.com)。
|
||||
* `SmartDNS`为免费软件,用户可以非商业性地复制和使用`SmartDNS`。
|
||||
* 禁止将 `SmartDNS` 用于商业用途。
|
||||
@@ -371,6 +408,4 @@ openwrt/LEDE
|
||||
|
||||
## 说明
|
||||
|
||||
--------------
|
||||
|
||||
目前代码未开源,后续根据情况开源。
|
||||
|
||||
Reference in New Issue
Block a user