进入/etc/netplan目录,查看配置文件
cd /etc/netplan/
修改配置文件
# This is the network config written by 'subiquity'
network:
ethernets:
ens0:
dhcp4: false
addresses: [192.168.10.123/24]
gateway4: 192.168.10.1
ens1:
dhcp4: false
addresses: [192.168.10.124/24]
gateway4: 192.168.10.1
version: 2
示例如下
生效配置
netplan apply
生效后:
标签:false,配置文件,dhcp4,IP地址,netplan,192.168,Ubuntu,20.04,addresses From: https://blog.51cto.com/u_15222272/5916677ddresses为IP地址和子网掩码,参数为数组类型,可填写多组。
dhcp4 是否自动分配IP
gateway4 网关
nameserver DNS服务IP