通常,经过足够的时间,我的 Google-Fu 可以帮助我解决大多数 Linux 问题,但这个问题却让我困惑。
我最近尝试在运行 ubuntu 18.04.2 的 Plex 盒子上安装 Pihole。一切正常,但 pihole 无法可靠地阻止我想要阻止的主要内容(主要是我的 roku 上的 youtube 广告),所以我卸载了它。自从我这样做以来,我的 Plex 服务器就一直出现 DHCP 问题。
我已经找到了两种可以让事情正常运作的创可贴,但我想要一个适当的解决办法。
- 我可以编辑 resolv.conf 文件来添加我的路由器,或者将 cloudflare 添加为 DNS,这样可以解决所有问题。
- 我可以编辑 netplan .yaml 文件以强制以太网设备上的 DHCP,然后应用 netplan 配置。这也可以解决所有问题。
这两个修复程序的问题在于它们在重启后不会持续存在。我认为 Network-Manager 出了问题,但我不确定是什么问题,也不知道如何修复它。我猜这与 PiHole 没有真正的“干净”卸载选项有关。
我尝试了以下操作但没有成功:
- 拔下并重新插入所有网络硬件,并重新启动 Plex
- sudo apt-get -d --reinstall 网络管理器网络管理器-gnome
重启后 dig www.google.com 总是失败,ping -c 3 8.8.8.8 总是成功。尝试通过 8.8.8.8 访问 google 总是失败,除非应用其中一个顶级修复程序。
我不太确定需要做什么才能解决这个问题,但我感谢阅读本文的任何人的时间。我意识到我可能可以制作一些在启动时运行的程序来运行 netplan apply 命令,但我觉得有更好的解决方案。
谢谢!
编辑:在另一个与我类似的问题有所请求的输出后,我添加了这个。----------------------- sudo lshw -C network 给出:
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:01:00.0
logical name: enp1s0
version: 15
serial: 30:9c:23:d6:d4:c8
size: 1Gbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168h-2_0.0.2 02/26/15 ip=10.0.1.9 latency=0 link=yes multicast=yes port=MII speed=1Gbit/s
resources: irq:16 ioport:3000(size=256) memory:a1104000-a1104fff memory:a1100000-a1103fff
ifconfig 给出:
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.1.9 netmask 255.255.255.0 broadcast 10.0.1.255
inet6 fe80::329c:23ff:fed6:d4c8 prefixlen 64 scopeid 0x20<link>
ether 30:9c:23:d6:d4:c8 txqueuelen 1000 (Ethernet)
RX packets 29929 bytes 8095074 (8.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 46972 bytes 48312760 (48.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 27784 bytes 41332037 (41.3 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 27784 bytes 41332037 (41.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
cat /etc/netplan/*.yaml 给出:
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
ethernets:
enp1s0:
dhcp4: true
ls -al /etc/resolv.conf 给出:
lrwxrwxrwx 1 root root 29 Mar 18 23:47 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
cat /etc/resolv.conf 给出:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53
search bldint.com
options edns0
dpkg-l 命令域名系统| grep ii 给出:
ii dns-root-data 2018013001 all DNS root data including root zone and DNSSEC key
ii dnsmasq-base 2.79-1 amd64 Small caching DNS proxy and DHCP/TFTP server
ii dnsutils 1:9.11.3+dfsg-1ubuntu1.5 amd64 Clients provided with BIND
ii libdns-export1100 1:9.11.3+dfsg-1ubuntu1.5 amd64 Exported DNS Shared Library
ii libdns1100:amd64 1:9.11.3+dfsg-1ubuntu1.5 amd64 DNS Shared Library used by BIND
ii libmicrodns0:amd64 0.0.8-1 amd64 minimal mDNS resolver and announcer library (shared library)
ii libnet-dns-perl 1.10-2 all Perform DNS queries from a Perl script
ii libnss-mdns:amd64 0.10-8ubuntu1 amd64 NSS module for Multicast DNS name resolution
ii python-dnspython 1.15.0-1 all DNS toolkit for Python
dpkg-l 命令解决| grep ii 给出:
ii resolvconf 1.79ubuntu10.18.04.2 all name server information handler
resolvectl 给出:
resolvectl: command not found
更新 1:我尝试删除 lighttpd,并从 pihole 运行更新的 uninstall.sh。没有成功。此外,我修改了我的 *.yaml 文件以删除最后 3 行(ethernets、enp1s0 和 dhcp4)。修改后的 *.yaml 文件不再允许我之前的修复工作。
sudo netplan --debug apply
以下是修改后的 *.yaml 文件的输出:
** (generate:3099): DEBUG: 19:49:38.200: starting new processing pass
** (generate:3099): DEBUG: 19:49:38.200: Generating output files..
DEBUG:no netplan generated networkd configuration exists
DEBUG:no netplan generated NM configuration exists
DEBUG:Merged config:
network:
bonds: {}
bridges: {}
ethernets: {}
vlans: {}
wifis: {}
DEBUG:Skipping non-physical interface: lo
DEBUG:Skipping non-physical interface: enp1s0
DEBUG:{}
DEBUG:netplan triggering .link rules for lo
DEBUG:netplan triggering .link rules for enp1s0
以下是原始文件(我现在已恢复)的输出sudo netplan --debug apply
:
** (generate:3258): DEBUG: 19:52:42.231: starting new processing pass
** (generate:3258): DEBUG: 19:52:42.231: enp1s0: setting default backend to 2
** (generate:3258): DEBUG: 19:52:42.231: Generating output files..
** (generate:3258): DEBUG: 19:52:42.231: networkd: definition enp1s0 is not for us (backend 2)
DEBUG:no netplan generated networkd configuration exists
DEBUG:netplan generated NM configuration exists, restarting NM
DEBUG:enp1s0 not found in {}
DEBUG:Merged config:
network:
bonds: {}
bridges: {}
ethernets:
enp1s0:
dhcp4: true
vlans: {}
wifis: {}
DEBUG:Skipping non-physical interface: lo
DEBUG:device enp1s0 operstate is up, not changing
DEBUG:{}
DEBUG:netplan triggering .link rules for lo
DEBUG:netplan triggering .link rules for enp1s0
我无法通过任何常规渠道安装 resolvectl。
答案1
来自评论...
工作正在进行中...
在用户修改以及 pihole 的安装/卸载之间,网络无法完全运行。
建议用户重新安装 Ubuntu,不要进行修改,不要重新安装 pihole。