Closed simondeziel closed 1 year ago
Is this for a container or a VM?
I just tried a similar thing here and couldn't reproduce it.
You're correct that modifying ipv4.routes.*
will a cause the NIC to be removed and then re-added, as these particular settings (currently) are not considered "live updatable" (this is because the logic is all encapsulated inside the OVN port setup function).
But on re-adding the guest should detect the new eth0 interface and bring it up, at least it does on my test.
lxc network show ovn1
config:
bridge.mtu: "1500"
ipv4.address: 10.29.208.1/24
ipv4.nat: "true"
ipv6.address: fd42:5747:891:c3b9::1/64
ipv6.nat: "true"
network: lxdbr0
volatile.network.ipv4.address: 10.21.203.11
volatile.network.ipv6.address: fd42:ffdb:caff:baf7:216:3eff:febe:538c
description: ""
name: ovn1
type: ovn
used_by: []
managed: true
status: Created
lxc launch images-us:ubuntu/jammy c1 -n ovn1
lxc ls c1
+------+---------+--------------------+----------------------------------------------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------+---------+--------------------+----------------------------------------------+-----------+-----------+
| c1 | RUNNING | 10.29.208.2 (eth0) | fd42:5747:891:c3b9:216:3eff:fe27:7aaa (eth0) | CONTAINER | 0 |
+------+---------+--------------------+----------------------------------------------+-----------+-----------+
lxc config device set c1 eth0 ipv4.routes=10.0.0.1/32
lxc ls c1
+------+---------+--------------------+----------------------------------------------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------+---------+--------------------+----------------------------------------------+-----------+-----------+
| c1 | RUNNING | 10.29.208.2 (eth0) | fd42:5747:891:c3b9:216:3eff:fe27:7aaa (eth0) | CONTAINER | 0 |
+------+---------+--------------------+----------------------------------------------+-----------+-----------+
Is this for a container or a VM?
hdc:mx2
is a Ubuntu container running off of Stéphane's cluster (the one at Hive DC).
If there is no DHCP, how is the network interface configured inside the instance?
Static IPv4 and SLAAC for IPv6:
$ lxc exec hdc:mx2 -- grep -v '#' /etc/netplan/10-lxc.yaml
network:
version: 2
ethernets:
eth0:
addresses:
- 45.45.148.177/32
routes:
- to: 0.0.0.0/0
via: 10.121.160.1
on-link: true
And if you bring the interface up manually inside the guest does it work again? And is it up on the host side?
When I do: lxc config device set hdc:mx2 eth0 ipv4.routes 172.24.0.0/16
, I do see eth0
vanishing from the container and popping back but in DOWN state. Then running lxc exec hdc:mx2 -- ip link set eth0 up
only restores the IPv6 thanks to SLAAC.
I have no visibility on the host side of things but Stéphane does.
OK I tried this with Alpine connected to a bridge
network and changed queue.tx.length
, which would similar cause the device to be removed and re-added, and it exhibited the same behaviour. I think this is probably to do more with the network managed of the device inside the instance. Apparently when using DHCP it will reactivate the interface when it has been re-added and bring it back up.
If bringing the device up manually works for SLAAC, that means the actual network connection is running, but the network config isn't being reapplied by the instance's operating system.
I just tried images:ubuntu/jammy
connected to an OVN network with this netplan config:
network:
version: 2
ethernets:
eth0:
addresses:
- 10.29.208.2/32
routes:
- to: 0.0.0.0/0
via: 10.29.208.1
on-link: true
And changing the ipv4.routes
setting still gets the IP re-applied.
After fresh boot:
networkctl status
● State: routable
Online state: online
Address: 10.29.208.2 on eth0
fd42:5747:891:c3b9:216:3eff:fe4f:71b8 on eth0
fe80::216:3eff:fe4f:71b8 on eth0
Gateway: 10.29.208.1 on eth0
fe80::216:3eff:febe:538c on eth0
Jan 30 15:18:30 c1 systemd[1]: Starting Network Configuration...
Jan 30 15:18:30 c1 systemd-networkd[84]: Failed to increase receive buffer size for general netlink sock>
Jan 30 15:18:30 c1 systemd-networkd[84]: Failed to increase buffer size for device monitor, ignoring: Op>
Jan 30 15:18:30 c1 systemd-networkd[84]: eth0: Link UP
Jan 30 15:18:30 c1 systemd-networkd[84]: eth0: Gained carrier
Jan 30 15:18:30 c1 systemd-networkd[84]: lo: Link UP
Jan 30 15:18:30 c1 systemd-networkd[84]: lo: Gained carrier
Jan 30 15:18:30 c1 systemd-networkd[84]: Enumeration completed
Jan 30 15:18:30 c1 systemd[1]: Started Network Configuration.
Jan 30 15:18:32 c1 systemd-networkd[84]: eth0: Gained IPv6LL
Then:
lxc config device set c1 eth0 ipv4.routes=10.0.0.1/32
After
lxc shell c1
root@c1:~# networkctl status
● State: routable
Online state: online
Address: 10.29.208.2 on eth0
fd42:5747:891:c3b9:216:3eff:fe4f:71b8 on eth0
fe80::216:3eff:fe4f:71b8 on eth0
Gateway: 10.29.208.1 on eth0
fe80::216:3eff:febe:538c on eth0
Jan 30 15:18:30 c1 systemd-networkd[84]: Enumeration completed
Jan 30 15:18:30 c1 systemd[1]: Started Network Configuration.
Jan 30 15:18:32 c1 systemd-networkd[84]: eth0: Gained IPv6LL
Jan 30 15:19:05 c1 systemd-networkd[84]: eth0: Link DOWN
Jan 30 15:19:05 c1 systemd-networkd[84]: eth0: Lost carrier
Jan 30 15:19:05 c1 systemd-networkd[84]: eth0: DHCPv6 lease lost
Jan 30 15:19:05 c1 systemd-networkd[84]: veth6ba4063e: Interface name change detected, renamed to eth0.
Jan 30 15:19:05 c1 systemd-networkd[84]: eth0: Link UP
Jan 30 15:19:05 c1 systemd-networkd[84]: eth0: Gained carrier
Jan 30 15:19:07 c1 systemd-networkd[84]: eth0: Gained IPv6LL
So I cannot reproduce the issue with netplan.
I always remove the networkd-dispatcher
package, maybe it does something?
Here is the journalctl
output I got after a fresh reboot:
root@mx2:~# journalctl -fu systemd-networkd
Jan 30 15:24:46 mx2 systemd-networkd[67]: lo: Gained carrier
Jan 30 15:24:46 mx2 systemd-networkd[67]: Enumeration completed
Jan 30 15:24:46 mx2 systemd[1]: Started Network Configuration.
Jan 30 15:24:46 mx2 systemd-networkd[67]: eth0: Gained IPv6LL
Jan 30 15:24:48 mx2 systemd-networkd[67]: wg-home: Link UP
Jan 30 15:24:48 mx2 systemd-networkd[67]: wg-home: Gained carrier
# $ lxc config device unset hdc:mx2 eth0 ipv4.routes
Jan 30 15:26:22 mx2 systemd-networkd[67]: eth0: Link DOWN
Jan 30 15:26:22 mx2 systemd-networkd[67]: eth0: Lost carrier
Jan 30 15:26:22 mx2 systemd-networkd[67]: eth0: DHCPv6 lease lost
Jan 30 15:26:24 mx2 systemd-networkd[67]: veth87dd6c1c: Interface name change detected, renamed to eth0.
# $ lxc exec hdc:mx2 -- ip link set eth0 up
Jan 30 15:27:41 mx2 systemd-networkd[67]: eth0: Link UP
Jan 30 15:27:41 mx2 systemd-networkd[67]: eth0: Gained carrier
Jan 30 15:27:42 mx2 systemd-networkd[67]: eth0: Gained IPv6LL
Then I only have the IPv6:
root@mx2:~# ip a show dev eth0
80: eth0@if81: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:16:3e:17:18:07 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 2602:fc62:ff:1000:5e08:c4c:6809:30a/64 scope global temporary dynamic
valid_lft 604628sec preferred_lft 85978sec
inet6 2602:fc62:ff:1000:216:3eff:fe17:1807/64 scope global dynamic mngtmpaddr
valid_lft forever preferred_lft forever
inet6 fe80::216:3eff:fe17:1807/64 scope link
valid_lft forever preferred_lft forever
Also, running netplan apply
fixes it for me, of course.
Can you test it with a vanilla container without modification, to check if its something that has been added/removed/changed in your case?
Just created c1
(fresh images:ubuntu/jammy
container) and isolated the problem to be disabling systemd-udevd
in the container:
root@c1:~# systemctl mask --now systemd-udevd.service
Created symlink /etc/systemd/system/systemd-udevd.service → /dev/null.
Since the NIC is yanked out and plugged back in, it sounds legitimate to need udevd
to react to the change. I don't understand why the NIC shows as DOWN once plugged back in though. Probably not LXD's fault but my own so closing.
Thanks Tom and sorry for the noise.
Ah glad u found the issue.
Required information
Issue description
On an instance hooked to an OVN network, changing a config key on the NIC causes the NIC to fall 'DOWN':
Steps to reproduce
Note:
unset
'ing the config key doesn't bring the NIC back 'UP'.Additional information:
Instance config:
Network definition:
Profile: