静看光阴荏苒
不管不顾不问不说也不念

AdGuard:去广告DNS服务器

和Pi-hole类似,但比Pi-hole好用太多,Pi-hole太挑环境安装很容易失败,这个AdGuard是用GO写的,安装自然会方便很多。另外GUI也比Pi-hole漂亮。

艹,有了AdGuard后Pi-hole等于一无是处。。

mkdir -p /opt/adguard && cd /opt/adguard
wget https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.94/AdGuardHome_v0.94_linux_amd64.tar.gz
tar -xzvf AdGuardHome_v0.94_linux_amd64.tar.gz
cd AdGuardHome

安装为systemd服务并自动启动:

./AdGuardHome -s install

更多管理命令:

AdGuardHome -s uninstall
AdGuardHome -s start
AdGuardHome -s stop
AdGuardHome -s restart
AdGuardHome -s status

AdGuard需要用到的端口,目前我知道的:53/853/80/443/3000,可能还有更多,如不想配防火墙规则直接把防火墙关了:

systemctl stop firewalld
systemctl disable firewalld

访问服务器公网IP+端口3000可以浏览到AdGuard的管理界面:

稍微需要注意一下的是这个监听接口,默认是监听在所有网卡上面,因为我是安装在VPS上面,所以实际上可以改为只监听在外网(eth0)之类的网卡上面,但如果你不知道这有什么用处那就默认吧:

配置好了之后就可以修改本机DNS:

nano /etc/resolv.conf

xxx换为当前服务器的公网IP:

nameserver xxx.xxx.xxx.xxx

如机器上安装了秋水的SSR,可以重启一下服务端让SSR使用此DNS服务器达到去广告的目的:

/etc/init.d/shadowsocks restart

默认只启用了一个拦截规则,这里我给出两个非常强大并且国内常用的规则:

EasyListChina

https://easylist-downloads.adblockplus.org/easylistchina.txt

EasyList

https://easylist.to/easylist/easylist.txt

添加到这里就行了:

AdGuard还有一个自定义过滤器规则的功能,类似于Pi-hole的黑白名单功能,用这个可以实现一个简单的DNS污染功能,比如我这样配置一下:

客户机上PING这个域名:

最后为了测试一下AdGuard去广告的能力,实际上也没什么好测试的,都是基于规则的。。况且我自己还添加了EasyList这种变态规则上去。。

我访问了一堆不可描述的网站,只能说那叫一个干净233

最后废话两句:

1.AdGuard安装在国内服务器,可以直接修改本地DNS使用。

2.AdGuard安装在国外服务器,就只能让服务器上的SSR等代理工具去配合使用,修改本地DNS是没有用的,原因是任何境外DNS都会被国内劫持。

赞(7)
未经允许不得转载:荒岛 » AdGuard:去广告DNS服务器
分享到: 更多 (0)

