Ubuntu 18 网络配置

2021年3月1日 34点热度 0人点赞 0条评论

Ubuntu 18 网络配置

配置文件 /etc/netplan/50-cloud-init.yaml

50-cloud-init.yaml这个配置文件可能名称有所不同。

默认配置

arben@ubuntu:~$ cat /etc/netplan/50-cloud-init.yaml.bak 
# 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:
ens33:
dhcp4: true
version: 2

修改配置

arben@ubuntu:~$ cat /etc/netplan/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:
ens33:
dhcp4: false
addresses: [10.55.55.22/24]
gateway4: 10.55.55.16
nameservers:
addresses: [10.55.55.16]
version: 2

使配置生效

arben@ubuntu:~$ sudo netplan apply

 

arben

这个人很懒,什么都没留下

文章评论