ubuntu-18.04网卡设置静态ip

切换到我们的配置文件目录/etc/netplan下

[email protected]:~# cd /etc/netplan/
[email protected]:/etc/netplan# ls
50-cloud-init.yaml

[email protected]:/etc/netplan# cat 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:
            addresses: [192.168.0.121/24]
            gateway4: 192.168.0.1
            dhcp4: no
            nameservers:
              addresses: [8.8.8.8] 
    version: 2

ubuntu-18.04网卡设置静态ip

在这里空格跟进要求很严格