Comment 0 for bug 1855843

Revision history for this message
Daniele (brugnara) wrote :

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 appy` 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.