I get this error when trying to set static IP with the command sudo netplan apply: Error in network definition //etc/netplan/50-cloud.init.yaml line 5 column 34: expected scalar

Here's what my config file looks like:

network:
    ethernets:
        enp5s0:
            dhcp4: no
            addresses: [192.168.85.17/24]
            gateway4: [192.168.85.19]
            nameservers: [8.8.8.8,8.8.4.4]
            optional: true
version: 2
  • Hi, please be more precise on how you tried to do this, and perhaps don't throw some picture at us, but edit your question, to hold the information in text, both makes it easier to help you – db429 Nov 30 at 20:28

gateway4 takes an address, not a list of addresses. So the syntax should be: gateway4: xxx.xxx.xxx.xxx

  • I'm sorry, that was improper formatting/indenting on my post. The actual file is properly indented I believe. I edited my post to show what it actually looks like. – trway9 Dec 6 at 14:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.