在 Linux 中,ifconfig 可以用来修改 MAC 地址(MAC spoofing),但前提是先关闭网卡。
# 1. 关闭网卡(假设网卡是 eth0)
sudo ifconfig eth0 down
# 2. 修改 MAC 地址
sudo ifconfig eth0 hw ether 00:11:22:33:44:55
# 3. 重新启用网卡
sudo ifconfig eth0 up
ifconfig eth0 | grep ether
或
ip link show eth0
sudo)ifconfig,推荐使用 ip 命令sudo ip link set eth0 down
sudo ip link set eth0 address 00:11:22:33:44:55
sudo ip link set eth0 up
编辑 /etc/netplan/*.yaml 或 /etc/network/interfaces,添加:
macaddress: 00:11:22:33:44:55
如果你告诉我发行版 + 网卡名,我可以给你更精确的命令。