# SmartDNS_China_List_Installer **Repository Path**: callmer/smartdns_china_list_installer ## Basic Information - **Project Name**: SmartDNS_China_List_Installer - **Description**: 生成 SmartDNS China List 专属配置,加速国内域名解析,优化网络体验。 - **Primary Language**: Shell - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 6 - **Forks**: 16 - **Created**: 2023-12-10 - **Last Updated**: 2025-08-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: smartdns, Linux ## README # SmartDNS China List 安装脚本 ## 介绍 用于优化您最喜爱的 DNS 服务器的中国特定 SmartDNS 配置。 - [SmartDNS](https://github.com/pymumu/smartdns) 适用版本:Release 43 及以上 - 提升解析中国域名的速度 - 尽可能获取距离您最近的最佳 CDN 节点,但不会影响海外 CDN 结果 - 阻止 ISP 在 NXDOMAIN 结果中显示广告 ### 细节说明 本项目仅使用 `sh` 脚本生成 SmartDNS 配置文件,并对部分配置文件逻辑进行了修改。 不再生成测速相关的 `domain-rules` 配置,避免干扰 SmartDNS 现有测速模式。 DNS 服务器组配置文件为 `dns-group.china.smartdns.conf` : ```conf ## 本项目 DNS 服务器组规则 server 223.5.5.5 -group flash -exclude-default-group server 180.184.1.1 -group flash -exclude-default-group server 119.29.29.29 -group flash -exclude-default-group server 114.114.114.114 -group flash -exclude-default-group server 2402:4e00:: -group flash -exclude-default-group server 2400:3200::1 -group flash -exclude-default-group ``` 由于添加了 `-exclude-default-group` 参数,只有规则内域名会使用该 DNS 服务器组。 本项目使用 DNS 服务器组 `flash` 替换了单个上游 DNS 服务器: ```conf ## 上游项目 nameserver 规则 nameserver /abc.com/114.114.114.114 nameserver /xyz.net/114.114.114.114 ## 本项目 nameserver 规则 nameserver /abc.com/flash nameserver /xyz.net/flash ``` 此时,SmartDNS 在请求规则内域名时,将向指定的上游 DNS 服务器组发送请求。 - 上游 DNS 服务器: - IPv4 DNS:`223.5.5.5 180.184.1.1 119.29.29.29 114.114.114.114` - IPv6 DNS:`2402:4e00:: 2400:3200::1` - 配置文件路径: - `/etc/smartdns.d` - 配置文件名: - `dns-group.china.smartdns.conf` - `apple.china.smartdns.conf` - `google.china.smartdns.conf` - `accelerated-domains.china.smartdns.conf` - `bogus-nxdomain.china.smartdns.conf` ### 使用方法 1. 下载本安装脚本,并赋予可执行权限 ```bash ## 下载安装脚本 $ sudo curl -LR -o /usr/local/bin/smartdns-plugin.sh https://gitee.com/callmer/smartdns_china_list_installer/raw/main/smartdns_plugin.sh ## 设置安装脚本权限 $ sudo chmod +x /usr/local/bin/smartdns-plugin.sh ``` 2. 编辑所需的上游 DNS 服务器列表(可选) 3. 使用 `root` 权限运行脚本: ```bash ## 执行安装脚本 $ sudo /usr/local/bin/smartdns-plugin.sh ``` 4. 定期执行脚本(可选) ```bash ## 编辑系统定时任务 $ sudo crontab -e ## 定时任务配置项 20 5 * * * /usr/local/bin/smartdns-plugin.sh ``` ### 特别鸣谢 没有这些项目,就不会有本项目 :) - Github: [dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list) - Github: [smartdns](https://github.com/pymumu/smartdns) ### License ```txt Copyright © 2024 狐狸Nomad This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the LICENSE file for more details. ```