Netplan Error, Unknown Key Nameservers

Netplan Error, Unknown Key Nameservers

I have an error, but not a spelling error.

Here is my netplan config:

network:
  ethernets:
    ens32:
      addresses: [172.16.120.74/16]
      nameservers:
        addresses: [127.0.0.53, 172.16.1.5]
  renderer: networkd
  version: '2'

This displays the error:

Error in network definition //etc/netplan/99.clw_netcfg.yaml line 3 column 6: unknown key nameservers

Does anyone have any ideas?

1

1 Answer

Unfortunately the netplan error messages often lead you to look at the wrong line. Lay your netplan yaml file out like this and it should all work:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens32:
      addresses:
        - 172.16.120.74/16
      nameservers:
        addresses: [127.0.0.53, 172.16.1.5]

Note that the '-' character of your IP address should be under the second d in addresses from the line above.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.