vlan ip not assigned on boot but with `netplan apply`

Bug #1855843 reported by Daniele
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Netplan
New
Undecided
Unassigned
Ubuntu
New
Undecided
Unassigned

Bug Description

Hi everyone.

This is my first time with netplan so this could be related to my inexperience, forgive me if is this the case.

This is the only yaml config file present:

```
$ cat /etc/netplan/10-casa.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    ens3:
      addresses: ["192.168.1.2/24"]
      gateway4: 192.168.1.1
      nameservers:
        addresses: ["1.1.1.1", "1.0.0.1"]
  vlans:
    vlan2:
      id: 2
      link: ens3
      addresses: ["192.168.2.1/24"]
      routes:
      - to: 0.0.0.0/0
        from: 192.168.2.0/24
        via: 192.168.1.1
```

# ifupdown is not installed (I installed and then removed while installing the server).

```
$ ls /etc/network/*
/etc/network/fan

/etc/network/if-down.d:
resolvconf ubuntu-fan

/etc/network/if-post-down.d:
bridge ubuntu-fan vlan

/etc/network/if-pre-up.d:
bridge ethtool mtuipv6 vlan

/etc/network/if-up.d:
000resolvconf ethtool ip mtuipv6 openssh-server ubuntu-fan vlan

# I also removed the 50_cloud_* file from here:
$ ls /etc/cloud/cloud.cfg.d
05_logging.cfg 90_dpkg.cfg README curtin-preserve-sources.cfg
```

Now the lettuce..

If I execute: `sudo netplan apply`, everything works as expected:

```
$ ip -4 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    inet 192.168.1.2/24 brd 192.168.1.255 scope global ens3
       valid_lft forever preferred_lft forever
4: vlan2@ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    inet 192.168.2.1/24 brd 192.168.2.255 scope global vlan2
       valid_lft forever preferred_lft forever
```

The problem occurs after a reboot, where the vlan2 tries to obtain an IP via DHCP and the vlan2 ip is assigned to the ens3 interface. The funny part here, is that if I manually execute `netplan apply` at this point, the right IP is assigned to the vlan2 interface, so in my case, I have "solved" this issue, putting `netplan apply` in the `/etc/rc.local` file...

```
ip -4 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    inet 192.168.1.2/24 brd 192.168.1.255 scope global ens3
    inet 192.168.2.1/24 brd 192.168.2.255 ...
       valid_lft forever preferred_lft forever
4: vlan2@ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    inet 169.254.x.y/z ...
       valid_lft forever preferred_lft forever

```

Am I missing something?
Thank you for the attention.

Daniele (brugnara)
description: updated
Daniele (brugnara)
tags: added: boot netplan ubuntu
Revision history for this message
Geert Stappers (stappers-debian) wrote :

Check if the systemd service `systemd-networkd` is enabled.

  systemctl status systemd-networkd

If output has string 'disabled' at reasonable place do

  sudo systemctl enable systemd-networkd

Thanks for the original report
Apology for the late response
Please provide feedback

Revision history for this message
Daniele (brugnara) wrote :

Thank you for the reply.

As I wrote on the original post, the IPs are configured so the daemon starts at boot time, but the IPs are wrongly assigned as I pointed out.

Since you asked, here's the wanted output:

systemctl status systemd-networkd
● systemd-networkd.service - Network Service
   Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-12-15 10:58:11 UTC; 2 weeks 2 days ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 1443 (systemd-network)
   Status: "Processing requests..."
    Tasks: 1 (limit: 956)
   CGroup: /system.slice/systemd-networkd.service
           └─1443 /lib/systemd/systemd-networkd

... omitted data ...

Thank you and happy new year.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.