1.打开并编辑如下文件

sudo vi /etc/netplan/01-network-manager-all.yaml

2.输入(修改)以下内容

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens0:
      dhcp4: false
      addresses: [192.168.1.123/24]
      gateway4: 192.168.1.1
    ens1:
      dhcp4: false
      addresses: [192.168.1.124/24]
      gateway4: 192.168.1.1
  version: 2