Ubuntu修改mac地址

 
每次启动都需要修改的方法:
切换到超级用户,执行
ifconfig eth0 down //关闭eth0的网卡,具体是eth0还是eth1还是eth2,用ifconfig查看,你要用哪个网卡就确定eth?
ifconfig eth0 hw ether 你要修改的MAC地址(需要加“:”) //修改相应网卡的MAC地址
ifconfig eth0 up
 
永久修改:
超级用户编辑 /etc/network/interfaces 文件,最后添加如下一行
pre-up ifconfig eth0 hw ether MAC地址
另外我还在/etc/init.d/networking中的代码
case "$1" in
start)
下添加
代码:
ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE
重启后测试mac地址修改成功了。
 
另外还有网上的其他方法未试:
——————————————————————————————
修改网卡的MAC地址

临时修改(通用做法)
#/sbin/ifconfig eth0 down
#/sbin/ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE
#/sbin/ifconfig eht0 up
或者(通用做法)
#ip link set eth0 down
#ip link set eth0 address 00:48:54:11:22:33
#in ling set eth0 up
永久修改可以将上面几行放入 /etc/rcS.d/rc.local 文件

(ubuntu/Debian Only)
或者直接编辑 /etc/network/interfaces 文件
在对应的网卡名后面加上 hwaddress ether MAC地址
不需要ifconfig了
————————————————————————————————
原文地址:https://www.cnblogs.com/aix1314/p/2997126.html