临时更改mac地址

首先用 ifconfig 命令获取有关网卡详细

l@l:~$ ifconfig
enp4s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
   inet 192.168.1.25  netmask 255.255.255.0  broadcast 192.168.1.255
   inet6 240e:342:7c8e:d700:226a:8aff:fe45:566a  prefixlen 64  scopeid 0x0<global>
   inet6 fe80::226a:8aff:fe45:566a  prefixlen 64  scopeid 0x20<link>
   ether 20:6a:8a:45:56:6a  txqueuelen 1000  (以太网)
   RX packets 885897  bytes 1230937892 (1.2 GB)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 439147  bytes 110186300 (110.1 MB)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
   device interrupt 19  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
   inet 127.0.0.1  netmask 255.0.0.0
   inet6 ::1  prefixlen 128  scopeid 0x10<host>
   loop  txqueuelen 1000  (本地环回)
   RX packets 215339  bytes 68532494 (68.5 MB)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 215339  bytes 68532494 (68.5 MB)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp3s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
   ether 20:7c:8f:6c:09:d5  txqueuelen 1000  (以太网)
   RX packets 587055  bytes 819022651 (819.0 MB)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 320576  bytes 34849259 (34.8 MB)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

这里看到两个接口以太网无线网

#以太网 enp4s0f0
#mac 20:6a:8a:45:56:6a
#无线 wlp3s0
#mac 20:7c:8f:6c:09:d5

#然后这样操作

sudo /etc/init.d/networking stop
sudo ifconfig enp4s0f0 hw ether [这里填写你要的mac地址,不要括号直接命令后面填写]
sudo /etc/init.d/networking start
#重启一下网络

#这样做重启计算机就会失效,这正是我想要的,一个什么灯的软件免费送500mb高速流量,他是通过检测你的硬件地址来记录的,
#用完了修改一下mac硬件地址,从新获得500mb,就是麻烦点,可以无限的用下去!