The configuration files are usually under /etc/netplan/

For a DHCP enabled machine, it should look like

network:
  ethernets:
    ens18:
      dhcp4: true
   version: 2

If the machine has multiple interfaces (or ‘devices’, i.e. 多个网卡)

network:
  ethernets:
    ens18:
      dhcp4: true
    ens19:
      dhcp4: true
  version: 2

The ens18 and ens19 are the names of the interface.

You can use ip addr | less to find all the interfaces.

For Static IP addresses

networks:
  ethernets:
    enp0s3:
      dhcp4: false
      addresses: [192.168.1.202/24]
      gateway4: 192.168.1.1
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4, 192.168.1.1]
  version: 2

All the addresses, gateway4 and nameservers fields must be specified.

Use restart-ubuntu-or-debian-network to restart the network service to take effect.