netplan

ubuntu 2004 netplan error:Error in network definition: unknown key 'nameservers'


ubuntu 2004 I assign network with netplan,then error comes:

/etc/netplan/00-installer-config.yaml:8:3: Error in network definition: unknown key 'nameservers'
  nameservers:

the 00-installer-config.yaml file below:

# This is the network config written by 'subiquity'
network:
  ethernets:
    ens32:
            addresses: [10.9.86.40/24]
            gateway4: 10.9.86.254
  version: 2
  nameservers:
        addresses: [192.168.2.1, 8.8.8.8]

Solution

  • don't use your tab key, only use space