系统:Ubuntu Server 22.04
NetworkManager版本:netplan.io/jammy-updates 0.104-0ubuntu2.1 amd64 [upgradable from: 0.104-0ubuntu2]
场景:
当初KVM开了一个主机,用qemu做远程链接,用这个“neplan apply”设置了ip之后一段时间内没有问题。
过几天出现了一个问题,它可以连外网,外网不能连它,整整搞了一天都没解决。
后来想起用“neplan apply”的时候报了个错,如下:
错误:
** (generate:27119): WARNING **: 05:02:00.924: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.
** (process:27117): WARNING **: 05:02:03.027: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.
这是我的配置文件:
# /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
ens32:
dhcp4: false
addresses: [192.168.3.101/24]
optional: true
gateway4: 192.168.3.1
nameservers:
addresses: [192.168.3.1, 114.114.114.114]
version: 2
没错,就是那个“gateway4”过期了,当前版本的NetworkManager放弃了这个属性!!
解决方案:
# /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
ens32:
dhcp4: false
addresses: [192.168.3.101/24]
optional: true
routes:
# debian下的0.101-4版本default无法识别,必须使用“0.0.0.0/0”或者上面addresses的地址
- to: default
via: 192.168.3.1
nameservers:
addresses: [192.168.3.1, 114.114.114.114]
version: 2
配置详细信息:
可能出现的其他问题:
Conmi的正确答案——NetworkManager配置网络后报错“Netplan configuration should NOT be accessible by others.”
Conmi的正确答案——NetworkManager配置网络后报错“Cannot call openvswitch: ovsdb-server.service is not running.”