Ubuntu2204网卡配置已经弃用gateway4,若设置gateway4作为默认路由会报如下错误。
** (process:2659): WARNING **: 07:43:39.575: `gateway4` has been deprecated, use default route
See the 'Default routes' section of the documentation for more details.
所以采用新的写法来设置默认路由。
root@k8s-1:~# cat /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
ens33:
dhcp4: false
addresses:
- 192.168.10.128/24
optional: true
routes:
- to: default
via: 192.168.10.254
nameservers:
addresses:
- 8.8.8.8
version: 2