出于隐私需求,不想暴露真实mac地址,把下面这个脚本的内容加入/etc/init.d,就可以在每次开机的时候为网卡随机设置一个mac地址。
#!/bin/bash
#Chorder
#2016/12/08
mhash=`date +%s|md5sum`
ifconfig eth0 down
ifconfig eth0 hw ether `echo ${mhash:$((RANDOM % 13)):2}:${mhash:$((RANDOM % 13)):2}:${mhash:$((RANDOM % 13)):2}:${mhash:$((RANDOM % 15)):2}:${mhash:$((RANDOM % 15)):2}:${mhash:$((RANDOM % 15)):2} `
ifconfig eth0 up
ifconfig wlan0 down
ifconfig wlan0 hw ether `echo ${mhash:$((RANDOM % 13)):2}:${mhash:$((RANDOM % 13)):2}:${mhash:$((RANDOM % 13)):2}:${mhash:$((RANDOM % 15)):2}:${mhash:$((RANDOM % 15)):2}:${mhash:$((RANDOM % 15)):2} `
ifconfig wlan0 up
原文地址:https://www.cnblogs.com/Chorder/p/9114448.html
时间: 2024-11-08 12:03:08