在 /etc/netplan/50-cloud-init.yaml
下配置静态网络:
network:
ethernets:
eth0:
dhcp4: false
addresses: [192.168.1.11/24]
optional: true
gateway4: 192.168.1.1
nameservers:
addresses: [192.168.1.1]
version: 2
配置完成后应用网络配置的时候出现以下报错:
root@k8s-master-01:~# netplan apply
** (generate:234574): WARNING **: 14:21:04.809: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.
** (process:234572): WARNING **: 14:21:06.172: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.
root@k8s-master-01:~#
报错的意思是说,gateway4
已被弃用,请改用默认路由。默认路由就是通过 routes
配置 IP
。
修改网络配置如下:文章来源:https://www.toymoban.com/news/detail-676786.html
network:
ethernets:
eth0:
dhcp4: false
addresses: [192.168.1.11/24]
optional: true
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses: [192.168.1.1]
version: 2
应用网络配置:文章来源地址https://www.toymoban.com/news/detail-676786.html
netplan apply
到了这里,关于Ubuntu 报错 WARNING:gateway4 has been deprecated, use default routes instead... 解决方案的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!