Ubuntu 18.04修改IP地址

注:配置/etc/network/interfaces已无用

root@ubuntu:~# vim /etc/netplan/50-cloud-init.yaml

network:
    ethernets:
        eth0:
            addresses:
            - 192.168.15.72/20
            gateway4: 192.168.12.2
            nameservers:
                addresses:
                - 223.5.5.5
                search: []
            optional: true
    version: 2

执行命令 使配置生效

root@ubuntu:~# netplan apply


你可能感兴趣的:(Ubuntu)