方法一:
1)编辑“/etc/init.d/rc.local”文件(sudo gedit /etc/init.d/rc.local)
2)在此配置文件的最后面加上如(Ubuntu:修改网卡的MAC地址)的修改命令:
## 修改 eth0 的 MAC 地址
sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF
sudo ifconfig eth0 up
1)编辑“/etc/init.d/rc.local”文件(sudo gedit /etc/init.d/rc.local)
2)在此配置文件的最后面加上如(Ubuntu:修改网卡的MAC地址)的修改命令:
## 修改 eth0 的 MAC 地址
sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF
sudo ifconfig eth0 up
方法二:
1)编辑“/etc/network/interfaces”文件(sudo gedit /etc/network/interfaces)
2)在此配置文件中找到“iface eth0 inet static”行,在其后面加上“hwaddress ether AA:BB:CC:DD:EE:FF”,如何没有这一行,则自己手动完整添加
1)编辑“/etc/network/interfaces”文件(sudo gedit /etc/network/interfaces)
2)在此配置文件中找到“iface eth0 inet static”行,在其后面加上“hwaddress ether AA:BB:CC:DD:EE:FF”,如何没有这一行,则自己手动完整添加
/etc/udev/rules.d/70-persistent-net.rules -》 每次探测到硬件改变时,改文件都会被改变,因此可以通过查看该文件的内容判断mac是否被改;
另,在修改mac过程中,有时会碰到网卡出现 wired device not managed 问题,下面是修复办法:
Most probably your interface appears in /etc/network/interfaces. By default, NetworkManager does not manage interfaces that appear in /etc/network/interfaces. You can change this behaviour.
To do this - in a terminal:
sudo nano /etc/NetworkManager/NetworkManager.conf
change the line managed=false to managed=true
Save, stop and start network manager:
sudo service network-manager restart