dnsmasq dns上游列表替换工具
| test-conf | ||
| dnsmasq-upstream-auto-replace.sh | ||
| LICENSE | ||
| makefile | ||
| README.md | ||
dnsmasq-upstream-auto-replace
dnsmasq dns上游列表替换工具
Documentation
Usage: ./dnsmasq-upstream-auto-replace.sh [OPTIONS]
Options:
--conf, -c <file> Specify the path to the dnsmasq configuration file (default: /etc/dnsmasq.conf)
--debug, -d <level> Set the debug level (options: info, success, warn, error)
--map, -m <map> Set the replace map (example: 1.1.1.1-2.2.2.2,2.2.2.2-3.3.3.3)
--list, -l List all files in the conf dir
--help, -h Show this help message and exit
Debug Levels:
info: Information messages
success: Successful operations
warn: Warning messages
error: Error messages
Description:
This script checks the dnsmasq configuration file for a specific setting and replace upstream dns.
Use case
列出 conf-dir 键所指向目录中的文件
命令:
./dnsmasq-upstream-auto-replace.sh -l
返回:
[Success] Target folder has been found.
[info] All files in the conf dir:
[file] /etc/dnsmasq.d/accelerated-domains.china.114.114.114.114.conf
[file] /etc/dnsmasq.d/accelerated-domains.china.114.114.115.115.conf
[file] /etc/dnsmasq.d/accelerated-domains.china.119.29.29.29.conf
[file] /etc/dnsmasq.d/accelerated-domains.china.223.5.5.5.conf
[file] /etc/dnsmasq.d/apple.china.114.114.114.114.conf
[file] /etc/dnsmasq.d/apple.china.114.114.115.115.conf
[file] /etc/dnsmasq.d/apple.china.119.29.29.29.conf
[file] /etc/dnsmasq.d/apple.china.223.5.5.5.conf
[file] /etc/dnsmasq.d/bogus-nxdomain.china.conf
[file] /etc/dnsmasq.d/google.china.114.114.114.114.conf
[file] /etc/dnsmasq.d/google.china.114.114.115.115.conf
[file] /etc/dnsmasq.d/google.china.119.29.29.29.conf
[file] /etc/dnsmasq.d/google.china.223.5.5.5.conf
替换上游 dns
命令:
./dnsmasq-upstream-auto-replace.sh -c /etc/dnsmasq.conf -m 114.114.114.114-221.6.4.66,119.29.29.29-221.6.4.66,223.5.5.5-221.6.4.66,114.114.115.115-221.6.4.66
tips:
-c 并不必要,多数发行版中,dnsmasq配置文件的位置是 /etc/dnsmasq.conf,本脚本已经将此作为默认值。
返回:
[Success] Target folder has been found.
[replace rule] 114.114.114.114 -> 221.6.4.66
[replaced] /etc/dnsmasq.d/accelerated-domains.china.114.114.114.114.conf
[replaced] /etc/dnsmasq.d/accelerated-domains.china.114.114.115.115.conf
[replaced] /etc/dnsmasq.d/accelerated-domains.china.119.29.29.29.conf
[replaced] /etc/dnsmasq.d/accelerated-domains.china.223.5.5.5.conf
[replaced] /etc/dnsmasq.d/apple.china.114.114.114.114.conf
[replaced] /etc/dnsmasq.d/apple.china.114.114.115.115.conf
[replaced] /etc/dnsmasq.d/apple.china.119.29.29.29.conf
[replaced] /etc/dnsmasq.d/apple.china.223.5.5.5.conf
[replaced] /etc/dnsmasq.d/bogus-nxdomain.china.conf
[replaced] /etc/dnsmasq.d/google.china.114.114.114.114.conf
[replaced] /etc/dnsmasq.d/google.china.114.114.115.115.conf
[replaced] /etc/dnsmasq.d/google.china.119.29.29.29.conf
[replaced] /etc/dnsmasq.d/google.china.223.5.5.5.conf
[replace rule] 119.29.29.29 -> 221.6.4.66
[replaced] /etc/dnsmasq.d/accelerated-domains.china.114.114.114.114.conf
[replaced] /etc/dnsmasq.d/accelerated-domains.china.114.114.115.115.conf
[replaced] /etc/dnsmasq.d/accelerated-domains.china.119.29.29.29.conf
[replaced] /etc/dnsmasq.d/accelerated-domains.china.223.5.5.5.conf
[replaced] /etc/dnsmasq.d/apple.china.114.114.114.114.conf
[replaced] /etc/dnsmasq.d/apple.china.114.114.115.115.conf
[replaced] /etc/dnsmasq.d/apple.china.119.29.29.29.conf
[replaced] /etc/dnsmasq.d/apple.china.223.5.5.5.conf
[replaced] /etc/dnsmasq.d/bogus-nxdomain.china.conf
[replaced] /etc/dnsmasq.d/google.china.114.114.114.114.conf
[replaced] /etc/dnsmasq.d/google.china.114.114.115.115.conf
[replaced] /etc/dnsmasq.d/google.china.119.29.29.29.conf
[replaced] /etc/dnsmasq.d/google.china.223.5.5.5.conf
[replace rule] 223.5.5.5 -> 221.6.4.66
[replaced] /etc/dnsmasq.d/accelerated-domains.china.114.114.114.114.conf
[replaced] /etc/dnsmasq.d/accelerated-domains.china.114.114.115.115.conf
[replaced] /etc/dnsmasq.d/accelerated-domains.china.119.29.29.29.conf
[replaced] /etc/dnsmasq.d/accelerated-domains.china.223.5.5.5.conf
[replaced] /etc/dnsmasq.d/apple.china.114.114.114.114.conf
[replaced] /etc/dnsmasq.d/apple.china.114.114.115.115.conf
[replaced] /etc/dnsmasq.d/apple.china.119.29.29.29.conf
[replaced] /etc/dnsmasq.d/apple.china.223.5.5.5.conf
[replaced] /etc/dnsmasq.d/bogus-nxdomain.china.conf
[replaced] /etc/dnsmasq.d/google.china.114.114.114.114.conf
[replaced] /etc/dnsmasq.d/google.china.114.114.115.115.conf
[replaced] /etc/dnsmasq.d/google.china.119.29.29.29.conf
[replaced] /etc/dnsmasq.d/google.china.223.5.5.5.conf
[replace rule] 114.114.115.115 -> 221.6.4.66
[replaced] /etc/dnsmasq.d/accelerated-domains.china.114.114.114.114.conf
[replaced] /etc/dnsmasq.d/accelerated-domains.china.114.114.115.115.conf
[replaced] /etc/dnsmasq.d/accelerated-domains.china.119.29.29.29.conf
[replaced] /etc/dnsmasq.d/accelerated-domains.china.223.5.5.5.conf
[replaced] /etc/dnsmasq.d/apple.china.114.114.114.114.conf
[replaced] /etc/dnsmasq.d/apple.china.114.114.115.115.conf
[replaced] /etc/dnsmasq.d/apple.china.119.29.29.29.conf
[replaced] /etc/dnsmasq.d/apple.china.223.5.5.5.conf
[replaced] /etc/dnsmasq.d/bogus-nxdomain.china.conf
[replaced] /etc/dnsmasq.d/google.china.114.114.114.114.conf
[replaced] /etc/dnsmasq.d/google.china.114.114.115.115.conf
[replaced] /etc/dnsmasq.d/google.china.119.29.29.29.conf
[replaced] /etc/dnsmasq.d/google.china.223.5.5.5.conf
[Success] Applied all replace rules
替换上游 dns | 修改提示等级
命令:
./dnsmasq-upstream-auto-replace.sh -d success -c /etc/dnsmasq.conf -m 114.114.114.114-221.6.4.66,119.29.29.29-221.6.4.66,223.5.5.5-221.6.4.66,114.114.115.115-221.6.4.66
返回:
[Success] Target folder has been found.
[Success] Applied all replace rules