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

 

posted @ 2019-10-02 18:54  gentlemanwuyu  阅读(179)  评论(0编辑  收藏  举报