Psycroptic's answer sounds good for me. I'd just like to add that if your flip flop is caused by MAC addresses changes (because you are running on a paravirtualized system or whatever...), you can also force udev to comply with the PCI plug order :
get the pci path to devices :
Code:
# ls -l /sys/class/net/eth*
lrwxrwxrwx 1 root root 0 Feb 5 09:23 /sys/class/net/eth0 -> ../../devices/pci0000:00/0000:00:03.0/net/eth0
lrwxrwxrwx 1 root root 0 Feb 5 09:23 /sys/class/net/eth1 -> ../../devices/pci0000:00/0000:00:08.0/net/eth1
lrwxrwxrwx 1 root root 0 Feb 5 09:23 /sys/class/net/eth2 -> ../../devices/pci0000:00/0000:00:09.0/net/eth2
lrwxrwxrwx 1 root root 0 Feb 5 09:23 /sys/class/net/eth3 -> ../../devices/pci0000:00/0000:00:0a.0/net/eth3
In your udev rule, force the eth names like that :
Code:
SUBSYSTEM=="net", KERNELS=="0000:00:03.0", NAME="eth0"
SUBSYSTEM=="net", KERNELS=="0000:00:08.0", NAME="eth1"
SUBSYSTEM=="net", KERNELS=="0000:00:09.0", NAME="eth2"
SUBSYSTEM=="net", KERNELS=="0000:00:0a.0", NAME="eth3"
That way, your ethernet devices order won't change if MAC addresses are not fiable.
note that the "KERNELS==" acts like a filter on the path, for example KERNELS=="03.0" would also match eth0.