I'm looking to configure an Ethernet interface so that it has its main interface set to DHCP (or statically), but then also build a sub-interface whenever the machine boots or Ethernet is connected. My /etc/network/interfaces configuration is below and the desired behavior occurs on boot, but if the Ethernet cable is disconnected and reconnected, I only get the DHCP address.
It seems like allow-hotplug would be a fix for this, but that doesn't work either. Any idea how to get this to work the way I want? It would really be nice to have a handful of sub-interfaces automatically come up for my test environments.
Thanks!
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto enp3s0
iface eth0 inet dhcp
auto enp3s0:1
iface enp3s0:1 inet static
address 172.16.1.50
netmask 255.255.255.0
gateway 172.16.1.1
enp3s0:1
is just the old way of assigning multiple IP addresses to an interface. Please edit your question and describe in more detail what you want to use the "subinterfaces" for. Possibly you want a network namespace and amacvlan
for those. – dirkt Jul 19 '21 at 20:21/etc/network/interfaces
e.g. as in this answer, just repeat the stanza. – dirkt Jul 22 '21 at 07:29