第三步 简简单单的通过lxc安装个Adguardhome - cooip-jm/About-openwrt GitHub Wiki
之前已经演示过Debian,当然你也可以使用debian来完成接下来的动作
为了多角度的玩耍,这里使用Apline做演示
创建AdGuard alpine lxc
名字自己随便自定义,我这是为了演示方便。 (有人说
————能记住长名字并熟练的在键盘输入进去,可以有效防止老年痴呆,也不知道真假。。。)
lxc-create --name AdGuard --template download -- --dist alpine --release 3.19 --arch arm64 --server mirrors.bfsu.edu.cn/lxc-images
为了让这个AdGuard全局接管DNS,我们需要在配置文件中将它的IP配置为静态IP地址。
nano /var/lib/lxc/AdGuard/config
具体IP根据自己情况而定
# Distribution configuration
lxc.include = /usr/share/lxc/config/common.conf
lxc.arch = linux64
# Container specific configuration
lxc.apparmor.profile = generated
lxc.apparmor.allow_nesting = 1
lxc.rootfs.path = dir:/var/lib/lxc/AdGuard/rootfs
lxc.uts.name = AdGuard
# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = vmbr0
lxc.net.0.flags = up
进入并配置网络IP
lxc-start AdGuard
lxc-attach AdGuard
vi /etc/network/interfaces
####根据自己实际情况修改
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.6.111/24
gateway 192.168.6.11
hostname AdGuard
修改好后重启网络
/etc/init.d/networking restart
检查是否生效
ip a
使用AdGuard官方一键脚本
wget --no-verbose -O - https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v
有一些快捷的指令 觉得无聊的时候可以玩玩
sudo /opt/AdGuardHome/AdGuardHome -s start|stop|restart|status|install|uninstall
根据提示 你修改的IP:3000 初始化
输入一串不是那么容易忘记的密码
最难的部分已经结束了
随便的设置一下
https://dns.ipv6dns.com/dns-query
tls://dns.alidns.com
tls://dns.ipv6dns.com
h3://dns.alidns.com/dns-query
这里 根据你本地ping的结果 填写一下会省很多麻烦
过滤清单建议官方list 宁少勿多
全部配置好后,即可让它接管所有DNS
如果使用Debian or Ubuntu的rootfs
某些rootfs会内置systemd-resolved的配置会占用53端口,这会影响到adguard的正常运行
如果不确定53端口是否被占用可以使用
apt install lsof -y
lsof -i :53 ###查看端口占用情况
如果显示如下,需要调整一下这个业务
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
systemd-r 14542 systemd-resolve 13u IPv4 86178 0t0 UDP 127.0.0.53:domain
systemd-r 14542 systemd-resolve 14u IPv4 86179 0t0 TCP 127.0.0.53:domain
sudo mkdir -p /etc/systemd/resolved.conf.d
nano /etc/systemd/resolved.conf.d/adguardhome.conf
[Resolve]
DNS=127.0.0.1
DNSStubListener=no
然后
sudo mv /etc/resolv.conf /etc/resolv.conf.backup
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
重启这个服务
sudo systemctl reload-or-restart systemd-resolved