File: //usr/local/sbin/fixnix
#!/bin/bash
#Permanent placement @/usr/local/sbin/fixnix, and called from /etc/rc.local
mace0=$(biosdevname -d|sed -e '/./{H;$!d;}' -e 'x;/eth0/!d;'|awk '/Permanent MAC/ {print $3}')
mace1=$(biosdevname -d|sed -e '/./{H;$!d;}' -e 'x;/eth1/!d;'|awk '/Permanent MAC/ {print $3}')
h0=$(echo $((0x$(echo $mace0|tr -d ':'))))
h1=$(echo $((0x$(echo $mace1|tr -d ':'))))
goodorbad=$(expr $h0 - $h1)
if [ $goodorbad -gt 0 ]
then
ip link set eth1 down
ip link set eth0 down
ip link set eth1 name eth11 down
ip link set eth0 name eth1 up
ip link set eth11 name eth0 up
ip link set eth0 up
ip link set eth1 up
fi
ifup eth0
ifup eth1