我的服务器网络不工作,非常感谢帮助
default via 192.168.50.1 dev eno1 proto static
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
192.168.50.0/24 dev eno1 proto kernel scope link src 192.168.50.88
我可以 ping 我的路由器 192.168.50.1,它确实回答了
我尝试了许多不同的 netplan 和 resolve.conf 配置,但都没有成功。
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:14:b1:38:2d txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.50.88 netmask 255.255.255.0 broadcast 192.168.50.255
inet6 fe80::86a9:3eff:fe11:7ef6 prefixlen 64 scopeid 0x20<link>
ether 84:a9:3e:11:7e:f6 txqueuelen 1000 (Ethernet)
RX packets 4563 bytes 667639 (667.6 KB)
RX errors 0 dropped 14 overruns 0 frame 0
TX packets 5702 bytes 6573527 (6.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xb1200000-b1220000
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 15062 bytes 2578348 (2.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15062 bytes 2578348 (2.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
更新:看来 netplan 是问题所在,我能够在没有 netplan 静态配置的情况下恢复连接。但我仍然无法让静态配置正常工作...
Netplan 文件:00-installer-config.yaml
network:
version: 2
renderer: networkd
ethernets:
eno1:
addresses:
- 192.168.50.88/24
nameservers:
addresses: [1.1.1.1,8.8.8.8]
routes:
- to: default
via: 192.168.50.1
ls -l /etc/resolv.conf
-rw-r--r-- 1 root root 19 Feb 16 16:13 /etc/resolv.conf
ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
^C
--- 8.8.8.8 ping statistics ---
14 packets transmitted, 0 received, 100% packet loss, time 13311ms
resolvectl status
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: foreign
DNS Servers: 8.8.8.8
Fallback DNS Servers: 8.8.4.4
Link 2 (eno1)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
DNS Servers: 1.1.1.1 8.8.8.8
Link 3 (wlp2s0)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Link 4 (docker0)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
more /etc/resolv.conf
# This is /run/systemd/resolve/resolv.conf managed by man:systemd-resolved(8).
nameserver 8.8.8.8
search .
uname -a
Linux server 5.15.0-94-generic #104-Ubuntu SMP Tue Jan 9 15:25:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
dig google.com
;; communications error to 8.8.8.8#53: timed out
;; communications error to 8.8.8.8#53: timed out