编辑/etc/netplan/00-installer-config.yaml文件
#ethernets下面的字段就是网卡名称
#DHCP
network:
ethernets:
eth0:
dhcp4: true
version: 2
#配置静态IP追加以下内容
network:
ethernets:
eth0:
dhcp4: false
dhcp6: false
addresses:
- 192.168.0.120/24
optional: true
routes:
- to: default
via: 192.168.0.1
nameservers:
addresses:
- 223.5.5.5
- 223.6.6.6
search:
- localhost
- local
version: 2
应用
netplan apply