Score:1

netplan apply/try/generate ends with ERROR

us flag

We have cloud infrastructure based on VMWare with Windows and Linux VMs. After last reboot 4 of the Ubuntu (3 Ubuntu 20.04 and one Ubuntu 16.04) servers did not start network interface. With lshw -class network I see correct network interface listed. There is no DHCP in the network, all servers use static IP's. After reboot in networkctl OPERATIONAL column for the specific interface is OFF. Only way to get network working is with following IP command sequence, but after reboot everything is gone:

$ip link set <link_name> up
$ip addr add <server-ip>/24 dev <link_name>
$ip route add default via <gateway> dev <link_name>

Looks like the problem is with netplan. I have netplan config, that is deployed together with server, when created from template and it works great on all the other Ubuntu servers in this infrastructure except those 4 servers. Also it worked on those servers until this weeks reboot (we update and reboot once a month usually) Config looks like this:

network:
  version: 2
  renderer: networkd
  ethernets:
    <link_name>:
      dhcp4: no
      dhcp6: no
      addresses:
        - <server_ip>/24
      gateway4: <gateway>
      nameservers:
        search:
          - <domain>
        addresses:
          - <dns_1>
          - <dns_2>

But when trying to netplan apply , netplan generate or netplan try, it returns strange ERROR, I cant find anything about in the internet.( I substituted my gateway IP with <correct_gateway> and the other IP in this operations with <some_random_ip> for security purposes)

ERROR:src/parse.c:1120:handle_gateway4: assertion failed (scalar(node) == cur_netdef->gateway4): ("<correct_gateway>" == "<some_random_ip>")
Bail out! ERROR:src/parse.c:1120:handle_gateway4: assertion failed (scalar(node) == cur_netdef->gateway4): ("<correct_gateway>" == "<some_random_ip>")

If I add some indentation mistake in *.yaml config file it returns normal Error message that points to this mistake.

I tried to reinstall netplan.io without any luck and don't have an idea what to try next.

cn flag
Hi, can you show us the format of ip you used in gw or other ? Just replaces numbers by fakes one, like 1 :) Maybe, check updates on your server, meybe there's a patched version ; your netplan file seams good. Last possibility : your file contains strange character, try deleting it and copy/paste content from a working one
cn flag
I checked mine, our dash are indented directly under the category. For addresses, the dash in under the 'a' of addresses ; but not sure it can interfer
us flag
@Martin IP is standard ipv4 : 111.111.111.111/24 for IP and 111.111.111.111 for gw.
us flag
And I don't think that dashes is an issue, as moving them don't change anything. I also rewrote the file with square brackets ([ ]) like in the netplan examples, but still the same error. Will try to copy file from working machine and check what going on..
Score:0
us flag

Well, found solution.

The problem was depreciated gateway4 tag in configuration file.

What was gateway4: <gateway> , now is:

      routes:
      - to: default
        via: <gateway>
        metric: 100
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.