ubuntu配置静态IP

1、打开/etc/netplan/50-cloud-init.yaml

vi /etc/netplan/50-cloud-init.yaml

2、配置yaml文件

network:
    version: 2
    renderer: networkd
    ethernets:
        ens33:
          addresses:
            - 192.168.118.128/24
          gateway4: 192.168.118.2
          nameservers:
            addresses: [8.8.8.8, 1.1.1.1]

3、重启网络

sudo netplan apply

 

你可能感兴趣的:(ubuntu配置静态IP)