默認狀況下,vmware fusion中的虛擬機,網卡設置成dhcp(動態分配 )時,會分配一個IP地址,但這個IP一般很難記,若是咱們想爲某臺虛擬機挑一個好記的IP地址,能夠按以下步驟操做:ios
命令行下,輸入centos
sudo vi /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.confdom
該文件記錄了動態分配的IP地址段,以及某個mac地址綁定的IP,參考下面的內容修改:spa
------------------------------------------------------------------------命令行
allow unknown-clients;router
default-lease-time 1800; # default is 30 minutesserver
max-lease-time 7200; # default is 2 hoursblog
subnet 192.168.187.0 netmask 255.255.255.0 {ip
range 192.168.187.100 192.168.187.110;get
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://yjmyzz.cnblogs.com 本文版權歸做者和博客園共有,歡迎轉載,但未經做者贊成必須保留此段聲明,且在文章頁面明顯位置給出原文鏈接,不然保留追究法律責任的權利。