What are you trying to achieve? Because it appears that the eth0:N "virtual interfaces", as you call them, don't really exist
, except for being an alias to eth0. So, they can't have disappeared, because they were never there. It is possible that you have some software running that deconfigures eth0 when the cable is pulled out, and reconfigures it when it's plugged back in. If you have done your custom configuration outside of this software, it may be lost when the software deconfigures eth0.
If you need to assign multiple addresses to eth0, do so. There is no need for eth0:N. (these are low-level commands; you may want to use your network config system instead to make the configuration persistent)
ip addr add dev eth0 192.168.6.1/24
ip addr add dev eth0 192.168.7.1/24
However be aware that ifconfig
will not show all IP addresses; use ip addr
to view all assigned addresses.
On the other hand, if you want VLANs, then you should be using the vconfig
command and the eth0.N interfaces (dot, not colon). For example, to create eth0.5 for VLAN 5, use:
This will create eth0.5, which is an interface you can configure separately. Also, it does not disappear
when you plug the network cable out (at least the kernel doesn't delete it; your network config system may).
If still think you have to handle the network cable being pulled in or out, you can program it in my NCD network configuration software