shell脚本linux修改mac地址

修改mac地址

编辑/etc/init.d.rcS
在/sbin/ifconfig lo 127.0.0.1 up 前面加上下面三行:
/sbin/ifconfig eth0 down
/sbin/ifconfig eth0 hw ether 00:1D:78:12:34:58
/sbin/ifconfig eth0 up

修改mac地址

  1. 修改下面3个命令:
    将mac地址’11:11:11’替换成需要你需要的mac地址:

sed -i “/127.0.0.1 up/i/sbin/ifconfig eth0 up” /etc/init.d/rcS

sed -i “/ifconfig eth0 up/i/sbin/ifconfig eth0 hw ether 00:1D:78:11:11:11” /etc/init.d/rcS

sed -i “/ifconfig eth0 hw ether/i/sbin/ifconfig eth0 down” /etc/init.d/rcS

  1. 使用putty登录,将上面命令复制,作为输入命令,按照顺序输入

  2. 断电重启后,mac地址已经改变。

Guess you like

Origin blog.csdn.net/V__KING__/article/details/108523092