Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

myxuchangbin/dnsmasq_sniproxy_install

Repository files navigation

Dnsmasq SNIproxy One-click Install

脚本概述:

  • 原理简述:利用Dnsmasq的DNS功能,将特定网站的DNS解析重定向到SNIproxy反向代理。

  • 用途:让访问流媒体受限的VPS突破限制,前提是要有一个能流媒体的VPS。

  • 特性:脚本默认解锁Netflix Hulu HBO,如需增删流媒体域名请编辑文件/etc/dnsmasq.d/custom_netflix.conf/etc/sniproxy.conf

  • 脚本支持系统:CentOS7+, Debian9+, Ubuntu18+

    • 如果脚本最后显示的IP和实际公网IP不符,请修改一下文件/etc/sniproxy.conf中的IP地址

脚本用法:

bash dnsmasq_sniproxy.sh [-h] [-i] [-f] [-id] [-fd] [-is] [-fs] [-u] [-ud] [-us]
 -h , --help 显示帮助信息
 -i , --install 安装 Dnsmasq + SNI Proxy
 -f , --fastinstall 快速安装 Dnsmasq + SNI Proxy
 -id, --installdnsmasq 仅安装 Dnsmasq
 -fd, --installdnsmasq 快速安装 Dnsmasq
 -is, --installsniproxy 仅安装 SNI Proxy
 -fs, --fastinstallsniproxy 快速安装 SNI Proxy
 -u , --uninstall 卸载 Dnsmasq + SNI Proxy
 -ud, --undnsmasq 卸载 Dnsmasq
 -us, --unsniproxy 卸载 SNI Proxy

快速安装(推荐):

wget --no-check-certificate -O dnsmasq_sniproxy.sh https://raw.githubusercontent.com/myxuchangbin/dnsmasq_sniproxy_install/master/dnsmasq_sniproxy.sh && bash dnsmasq_sniproxy.sh -f

普通安装:

wget --no-check-certificate -O dnsmasq_sniproxy.sh https://raw.githubusercontent.com/myxuchangbin/dnsmasq_sniproxy_install/master/dnsmasq_sniproxy.sh && bash dnsmasq_sniproxy.sh -i

卸载方法:

wget --no-check-certificate -O dnsmasq_sniproxy.sh https://raw.githubusercontent.com/myxuchangbin/dnsmasq_sniproxy_install/master/dnsmasq_sniproxy.sh && bash dnsmasq_sniproxy.sh -u

使用方法:

将代理主机的 DNS 地址设置为安装了 dnsmasq 的主机 IP 即可,如果遇到问题,尝试在配置文件中只保留一个 DNS 地址。

为了防止滥用,建议不要公开 IP 地址,并使用防火墙进行适当的访问限制。

调试排错:

  • 确认 sniproxy 运行状态

    查看sniproxy状态:systemctl status sniproxy

    如果 sniproxy 未运行,请检查是否有其他服务占用了 80、443 端口,导致端口冲突。可以使用 netstat -tlunp | grep 443 命令查看端口监听情况。

  • 确认防火墙设置

    确保防火墙已放行 53、80、443 端口。在调试时,可以关闭防火墙: systemctl stop firewalld.service

    对于阿里云、腾讯云、AWS 等云服务提供商,安全组的端口设置同样需要放行。

    使用其他服务器进行测试: telnet 1.2.3.4 53

  • 域名解析测试

    在配置完 DNS 后,进行域名解析测试:nslookup netflix.com 检查 IP 是否为 Netflix 代理服务器的 IP。 如果系统中没有 nslookup 命令,可以在 CentOS 上安装:yum install -y bind-utils 在 Ubuntu 和 Debian 上安装:apt-get -y install dnsutils

  • 解决 systemd-resolve 服务占用 53 端口的问题

    使用 netstat -tlunp | grep 53 发现 53 端口被 systemd-resolved 占用 修改/etc/systemd/resolved.conf文件:

    [Resolve]
    DNS=8.8.8.8 1.1.1.1 #取消注释,增加dns
    #FallbackDNS=
    #Domains=
    #LLMNR=no
    #MulticastDNS=no
    #DNSSEC=no
    #Cache=yes
    DNSStubListener=no #取消注释,把yes改为no
    

    然后执行以下命令,并重启 systemd-resolved 服务:

    ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
    systemctl restart systemd-resolved.service
    

About

One-click Install and Configure Dnsmasq and Sniproxy for CentOS/Debian/Ubuntu

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

Languages

AltStyle によって変換されたページ (->オリジナル) /