1、首先查看网卡信息:
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:49:22:C8
inet addr:10.65.7.182 Bcast:10.65.7.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe49:22c8/64 Scope:Link
。。。
上面显示,设备eth0的MAC信息,即硬件地址HWaddr 00:0C:29:49:22:C8
2、关闭eth0,因为会关闭网络服务,所以这要求直接操作本地机器
[root@localhost ~]# ifconfig eth0 down
3、修改MAC信息为00:0C:29:49:22:C1
[root@localhost ~]# ifconfig eth0 hw ether 00:00:00:00:00:C1
4、启动eth0
[root@localhost ~]# ifconfig eth0 up
5、查看修改后的网卡信息:
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:C1
inet addr:10.65.7.182 Bcast:10.65.7.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe49:22c1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3470 errors:0 dropped:0 overruns:0 frame:0
TX packets:1509 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:907742 (886.4 KiB) TX bytes:182280 (178.0 KiB)
Interrupt:67 Base address:0x2024
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1505 errors:0 dropped:0 overruns:0 frame:0
TX packets:1505 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2414590 (2.3 MiB) TX bytes:2414590 (2.3 MiB)
★★★★★★★★★★★★
永久修改MAC信息:
打开/etc/rc.d/rc.local ,追加三行内容:
ifconfig eth0 down
ifconfig eth0 hw ether 00:00:00:00:00:C1
ifconfig eth0 up
然后重启