Initial Commit

This commit is contained in:
Nick Peng
2023-03-10 20:46:49 +08:00
commit dcb680ae88
41 changed files with 2154 additions and 0 deletions

98
docs/install/asus.md Normal file
View File

@@ -0,0 +1,98 @@
---
hide:
- toc
---
# Asus固件 / 梅林固件安装
**说明:**
梅林固件派生自华硕固件,理论上可以直接使用华硕配套的安装包使用。但目前未经验证,如有问题,请提交 Issue。
## 准备
在使用此软件时,需要确认路由器是否支持 U 盘,并准备好 U 盘一个。
## 启用 SSH 登录
登录管理界面,点击 `系统管理` -> `系统设置`,配置 `Enable SSH``Lan Only`
SSH 登录用户名密码与管理界面相同。
## 下载 `Download Master`
在管理界面点击 `USB 相关应用` -> `Download Master` 下载。
下载完成后,启用 `Download Master`,如果不需要下载功能,此时可以卸载 `Download Master`,但要保证卸载前 `Download Master` 是启用的。
## 安装 SmartDNS
- 将软件包(使用 WinSCP 等)上传到路由器的 `/tmp/mnt/sda1` 目录(或网上邻居复制到 sda1 共享目录),执行如下命令安装
```shell
ipkg install smartdns.1.yyyy.MM.dd-REL.mipsbig.ipk
```
## 重启路由器使服务生效
- 待路由器启动后, 执行
```shell
nslookup -querytype=ptr smartdns
```
- 查看命令结果中的 `name` 是否为 `smartdns` 或你的主机名,如果是则表示生效
```shell
$ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
smartdns name = smartdns.
```
## 额外说明
上述过程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
```
- `/opt/etc/smartdns/smartdns.conf`配置包含如下基本内容:
```shell
# 指定监听的端口号
bind []:53
# 指定上游服务器
server 1.1.1.1
server-tls 8.8.8.8
# 指定域名规则
address /example.com/1.2.3.4
domain-rule /example.com/ -address 1.2.3.4
```
- 也可以通过网上邻居修改,网上邻居共享目录 `sda1` 看不到 `asusware.mipsbig` 目录,但可以直接在`文件管理器`中输入 `asusware.mipsbig\etc\init.d` 访问
```shell
\\192.168.1.1\sda1\asusware.mipsbig\etc\init.d
```

70
docs/install/entware.md Normal file
View File

@@ -0,0 +1,70 @@
---
hide:
- toc
---
# Entware安装
## 准备
在使用此软件时,需要确认路由器是否支持 U 盘,并准备好 U 盘一个。
## 安装 SmartDNS
将软件(使用 WinSCP 等)上传到路由器的 `/tmp` 目录,执行如下命令安装
```shell
ipkg install smartdns.1.yyyy.MM.dd-REL.mipsbig.ipk
```
## 修改 SmartDNS 配置
- 配置文件
```shell
vi /opt/etc/smartdns/smartdns.conf
```
- `/opt/etc/smartdns/smartdns.conf`配置包含如下基本内容:
```shell
# 指定监听的端口号
bind []:53
# 指定上游服务器
server 1.1.1.1
server-tls 8.8.8.8
# 指定域名规则
address /example.com/1.2.3.4
domain-rule /example.com/ -address 1.2.3.4
```
**注意:**
- 如需支持 IPv6可设置工作模式为 `2`,将 DNSmasq 的 DNS 服务禁用,设置 SmartDNS 为主用 DNS 服务器。将文件 `/opt/etc/smartdns/smartdns-opt.conf` 中的 `SMARTDNS_WORKMODE` 的值修改为 `2`
```shell
SMARTDNS_WORKMODE="2"
```
## 重启路由器使服务生效
- 待路由器启动后, 执行
```shell
nslookup -querytype=ptr smartdns
```
- 查看命令结果中的 `name` 是否为 `smartdns` 或你的主机名,如果是则表示生效
```shell
$ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
smartdns name = smartdns.
```
**注意:**
若服务没有自动启动,则需要设置 Optware / Entware 自动启动,具体方法请参考 Optware/Entware 的文档。

86
docs/install/linux.md Normal file
View File

@@ -0,0 +1,86 @@
---
hide:
- toc
---
# Linux安装
- 下载配套安装包,并上传到 Linux 系统中, 标准 Linux 系统X86 / X86_64请执行如下命令安装
```shell
tar zxf smartdns.1.yyyy.MM.dd-REL.x86_64-linux-all.tar.gz
cd smartdns
chmod +x ./install
./install -i
```
- 树莓派或其他 Debian 系系统ARM / ARM64请执行如下命令安装
```shell
dpkg -i smartdns.1.yyyy.MM.dd-REL.arm-debian-all.deb
```
**注意**
1. ubuntu系统下`systemd-resolved`会占用TCP53和UDP53端口, 你需要手动解决端口占用问题或者修改smartdns监听端口。
1. 日志文件在`/var/log/smartdns/smartdns.log`
## 修改配置
安装完成后,可配置 SmartDNS 的上游服务器信息,一般情况下,只需要增加 `server`[`IP`]`:port``server-tcp`[`IP`]`:port` 配置项,请尽可能配置多个上游 DNS 服务器,包括国内外的服务器。具体配置参数请参考`配置文件`说明
- 配置文件
```shell
vi /etc/smartdns/smartdns.conf
```
`/etc/smartdns/smartdns.conf`配置包含如下基本内容:
```shell
# 指定监听的端口号
bind []:53
# 指定上游服务器
server 1.1.1.1
server-tls 8.8.8.8
# 指定域名规则
address /example.com/1.2.3.4
domain-rule /example.com/ -address 1.2.3.4
```
## 启动服务
```shell
systemctl enable smartdns
systemctl start smartdns
```
## 将 DNS 请求转发到 SmartDNS 解析
修改本地路由器的 DNS 服务器,将 DNS 服务器配置为 SmartDNS。
- 登录到本地网络的路由器中,配置树莓派,分配其静态 IP 地址。
- 修改 WAN 口或者 DHCP DNS 为树莓派 IP 地址。
**注意:**
1. 每款路由器配置方法不尽相同,请在网络上搜索对应配置方法。
1. 华为等路由器可能不支持配置 DNS 为本地 IP可修改电脑端或手机端的 DNS 服务器为树莓派 IP。
## 检测服务是否配置成功
- 执行
```shell
nslookup -querytype=ptr smartdns
```
- 查看命令结果中的 `name` 是否为 `smartdns` 或你的主机名,如果是则表示生效
```shell
$ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
smartdns name = smartdns.
```

63
docs/install/openwrt.md Normal file
View File

@@ -0,0 +1,63 @@
---
hide:
- toc
---
# OpenWrt安装
将软件包(使用 WinSCP 等)上传到路由器的 `/root` 目录,执行如下命令安装
```shell
opkg install smartdns.1.yyyy.MM.dd-REL.xxxx.ipk
opkg install luci-app-smartdns.1.yyyy.MM.dd-REL.all.ipk
```
- **注意:** 19.07 之前的版本,请务必安装 `luci-app-smartdns.1.yyyy.MM.dd-REL.all-luci-compat-all.ipk`
## 修改配置
登录 OpenWrt 管理页面,打开 `Services` -> `SmartDNS` 进行配置。
-`Upstream Servers` 增加上游 DNS 服务器配置,建议配置多个国内外 DNS 服务器。
-`Domain Address` 指定特定域名的 IP 地址,可用于广告屏蔽。
## 启用服务
- 替换默认Dnsmasq为主DNS。
登录 OpenWrt 管理界面,点击 `Services` -> `SmartDNS` -> `port`,设置端口号为`53`smartdns会自动接管主DNS服务器。
- 检测转发服务是否配置成功
执行
```shell
nslookup -querytype=ptr smartdns
```
查看命令结果中的 `name` 是否为 `smartdns` 或你的主机名,如果是则表示生效
```shell
$ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
smartdns name = smartdns.
```
## 启动服务
勾选配置页面中的 `Enable启用`来启动 SmartDNS。
## **注意:**
- 如已经安装 ChinaDNS建议将 ChinaDNS 的上游配置为 SmartDNS。
- 当smartdns的端口为53时将自动接管dnsmasq为主dns。配置其他端口时会重新启用dnsmasq为主dns。
- 若在此过程中发生异常可使用如下命令还原dnsmasq为主DNS
```shell
uci delete dhcp.@dnsmasq[0].port
uci commit dhcp
/etc/init.d/dnsmasq restart
```

75
docs/install/wsl.md Normal file
View File

@@ -0,0 +1,75 @@
---
hide:
- toc
---
# 安装 WSL
安装 WSL 运行环境,发行版本选择 Ubuntu 系统为例。安装步骤请参考 [WSL 安装说明](https://docs.microsoft.com/zh-CN/windows/wsl/install)
## 安装 SmartDNS
下载适用于 WSL 的安装包,并解压到如 D 盘根目录。解压后目录如下:
```shell
D:\SMARTDNS
├─etc
│ ├─default
│ ├─init.d
│ └─smartdns
├─package
│ └─windows
├─src
└─systemd
```
双击 `D:\smartdns\package\windows` 目录下的 `install.bat` 进行安装。要求输入密码时,请输入 `WLS ubuntu` 的密码。
## 修改配置
用记事本等打开 `D:\smartdns\etc\smartdns` 目录中的 `smartdns.conf` 配置文件配置 SmartDNS。
一般情况下,只需要增加 `server [IP]:port``server-tcp [IP]:port` 配置项,
尽可能配置多个上游DNS服务器包括国内外的服务器。
具体配置请参考[配置文件说明](#配置文件说明)。
`smartdns.conf` 配置包含如下基本内容:
```shell
# 指定监听的端口号
bind []:53
# 指定上游服务器
server 1.1.1.1
server-tls 8.8.8.8
# 指定域名规则
address /example.com/1.2.3.4
domain-rule /example.com/ -address 1.2.3.4
```
## 重新加载配置
双击 `D:\smartdns\package\windows` 目录下的 `reload.bat` 进行重新加载。要求输入密码时,请输入 `WLS ubuntu` 的密码。
## 将 DNS 请求转发到 SmartDNS 解析
将 Windows 的默认 DNS 服务器修改为 `127.0.0.1`,具体步骤参考 Windows [更改 TCP/IP 设置](https://support.microsoft.com/zh-cn/help/15089/windows-change-tcp-ip-settings)。
## 检测服务是否配置成功
执行
```shell
nslookup -querytype=ptr smartdns
```
查看命令结果中的 `name` 是否为 `smartdns` 或你的主机名,如果是则表示生效
```shell
$ nslookup -querytype=ptr smartdns
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
smartdns name = smartdns.
```