# VMware虚拟机中修改Linux MAC地址的方法

- Link: https://www.xuepaijie.com/html/skill/coup/142.html
- Published: 2015-02-01T23:04:53+08:00
- Author: Admin

**1、修改虚拟机的\*.vmx文件**

这种方法最值得推荐，因为这样就类似于重新“烧录”了VMware虚拟机的“物理网卡ROM”。方法
是：

分两种情况：

    ```html;
    a：

    ethernet0.addressType = "static"

    ethernet0.Address = "00:50:56:0A:0B:0C"
    ```

“static”说明VM的”物理网卡”的MAC是静态设定的，你可以改成一个以005056开头的另外一个
MAC即可。改完启动VM时如果问你SSID的话，选择“Keep Always”。

    ```html;
    b：

    ethernet0.addressType = "generated"

    uuid.location = "56 4d dc f1 ff aa 75 ea-f1 b9 ee 0d 68 9c 65 5c"

    uuid.bios = "56 4d ed 23 13 8c 96 91-7c 68 b2 09 8b aa bb cc"

    ethernet0.generatedAddress = "00:0c:29:aa:bb:cc"
    ```

“generated”说明VM的”物理网卡”的MAC是系统随机动态设定的，你可以通过将uuid.bios后六位
及ethernet0.generatedAddress后六位改成你想要改成的以000c29开头的MAC即可。

**2、修改Linux系统里相关 /etc/sysconfig/network-scripts/ifcfg-eth0文件MAC值**

    ```html;
    vi /etc/sysconfig/network-scripts/ifcfg-eth0

    MACADDR=xx:xx:xx:xx:xx:xx

    :wq 保存退出

    reboot
    ```

**3、修改Linux系统里相关rc.local文件MAC值**

可以通过改启动脚本/etc/rc.d/rc.local：

    ```html;
    ifconfig eth0 down

    ifconfig eth0 hw ether xxxxxxxxxxxx

    ifconfig eth0 up

    /sbin/route add default gw x.x.x.x eth0

    :wq 保存退出

    reboot
    ```
