So, I am trying to set a static IP address for my Ubuntu Server 18.04.1 LTS. I took the ethernet config from this site.

  version: 2
  renderer: networkd
      dhcp4: no
      dhcp6: no
      addresses: []
          addresses: [,]

I carefully made sure there a space between each colon, didn't use tabs and made sure there's no leading spaces at the end of each line. Yet, when I run netplan --debug generate, I get:

Invalid YAML at /etc/netplan/01-network-card.yaml line 9 column 19: mapping values are not allowed in this context

Then, I compared the config with some other sample configs (1, 2, 3) and didn't notice much difference.

I also tried putting the addresses as:

addresses: [ "" ]

As seen in this config with no luck. Whatever I try, it seems that the gateway4 line is always the problem. What am I doing wrong here?

  • 1
    It's the indentation of nameservers that's the problem, I think? Commented Jan 30, 2019 at 3:06
  • Ohh, so I guess it thought nameservers was part of that same line. Yep, that was it. Thanks!
    – Kevin
    Commented Jan 30, 2019 at 3:12
  • I'm interested why you are assigning enp3s0 the same IP address as the gateway is using. Commented Jun 21, 2019 at 11:58

1 Answer 1


Add space using the spacebar, not tab in above-mentioned line.

  • This should be a comment, not an answer.
    – Dr_Bunsen
    Commented Jun 21, 2019 at 9:21
  • 2
    @Dr_Bunsen I see it as a valid (if short) answer.
    – guntbert
    Commented Jun 23, 2019 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .