{"id":13467994,"url":"https://github.com/myxuchangbin/dnsmasq_sniproxy_install","last_synced_at":"2025-03-26T03:31:23.687Z","repository":{"id":39422801,"uuid":"183544916","full_name":"myxuchangbin/dnsmasq_sniproxy_install","owner":"myxuchangbin","description":"One-click Install and Configure Dnsmasq and Sniproxy for CentOS/Debian/Ubuntu","archived":false,"fork":false,"pushed_at":"2024-10-12T05:14:05.000Z","size":432,"stargazers_count":1255,"open_issues_count":40,"forks_count":553,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-10-29T21:59:15.455Z","etag":null,"topics":["dns-server","dnsmasq","netflix","shell","sniproxy"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/myxuchangbin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-26T02:46:59.000Z","updated_at":"2024-10-29T14:22:48.000Z","dependencies_parsed_at":"2023-01-31T21:15:40.040Z","dependency_job_id":"a513ef59-2ead-4897-95a5-e48998a5aed9","html_url":"https://github.com/myxuchangbin/dnsmasq_sniproxy_install","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxuchangbin%2Fdnsmasq_sniproxy_install","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxuchangbin%2Fdnsmasq_sniproxy_install/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxuchangbin%2Fdnsmasq_sniproxy_install/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myxuchangbin%2Fdnsmasq_sniproxy_install/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/myxuchangbin","download_url":"https://codeload.github.com/myxuchangbin/dnsmasq_sniproxy_install/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245584811,"owners_count":20639631,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dns-server","dnsmasq","netflix","shell","sniproxy"],"created_at":"2024-07-31T15:01:03.925Z","updated_at":"2025-03-26T03:31:23.670Z","avatar_url":"https://github.com/myxuchangbin.png","language":"Shell","funding_links":[],"categories":["Shell","Shell (473)"],"sub_categories":[],"readme":"# Dnsmasq SNIproxy One-click Install\n\n### 脚本概述：\n\n* 原理简述：利用[Dnsmasq](http://thekelleys.org.uk/dnsmasq/doc.html)的DNS功能，将特定网站的DNS解析重定向到[SNIproxy](https://github.com/dlundquist/sniproxy)反向代理。\n\n* 用途：让访问流媒体受限的VPS突破限制，前提是要有一个能流媒体的VPS。\n\n* 特性：脚本默认解锁`Netflix Hulu HBO`[等](https://github.com/myxuchangbin/dnsmasq_sniproxy_install/blob/master/proxy-domains.txt)，如需增删流媒体域名请编辑文件`/etc/dnsmasq.d/custom_netflix.conf`和`/etc/sniproxy.conf`\n\n* 脚本支持系统：CentOS7+, Debian9+, Ubuntu18+\n    * 如果脚本最后显示的IP和实际公网IP不符，请修改一下文件`/etc/sniproxy.conf`中的IP地址\n\n### 脚本用法：\n\n    bash dnsmasq_sniproxy.sh [-h] [-i] [-f] [-id] [-fd] [-is] [-fs] [-u] [-ud] [-us]\n      -h , --help                显示帮助信息\n      -i , --install             安装 Dnsmasq + SNI Proxy\n      -f , --fastinstall         快速安装 Dnsmasq + SNI Proxy\n      -id, --installdnsmasq      仅安装 Dnsmasq\n      -fd, --installdnsmasq      快速安装 Dnsmasq\n      -is, --installsniproxy     仅安装 SNI Proxy\n      -fs, --fastinstallsniproxy 快速安装 SNI Proxy\n      -u , --uninstall           卸载 Dnsmasq + SNI Proxy\n      -ud, --undnsmasq           卸载 Dnsmasq\n      -us, --unsniproxy          卸载 SNI Proxy\n\n### 快速安装（推荐）：\n``` Bash\nwget --no-check-certificate -O dnsmasq_sniproxy.sh https://raw.githubusercontent.com/myxuchangbin/dnsmasq_sniproxy_install/master/dnsmasq_sniproxy.sh \u0026\u0026 bash dnsmasq_sniproxy.sh -f\n```\n\n### 普通安装：\n``` Bash\nwget --no-check-certificate -O dnsmasq_sniproxy.sh https://raw.githubusercontent.com/myxuchangbin/dnsmasq_sniproxy_install/master/dnsmasq_sniproxy.sh \u0026\u0026 bash dnsmasq_sniproxy.sh -i\n```\n\n### 卸载方法：\n``` Bash\nwget --no-check-certificate -O dnsmasq_sniproxy.sh https://raw.githubusercontent.com/myxuchangbin/dnsmasq_sniproxy_install/master/dnsmasq_sniproxy.sh \u0026\u0026 bash dnsmasq_sniproxy.sh -u\n```\n\n### 使用方法：\n将代理主机的 DNS 地址设置为安装了 dnsmasq 的主机 IP 即可，如果遇到问题，尝试在配置文件中只保留一个 DNS 地址。\n\n为了防止滥用，建议不要公开 IP 地址，并使用防火墙进行适当的访问限制。\n\n### 调试排错：\n- 确认 sniproxy 运行状态\n\n  查看sniproxy状态：`systemctl status sniproxy`\n\n  如果 sniproxy 未运行，请检查是否有其他服务占用了 80、443 端口，导致端口冲突。可以使用 `netstat -tlunp | grep 443` 命令查看端口监听情况。\n\n- 确认防火墙设置\n\n  确保防火墙已放行 53、80、443 端口。在调试时，可以关闭防火墙： `systemctl stop firewalld.service`\n\n  对于阿里云、腾讯云、AWS 等云服务提供商，安全组的端口设置同样需要放行。\n  \n  使用其他服务器进行测试： `telnet 1.2.3.4 53` \n\n- 域名解析测试\n\n  在配置完 DNS 后，进行域名解析测试：`nslookup netflix.com` 检查 IP 是否为 Netflix 代理服务器的 IP。\n  如果系统中没有 nslookup 命令，可以在 CentOS 上安装：`yum install -y bind-utils` 在 Ubuntu 和 Debian 上安装：`apt-get -y install dnsutils`\n\n- 解决 systemd-resolve 服务占用 53 端口的问题\n  \n  使用 `netstat -tlunp | grep 53` 发现 53 端口被 systemd-resolved 占用\n  修改`/etc/systemd/resolved.conf`文件：\n  ```\n  [Resolve]\n  DNS=8.8.8.8 1.1.1.1 #取消注释，增加dns\n  #FallbackDNS=\n  #Domains=\n  #LLMNR=no\n  #MulticastDNS=no\n  #DNSSEC=no\n  #Cache=yes\n  DNSStubListener=no  #取消注释，把yes改为no\n  ```\n  然后执行以下命令，并重启 systemd-resolved 服务：\n  ```\n  ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf\n  systemctl restart systemd-resolved.service\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyxuchangbin%2Fdnsmasq_sniproxy_install","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmyxuchangbin%2Fdnsmasq_sniproxy_install","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyxuchangbin%2Fdnsmasq_sniproxy_install/lists"}