diff --git a/ReadMe.md b/ReadMe.md index 61e5a41..3f92c1f 100755 --- a/ReadMe.md +++ b/ReadMe.md @@ -5,7 +5,7 @@ SmartDNS is a local DNS server. SmartDNS accepts DNS query requests from local c Avoiding DNS pollution and improving network access speed, supports high-performance ad filtering. Unlike dnsmasq's all-servers, smartdns returns the fastest access resolution. -Support Raspberry Pi, openwrt, ASUS router and other devices. +Support Raspberry Pi, openwrt, ASUS router, Windows and other devices. ## Software Show @@ -143,6 +143,7 @@ Download the matching version of the SmartDNS installation package. The correspo ``` Please download it from the Release page: [Download here](https://github.com/pymumu/smartdns/releases) +* For the installation procedure, please refer to the following sections. ### Standard Linux system installation (Raspberry Pi, X86_64 system) @@ -370,6 +371,50 @@ Note: Merlin firmware is derived from ASUS firmware and can theoretically be use \\192.168.1.1\sda1\asusware.mipsbig\etc\init.d ``` +### optware/entware + +-------------- + +1. Prepare + + When using this software, you need to confirm whether the router supports USB disk and prepare a USB disk. + +1. Install SmartDNS + + Upload the software to `/tmp` directory of the router using winscp, and run the flollowing command to install. + + ```shell + ipkg install smartdns.xxxxxxx.mipsbig.ipk + ``` + +1. Modify the smartdns configuration + + ```shell + Vi /opt/etc/smartdns/smartdns.conf + ``` + + Note: if you need to support IPV6, you can set the worke-mode to `2`, this will disable the DNS service of dnsmasq, and smartdns run as the primary DNS server. Change `SMARTDNS_WORKMODE` in the file `/opt/etc/smartdns/smartdns-opt.conf` to 2. + + ```shell + SMARTDNS_WORKMODE="2" + ``` + +1. Restart the router to take effect + + After the router is started, use `nslookup -querytype=ptr 0.0.0.0` to query the domain name. + See if the `name` item in the command result is displayed as `smartdns` or `hostname`, such as `smartdns` + + ```shell + Pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0 + Server: 192.168.1.1 + Address: 192.168.1.1#53 + + Non-authoritative answer: + 0.0.0.0.in-addr.arpa name = smartdns. + ``` + + Note: If the service does not start automatically, you need to set optwre/entware to start automatically. For details, see the optware/entware documentation. + ### Windows 10 WSL Installation(WSL ubuntu) -------------- @@ -437,7 +482,7 @@ Note: Merlin firmware is derived from ASUS firmware and can theoretically be use |rr-ttl|Domain name TTL|Remote query result|number greater than 0|rr-ttl 600 |rr-ttl-min|Domain name Minimum TTL|Remote query result|number greater than 0|rr-ttl-min 60 |rr-ttl-max|Domain name Maximum TTL|Remote query result|number greater than 0|rr-ttl-max 600 -|log-level|log level|error|error,warn,info,debug|log-level error +|log-level|log level|error|fatal,error,warn,notice,info,debug|log-level error |log-file|log path|/var/log/smartdns.log|File Pah|log-file /var/log/smartdns.log |log-size|log size|128K|number+K,M,G|log-size 128K |log-num|archived log number|2|Integer|log-num 2 diff --git a/ReadMe_zh-CN.md b/ReadMe_zh-CN.md index 458b946..edcd797 100644 --- a/ReadMe_zh-CN.md +++ b/ReadMe_zh-CN.md @@ -5,7 +5,7 @@ SmartDNS是一个运行在本地的DNS服务器,SmartDNS接受本地客户端 同时支持指定特定域名IP地址,并高性匹配,达到过滤广告的效果。 与dnsmasq的all-servers不同,smartdns返回的是访问速度最快的解析结果。 -支持树莓派,openwrt,华硕路由器等设备。 +支持树莓派,openwrt,华硕路由器,windows等设备。 ## 软件效果展示 @@ -143,6 +143,7 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms ``` 请在Release页面下载:[此处下载](https://github.com/pymumu/smartdns/releases) +* 各种设备的安装步骤,请参考后面的章节。 ### 标准Linux系统安装(树莓派, X86_64系统) @@ -370,6 +371,50 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms \\192.168.1.1\sda1\asusware.mipsbig\etc\init.d ``` +### optware/entware + +-------------- + +1. 准备 + + 在使用此软件时,需要确认路由器是否支持U盘,并准备好U盘一个。 + +1. 安装SmartDNS + + 将软件使用winscp上传到路由器的`/tmp`目录。 + + ```shell + ipkg install smartdns.xxxxxxx.mipsbig.ipk + ``` + +1. 修改smartdns配置 + + ```shell + vi /opt/etc/smartdns/smartdns.conf + ``` + + 另外,如需支持IPV6,可设置工作模式为`2`,将dnsmasq的DNS服务禁用,smartdns为主用DNS服务器。将文件`/opt/etc/smartdns/smartdns-opt.conf`,中的`SMARTDNS_WORKMODE`修改为2. + + ```shell + SMARTDNS_WORKMODE="2" + ``` + +1. 重启路由器生效服务 + + 待路由器启动后,使用`nslookup -querytype=ptr 0.0.0.0`查询域名 + 看命令结果中的`name`项目是否显示为`smartdns`或`主机名`,如`smartdns`则表示生效 + + ```shell + pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr 0.0.0.0 + Server: 192.168.1.1 + Address: 192.168.1.1#53 + + Non-authoritative answer: + 0.0.0.0.in-addr.arpa name = smartdns. + ``` + + 注意:若服务没有自动启动,则需要设置optwre/entware自动启动,具体方法参考optware/entware的文档。 + ### Windows 10 WSL安装(WSL ubuntu) -------------- @@ -438,7 +483,7 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms |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 -|log-level|设置日志级别|error|error,warn,info,debug|log-level error +|log-level|设置日志级别|error|fatal,error,warn,notice,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 diff --git a/etc/smartdns/smartdns.conf b/etc/smartdns/smartdns.conf index 9b3e29c..038bd14 100644 --- a/etc/smartdns/smartdns.conf +++ b/etc/smartdns/smartdns.conf @@ -62,7 +62,7 @@ cache-size 512 # rr-ttl-max 86400 # set log level -# log-level: [level], level=error, warn, info, debug +# log-level: [level], level=fatal, error, warn, notice, info, debug # log-file: file path of log file. # log-size: size of each log file, support k,m,g # log-num: number of logs @@ -103,7 +103,7 @@ log-level info # specific nameserver to domain # nameserver /domain/[group|-] -# nameserver /www.example.com/office, set nameserver with nameserver name of block +# nameserver /www.example.com/office, Set the domain name to use the appropriate server group. # nameserver /www.example.com/-, ignore this domain # specific address to domain diff --git a/package/openwrt/address.conf b/package/openwrt/address.conf index 0aecc94..592b3ca 100644 --- a/package/openwrt/address.conf +++ b/package/openwrt/address.conf @@ -8,4 +8,9 @@ # specific ipset to domain # ipset /domain/[ipset|-] # ipset /www.example.com/block, set ipset with ipset name of block -# ipset /www.example.com/-, ignore this domain \ No newline at end of file +# ipset /www.example.com/-, ignore this domain + +# specific nameserver to domain +# nameserver /domain/[group|-] +# nameserver /www.example.com/office, Set the domain name to use the appropriate server group. +# nameserver /www.example.com/-, ignore this domain diff --git a/package/openwrt/custom.conf b/package/openwrt/custom.conf index 73ec4c4..3713dfa 100644 --- a/package/openwrt/custom.conf +++ b/package/openwrt/custom.conf @@ -1,7 +1,7 @@ # Add custom settings here. # set log level -# log-level [level], level=error, warn, info, debug +# log-level [level], level=fatal, error, warn, notice, info, debug # log-level error # log-size k,m,g diff --git a/src/dns_conf.c b/src/dns_conf.c index c024fe7..b5d671d 100644 --- a/src/dns_conf.c +++ b/src/dns_conf.c @@ -931,11 +931,15 @@ static int _config_log_level(void *data, int argc, char *argv[]) dns_conf_log_level = TLOG_DEBUG; } else if (strncmp("info", value, MAX_LINE_LEN) == 0) { dns_conf_log_level = TLOG_INFO; + } else if (strncmp("notice", value, MAX_LINE_LEN) == 0) { + dns_conf_log_level = TLOG_NOTICE; } else if (strncmp("warn", value, MAX_LINE_LEN) == 0) { dns_conf_log_level = TLOG_WARN; } else if (strncmp("error", value, MAX_LINE_LEN) == 0) { dns_conf_log_level = TLOG_ERROR; - } else { + } else if (strncmp("fatal", value, MAX_LINE_LEN) == 0) { + dns_conf_log_level = TLOG_FATAL; + }else { return -1; }