我的 Ubuntu 18.04.3 服务器有问题。服务器通过 wifi 连接到我的家庭网络并具有静态 IP 地址。它在大多数情况下都能完美运行,但我反复遇到以下情况:
- 我 ssh 进入机器,发现有许多可用的升级
- 我安装升级
- 我重启
- 我无法再通过 ssh 访问机器
- 我去机器并登录。欢迎屏幕上没有显示IP地址
- 我重新启动。一切都好起来了。
我浏览了成功和不成功引导的日志(就建立连接而言是成功的)。日志大致相似,但我发现成功的引导以:
wpa_supplicant[760]: wlp1s0: WPA: Group rekeying completed with 40:0d:10:ad:70:2f [GTK=TKIP]
不成功的引导似乎短暂地建立了连接,但随后出现:
wpa_supplicant[763]: nl80211: deinit ifname=p2p-dev-wlp1s0 disabled_11b_rates=0
systemd[1]: Stopping WPA supplicant for netplan wlp1s0...
etc...
没有明确的错误,只是有关结束连接的消息。有没有人知道为什么会发生这种情况?是否可以在重新启动后不久运行脚本以查看是否已建立连接,如果没有尝试建立连接?
编辑 20191222:
自从第一次问这个问题以来,我现在有两个在周日早上运行的 cron 作业。第一个执行更新并重新启动。第二个,一个小时后,再次重新启动。当我使用它时,这似乎使服务器有时保持在线。检查日志后,服务器在第一次重新启动后有时似乎在线,而在第二次重新启动后始终在线。
输出:cat /etc/netplan/*.yaml
50-cloud-init.yaml
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
enp3s0:
addresses: []
dhcp4: true
version: 2
wificonfig.yaml
network:
version: 2
renderer: networkd
wifis:
wlp1s0:
dhcp4: no
dhcp6: no
addresses: [192.168.0.66/24]
gateway4: 192.168.0.1
nameservers:
addresses: [192.168.0.1, 8.8.8.8]
access-points:
"99PinkGins":
password: "###############"
optional: true
ethernets:
enp3s0:
addresses: [192.168.0.66/24]
gateway4: 192.168.0.1
nameservers:
addresses: [192.168.0.1, 8.8.8.8]
optional: true
cat /etc/network/interfaces的输出
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
sudo lshw -C network的输出
*-network
description: Wireless interface
product: Wireless 8260
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:01:00.0
logical name: wlp1s0
version: 3a
serial: 00:bb:60:41:7a:8a
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=4.15.0-72-generic firmware=34.0.1 ip=192.168.0.66 latency=0 link=yes multicast=yes wireless=IEEE 802.11
resources: irq:28 memory:fbefe000-fbefffff
*-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:03:00.0
logical name: enp3s0
version: 06
serial: 1c:6f:65:28:8d:14
size: 10Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd 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=half firmware=rtl_nic/rtl8168e-1.fw latency=0 link=no multicast=yes port=MII speed=10Mbit/s
resources: irq:17 ioport:ee00(size=256) memory:fbbff000-fbbfffff memory:fbbf8000-fbbfbfff
/etc/netplan 中只有一个 .yaml 文件。它应该看起来像这样......
sudo netplan --debug generate
sudo netplan apply
reboot