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
文章评论