I'd want an equivalent of the following
/etc/network/interfaces config, but done via NetworkManager (or at least giving me chance to control eth0 connections via nm-applet and possibly choose a different one):
allow-hotplug eth0 iface eth0 inet dhcp auto eth0:1 iface eth0:1 inet static address 192.168.1.2 netmask 255.255.255.0
The static address is from a different subnet than the one from DHCP.
The closest I could get with NetworkManager was to create a connection on eth0 with "Auto" type, and added an additional IPv4 address (either via nmcli or nm-connection-editor).
The problem is that until the interface gets a DHCP lease, the static address is not available. That's a big problem in my setup - there are cases where the DHCP server will never be available and I need to have at least the static address.
may-fail doesn't help, since it skips the whole IPv4 configuration if no lease is available.
I also tried to put just the subinterface
/etc/network/interfaces, but as soon as I connect and disconnect the NetworkManager-managed DHCP connection, the subinterface gets lost. So I tried creating post-up and down scripts which bring
eth0:1 up/down. But that results in weird behavior - NetworkManager then automatically creates a new connection called
eth0 with just a static address and "Manual" setting. It's not set to autoconnect, though the system connects to it as soon as it figures out that the DHCP lease won't come. And once the system is connected to this "surprise" connection, it will never try to reconnect to the one with DHCP.