2021-05-12 14:32:11
VMware Fusion DHCP方式下如何指定虛擬機器IP地址
預設情況下,VMware Fusion中的虛擬機器,網絡卡設定成DHCP(動態分配 )時,會分配一個IP地址,但這個IP通常很難記,如果我們想為某台虛擬機器挑一個好記的IP地址,可以按如下步驟操作:
命令列下,輸入
sudo vi /Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf
該檔案記錄了動態分配的IP地址段,以及某個mac地址系結的IP,參考下面的內容修改:
------------------------------------------------------------------------
allow unknown-clients;
default-lease-time 1800; # default is 30 minutes
max-lease-time 7200; # default is 2 hours
subnet 192.168.187.0 netmask 255.255.255.0 {
range 192.168.187.100 192.168.187.110;
option broadcast-address 192.168.187.255;
option domain-name-servers 192.168.187.2;
option domain-name localdomain;
default-lease-time 1800; # default is 30 minutes
max-lease-time 7200; # default is 2 hours
option netbios-name-servers 192.168.187.2;
option routers 192.168.187.2;
}
host vmnet8 {
hardware ethernet 00:50:56:C0:00:08;
fixed-address 192.168.187.1;
option domain-name-servers 0.0.0.0;
option domain-name "";
option routers 0.0.0.0;
}
host CentOS.01{
hardware ethernet 00:50:56:3C:30:4B;
fixed-address 192.168.187.101;
}
host centos.02{
hardware ethernet 00:50:56:38:33:7B;
fixed-address 192.168.187.102;
}
host centos.03{
hardware ethernet 00:0C:29:D3:29:77;
fixed-address 192.168.187.103;
}
host centos.04{
hardware ethernet 00:50:56:3a:93:0d;
fixed-address 192.168.187.104;
}
注意紅色高亮部分,range行是動態分配的IP地址段。這樣,我們就為centos.01~04這四台機器系結了IP(註:虛擬機器的mac地址,可以在虛擬機器的網絡卡設定高階選項中查到,或者ifconfig/ipconfig檢視),這個檔案修改好後,儲存退出,然後徹底退出vmare fusion,重新再啟動vmware fusion,再啟動各虛擬機器,順利的話,就能分配到理想的IP地址。
最後在mac本主系統、以及各虛擬機器的hosts檔案中做下對映,以後記起來就方便多了。
本文永久更新連結地址:http://www.linuxidc.com/Linux/2017-06/144721.htm
相關文章