ubuntu18.04 采用netplan方式,打开/etc/netplan/01-network-manager-all.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.xx/24]
gateway4: 192.168.0.1
nameservers:
addresses: [192.168.0.1, 114.114.114.114]
version: 2
然后重新启动设备即可。