评论 38

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    谷歌云建立了服务器 到 xxx换为当前服务器的公网IP: 这边之后就GG了 再登陆这个页面上不了 小白表示想学还是很困难 :cry:

    淡淡的蛋5年前 (2019-03-29) Google Chrome 73.0.3683.86 Google Chrome 73.0.3683.86 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 登录什么页面上不了了?导致失败的可能原因:Google云后台还有一个自带的防火墙,那边要放行端口,还有可能是网卡只有内网IP。。建议换一般的VPS操作。。。

      LALA5年前 (2019-03-29) Google Chrome 72.0.3626.121 Google Chrome 72.0.3626.121 Windows 10 x64 Edition Windows 10 x64 Edition回复
  2. #2

    马克一下

    柊叶5年前 (2019-03-30) Google Chrome 73.0.3683.90 Google Chrome 73.0.3683.90 Android 7.1.1 Android 7.1.1回复
  3. #3

    ./AdGuardHome -s install后显示Segmentation fault怎么破啊

    蜗牛wo5年前 (2019-03-30) Google Chrome 73.0.3683.86 Google Chrome 73.0.3683.86 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 没遇到过,给官方提issue吧。

      LALA5年前 (2019-03-30) Google Chrome 72.0.3626.121 Google Chrome 72.0.3626.121 Windows 10 x64 Edition Windows 10 x64 Edition回复
  4. #4

    make一下!

    808hao5年前 (2019-03-31) Google Chrome 72.0.3626.121 Google Chrome 72.0.3626.121 Android 8.1.0 Android 8.1.0回复
  5. #5

    求个搭建dns可以访问google的教程。。。

    mobai5年前 (2019-03-31) Google Chrome 73.0.3683.86 Google Chrome 73.0.3683.86 Windows 10 x64 Edition Windows 10 x64 Edition回复
  6. #6

    不说了,7年阿里云学生机直接搭建一个(。ӧ◡ӧ。) :oops:

    也许吧5年前 (2019-04-01) Google Chrome 72.0.3626.105 Google Chrome 72.0.3626.105 Android 8.1.0 Android 8.1.0回复
    • 不知道阿里云这类网卡是内网IP的能不能行。。

      LALA5年前 (2019-04-01) Google Chrome 72.0.3626.121 Google Chrome 72.0.3626.121 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • https://i.loli.net/2019/04/01/5ca1e66a0f501.png
        阿里云的机器,实测效果不错

        小东5年前 (2019-04-02) Google Chrome 73.0.3683.86 Google Chrome 73.0.3683.86 Windows 10 x64 Edition Windows 10 x64 Edition回复
        • 可以的。。

          LALA5年前 (2019-04-02) Google Chrome 72.0.3626.121 Google Chrome 72.0.3626.121 Windows 10 x64 Edition Windows 10 x64 Edition回复
        • 为什么我阿里云监听的内网ip,不能用?

          hiroetsu5年前 (2019-06-26) WebView 4.0 WebView 4.0 Android 9 Android 9回复
          • 我的可以,今天才在阿里的机器上装了,找下别的原因吧。

            LALA5年前 (2019-06-26) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition
  7. #7

    :cool: 服务器要大流量吗

    无名5年前 (2019-04-03) Google Chrome 67.0.3396.87 Google Chrome 67.0.3396.87 Mac OS X  10.12.6 Mac OS X 10.12.6回复
    • 不需要。。自用几乎不费流量。。

      LALA5年前 (2019-04-03) Google Chrome 72.0.3626.121 Google Chrome 72.0.3626.121 Windows 10 x64 Edition Windows 10 x64 Edition回复
  8. #8

    在已经搭好WEB环境的机器上面能用吗?80,443端口会不会有冲突?

    ★龙行天下☆5年前 (2019-04-03) Google Chrome 72.0.3626.121 Google Chrome 72.0.3626.121 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 80/443是配置DoH时需要用到的端口,具体你可以看设置页面下的加密选项。如果只是一个最普通的DNS服务器,ADGuard只需要53/3000端口。

      LALA5年前 (2019-04-03) Google Chrome 72.0.3626.121 Google Chrome 72.0.3626.121 Windows 10 x64 Edition Windows 10 x64 Edition回复
  9. #9

    阿里云轻量监控接口是内网ip地址是怎么解决的 :cry:

    期望5年前 (2019-04-12) Google Chrome 61.0.3163.100 Google Chrome 61.0.3163.100 Windows 7 x64 Edition Windows 7 x64 Edition回复
  10. #10

    阿里云测试可用的,adguard选全部接口然后改本地dns为本机dns,其他机子改为外网ip就可以了 :cool:

    期望5年前 (2019-04-13) Google Chrome 71.0.3578.98 Google Chrome 71.0.3578.98 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 还有你提供的EasyListChina规则在添加不了 :mad:

      期望5年前 (2019-04-13) Google Chrome 71.0.3578.98 Google Chrome 71.0.3578.98 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 我添加了没问题啊,你那边有任何报错提示?

        LALA5年前 (2019-04-14) Google Chrome 72.0.3626.121 Google Chrome 72.0.3626.121 Windows 10 x64 Edition Windows 10 x64 Edition回复
        • 报错好像是400,然后我自己直接打开网站保存到我云盘把那个网站替换成我的云盘了 :oops:

          期望5年前 (2019-04-14) Google Chrome 71.0.3578.98 Google Chrome 71.0.3578.98 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 这里的“改本地dns为本机dns”,本地和本机分别指什么?

      yuuui5年前 (2019-05-23) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  11. #11

    大佬,我用腾讯云重庆的服务器搭建后,首次打开设置界面,在监听端口那个步骤没有显示公网IP,设置完拦截也没有效果

    我应该如何设置啊?看其他评论说阿里云的可以 ,那腾讯云同样有内网IP的,应该也可以啊……

    yuuui5年前 (2019-05-23) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 选监听在所有接口试试。。

      LALA5年前 (2019-05-23) Google Chrome 73.0.3683.103 Google Chrome 73.0.3683.103 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 试过,不行……没效果

        yuuui5年前 (2019-05-23) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  12. #12

    AdGuard Home现在几乎是必装的程序,不过有可能会被扫到被搭便车,还是要时常看看后台记录。另外调一下AdGuardHome.yaml中的blocked_response_ttl和ratelimit还能改善下性能,反正就是真香了 :oops:

    橘子5年前 (2019-06-05) Google Chrome 71.0.3578.124 Google Chrome 71.0.3578.124 Windows 10 x64 Edition Windows 10 x64 Edition回复
  13. #13

    爱奇艺识别到广告被拦截了,直接强行拖时间才是最骚的~~~
    2333~

    Etren5年前 (2019-06-28) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 百度做的产品说实话没几个有节操的 :eek:

      LALA5年前 (2019-06-28) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  14. #14

    问一下大佬 照教程部署完成后 访问了几个网址后 DNS 有记录 但过滤没有成功 adguardhome 是部署 vps 上的 同时部署了秋水大的 ss-libev

    cossxiu5年前 (2019-07-01) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 把ss服务端重启一下应该就好了。

      LALA5年前 (2019-07-01) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  15. #15

    阿里云安装完后给出的后台管理地址是内网IP+3000端口 :cry: ,访问不了,怎么配置用ECS的公网IP访问呢?

    Kaltsit4年前 (2019-12-26) Safari 13.0.4 Safari 13.0.4 iPhone iOS 13.3 iPhone iOS 13.3回复
    • :grin: 我选择放弃。。

      LALA4年前 (2019-12-28) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • aws win🐔安裝完也是這樣

      刁迈乎滿臉噴糞4年前 (2020-01-15) Vivaldi 2.9.1741.3 Vivaldi 2.9.1741.3 Android 10 Android 10回复
  16. #16

    “艹,有了AdGuard后Pi-hole等于一无是处。。”
    lala的脸还好嘛 :razz:

    橘子4年前 (2020-01-01) Google Chrome 75.0.3770.91 Google Chrome 75.0.3770.91 Windows 8.1 x64 Edition Windows 8.1 x64 Edition回复
    • 肿了。。

      LALA4年前 (2020-01-02) Google Chrome 74.0.3729.169 Google Chrome 74.0.3729.169 Windows 10 x64 Edition Windows 10 x64 Edition回复
  17. #17

    在阿里云等内外网分离的服务器上搭建,需要防火墙开放53UDP端口,注意是UDP不是TCP!

    Heliopause4年前 (2020-03-24) Google Chrome 80.0.3987.149 Google Chrome 80.0.3987.149 Windows 10 x64 Edition Windows 10 x64 Edition回复

分享创造快乐

广告合作资源投稿