#!/usr/bin/env bash
nc=eth0
maca='00:00:00:00:00:11'
macb='00:00:00:AA:AA:AA'
macc='00:00:00:BB:BB:BB'
current_mac=`ifconfig ${nc} | awk '/ether /{print $2}'`
ifconfig $nc down
if [ $current_mac = $maca ];then
ifconfig $nc hw ether $macb
else
ifconfig $nc hw ether $macc
fi
ifconfig $nc up
注意一下nc是网卡