马春杰杰 Exit Reader Mode

Linux如何修改mac地址 | Linux如何设置开机自动更换IP?

修改mac地址主要有两种方法,临时永久

首先查看一下自己的网卡,ifconfig

临时:

先用这个小工具生成随机的Mac地址:在线MAC地址生成器(有个bug,点进去之后先在“地址前缀”框点一下,然后再点击生成)

sudo ifdown eth0

sudo ifconfig eth0 hw ether 82:66:47:28:C2:11

sudo ifup eth0

service network restart

sudo /etc/init.d/networking restart

这种临时的一般重启电脑之后就变回原来的了。

永久:

打开网络配置文件:sudo nano /etc/network/interfaces

然后加入一句:pre-up ifconfig eth0 hw ether 82:66:47:28:C2:11

即:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
pre-up ifconfig eth0 hw ether 82:66:47:28:C2:E1

然后重启下网卡即可:

sudo /etc/init.d/networking restart

本文最后更新于2022年11月11日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!