1. 服务器/VPS/主机用户Telegram电报群: https://t.me/openos
    黑群晖 Synology Telegram电报群: https://t.me/nasfan
    排除公告

pfSense 安装AdGuard Home 去广告, DNS解析

本帖由 osx2021-04-12 发布。版面名称:pfSense

  1. osx

    osx 管理员 管理成员

    注册:
    2017-03-30
    帖子:
    938
    1, 先在pfSense后台关闭DNS解析和DNS转发.
    2, 启动pfSense远程ssh登录, 系统-高级选项-启动安全Shell.
    3, ssh 登录pfSense

    代码:
    cd /
    mkdir opt
    cd /opt
    fetch https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.105.2/AdGuardHome_freebsd_amd64.tar.gz
    备注:AdGuard新版本请看这里
    https://github.com/AdguardTeam/AdGuardHome/releases/


    输入ip地址加3000端口, 这样就可以登录AdGuard后台了
    比如我的这台http://192.168.11.1:3000
    注意, 这里是http

    [​IMG]
    [​IMG]
    [​IMG]

    设置AdGuard开机自启动
    编辑如下代码
    代码:
    #!/bin/sh
    /opt/AdGuardHome/./AdGuardHome
    然后再重启pfSense
     
    最后编辑: 2021-07-25
  2. osx

    osx 管理员 管理成员

    注册:
    2017-03-30
    帖子:
    938
    记得去pfSense把dns改为本机ip地址

    [​IMG]
     
  3. osx

    osx 管理员 管理成员

    注册:
    2017-03-30
    帖子:
    938
    另外, pfSense的ntopng还有Grafana插件默认端口也是3000, 如果需要安装这两个插件,可以考虑把AdGuard的网页管理端口改为其他的,如3100.
    如果之前已经安装的朋友可以编辑文件/opt/AdGuardHome/AdGuardHome.yaml
    把端口改为3100, 然后重启系统就行了

    pfSense后台也有在线编辑的工具, 诊断-编辑文件

    代码:
    bind_host: 0.0.0.0
    bind_port: 3100
    beta_bind_port: 0
    users:
    - name: admin
     
  4. osx

    osx 管理员 管理成员

    注册:
    2017-03-30
    帖子:
    938
    如果要配合OpenWRT旁路由网关使用可以按照以下方法设置.
    如pfSense (AdGuard)的IP是: 192.168.11.1
    OpenWRT的IP是: 192.168.11.2

    1, 先在OpenWRT上设置接口-LAN口那边设置DNS公共DNS, 或运营商提供的DNS.
    2, 在AdGuard设置DNS为192.168.11.2, 不要再设置其他公共DNS了.
    3, 在pfSense里面常规设置-DNS服务器地址设置为本机的192.168.11.1
     
  5. osx

    osx 管理员 管理成员

    注册:
    2017-03-30
    帖子:
    938
    几个新的版本
    AdGuard Home
    v0.106.3
    代码:
    https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.106.3/AdGuardHome_freebsd_amd64.tar.gz
    v0.107.0-b.5 (测试版)
    代码:
    https://github.com/AdguardTeam/AdGuardHome/releases/download/v0.107.0-b.5/AdGuardHome_freebsd_amd64.tar.gz
     
  6. osx

    osx 管理员 管理成员

    注册:
    2017-03-30
    帖子:
    938
    等等,教程可能有个Bug, 有可能关闭了DNS解析或者转发后无法下载AdGuard Home.
    所以需要先下载后再关闭pfSense后台的解析或者转发
     
  7. osx

    osx 管理员 管理成员

    注册:
    2017-03-30
    帖子:
    938
    还有一些关于开机自动启动的建议
    https://github.com/AdguardTeam/AdGuardHome/issues/1352

    https://forums.torguard.net/index.php?/topic/2546-pfsense-adguardhome-with-doq/


    Making AdGuard Home start on boot :
    Special thanks to eoghan2t9 for a start up script for AdGuardHome which works flawlessly.
    The script is found here : https://github.com/AdguardTeam/AdGuardHome/issues/1352
    Some modifications are required for pfSense AdGuardHome. Follow these steps below :

    C - Delete the contents of the file and fill it with these contents below :
    代码:
    #!/bin/sh
    
    . /etc/rc.subr
    
    name="adguardhome"
    rcvar="adguardhome_enable"
    adguardhome_user="root"
    adguardhome_command="/opt/AdGuardHome/AdGuardHome"
    pidfile="/var/run/${name}.pid"
    command="/usr/sbin/daemon"
    command_args="-P ${pidfile} -r -f ${adguardhome_command}"
    
    load_rc_config $name
    : ${adguardhome_enable:=yes}
    
    run_rc_command "$1"
    D- Make it executable - I run this command - it works for me:
    代码:
    # chmod 755 /usr/local/etc/rc.d/adguardhome.sh
    E - In order to have pfSense use default start up script ( /usr/local/etc/rc.d/adguardhome.sh )
    at boot time you will have to create a boot time start up script for it
    in /etc/rc.conf.d/. Not to prolong this - do the following :
    代码:
    # touch /etc/rc.conf.d/adguardhome  - create the needed new file
    # nano /etc/rc.conf.d/adguardhome   - in the new file enter the following two lines:
    添加文件
    代码:
    adguardhome_enable="YES"
    adguardhome_bootup_run="/usr/local/etc/rc.d/adguardhome.sh"
    Save and exit / then make the file executable - once again - works for me :
    代码:
    chmod 755 /etc/rc.conf.d/adguardhome
     
    最后编辑: 2022-10-15
  8. 第四维

    第四维 New Member

    注册:
    2022-01-14
    帖子:
    5
    看起来好复杂,还是得慢慢学习
     
  9. osx

    osx 管理员 管理成员

    注册:
    2017-03-30
    帖子:
    938
    pfSense出了一个Linux / Unix一键安装脚本
    代码:
    curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v