=== akp55_ is now known as akp55__ [07:15] Lucas8037: Is this for `netplan apply`? Does it work after a reboot? [09:52] Hi Netplan :) I'm trying to add a second IP address to an interface [09:54] When I use ip addr add dev eth0 , it adds it in the expected order (second)... when I use a netplan drop-in, then netplan apply, it adds it first... (I think this is because the primary IP has a limited lft, while my second IP has an lft of forever). Anyway to explicitly set priority for the addresses? [10:01] Jay50: can you show your YAML config? usually the first IP of the list is set as the primary. Maybe it changes the order if you define lifetime for one of them but not the other? [10:02] in this case a workaround might be to add some additional parameters to the other one as well (e.g. a random label) [10:06] # cat /etc/netplan/50-cloud-init.yaml# This file is generated from information provided by the datasource...network: ethernets: eth0: dhcp4: true dhcp6: false match: macaddress: <....> set-name: eth0 version: 2 [10:07] ```# cat /etc/netplan/80-public.yaml network: version: 2 ethernets: eth0: addresses: - <...>/32``` [10:07] Apologies apparently I'm terrible at formatting things [10:07] thats fine [10:08] but here only one IP address is defined in 80-public.yaml, right? [10:08] 80-public.yaml (eth0) will overwrite 50-cloud-init.yaml (eth0) [10:09] so if you want to have a DHCP4 address and your manual address, you'd need to add `dhcp4: true` to 80-public.yaml as well [10:09] I thought it might too, but in fact it does not, both the DHCP and static IP are present on the interface after `netplan apply` [10:10] Only the order is unexpected [10:11] On a machine where the address in 50-cloud-init has a lifetime of forever, applying 80-public correctly appends the address to the interface [10:11] is this after a clean reboot or some intermediate state, where the DHCP address might have been there before defining the manual IP? [10:11] When the address in 50-cloud-init has a limited lifetime, the address in 80-public supersedes the address in 50-cloud-init [10:12] and you define that limited lifetime on the DHCP server? [10:13] Unfortunately not, my cloud service provider defines that [10:13] I'm currently working around it by simply using `ip addr add ...` since that maintains the correct order [10:14] Okay.. so the IP from DHCP is supposed to be the primary and your 80-public IP is supposed to be the secondary, correct? [10:15] Yes exactly [10:15] Alright, I think I know what's going on then: [10:15] Usually the first IP address assigned is set to be the primary. [10:16] So if netplan knows about a manual address, it will assign it right away, while the DHCP request/response takes some time and is thus assigned afterwards, becoming the secondary. [10:16] Makes sense [10:17] If you do it manually, you do it after DHCP is finished, thus having the expected order. [10:19] Unfortunately, I think there is now way to fix this in netplan config. But you could add your "ip addr add ..." command to the "routable.d" hook in networkd-dispatcher, to make it run after the interface is UP (i.e. configured via DHCP): https://netplan.io/faq/#use-pre-up%2C-post-up%2C-etc.-hook-scripts [10:20] Alright, thats sounds like my best option [10:20] Thanks a million for your help [10:20] yw [10:20] Have a great day [10:20] thank, same to you! === akp55__ is now known as akp55