Ubuntu系统配置静态ip
相较于CentOS,Ubuntu系统里并没有etc/network
实际配置项在etc/netplan/50-cloud-init.yaml
具体配置内容如下:
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. 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.148.129/24]
gateway4: 192.168.148.2
nameservers:
addresses: [192.168.148.2]
version: 2
如果使用VM,需要在网络配置里选择NAT模式,同时更改网关地址

浙公网安备 33010602011771号