Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

VMware 虛擬機修改 Linux MAC 位址三大法

編輯:Linux 教學

MAC 位址為網卡燒錄的物理位址,Windows 下易修改,Linux 虛擬機中需針對不同層面處理。本文提供三種在 VMware 中修改客體 Linux MAC 的方法。

方法一:修改客體 Linux 啟動腳本(最直接)

編輯 /etc/rc.local(或 /etc/rc.d/rc.local),加入:

ifconfig eth0 down
ifconfig eth0 hw ether 00:0C:29:AA:BB:CC
ifconfig eth0 up

重啟後生效。缺點:每次開機需由 OS 端轉換,非真正「硬體層級」修改。

方法二:修改 VMX 設定檔(最推薦,等同重燒 ROM)

關閉虛擬機,編輯 *.vmx 檔案,視情況修改:

情況 A:靜態指定 MAC

ethernet0.addressType = "static"
ethernet0.address = "00:50:56:0A:0B:0C"
  • static 表手動指定,MAC 需以 VMware OUI 00:50:56 開頭。
  • 啟動時若詢問 UUID 衝突,選「Keep Always」。

情況 B:自動產生 MAC(預設)

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"
  • 修改 uuid.bios 最後 6 位元組與 ethernet0.generatedAddress 最後 6 位元組為相同值(如 aa:bb:cc),MAC 將變為 00:0c:29:aa:bb:cc(OUI 固定為 00:0c:29)。

方法三:修改網路腳本設定檔(Red Hat 系)

編輯 /etc/sysconfig/network-scripts/ifcfg-eth0,新增:

MACADDR=XX:XX:XX:XX:XX:XX

存檔後 reboot。此法同屬 OS 層面修改,但配置集中於網路腳本,較易維護。

總結建議

  • 追求永久、硬體層級修改 → 方法二(改 VMX)
  • 臨時測試或無權改宿主機檔案 → 方法一或三
Copyright © Windows教程網 All Rights Reserved