在 Linux 中,可以使用 ifconfig 命令来临时修改网卡的 MAC 地址(也称为 MAC spoofing)。注意:这种方式重启后会失效。
ifconfig
或
ip addr
假设网卡名为 eth0(也可能是 ens33、wlan0 等)
sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether 00:11:22:33:44:55
hw ether表示硬件地址(MAC)
00:11:22:33:44:55替换为你要设置的 MAC
sudo ifconfig eth0 up
ifconfig eth0
或
ip link show eth0
✅ 临时生效
✅ 权限要求
sudo 或 root 用户✅ 某些网卡不支持
✅ 可能会被网络环境检测
network:
ethernets:
eth0:
macaddress: 00:11:22:33:44:55
vi /etc/sysconfig/network-scripts/ifcfg-eth0
添加:
MACADDR=00:11:22:33:44:55
如果你告诉我 Linux 发行版 + 网卡类型(有线/无线),我可以给你更精确的命令。