VMware Fusion中虚拟机的IP老是不断变化,致使本身搭建的Hadoop、Spark集群的维护很是不方便, 因此就须要为虚拟机指定IP地址。ios
dhcpd.conf 文件记录了动态分配的IP地址段,以及mac地址绑定的IPvim
# Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet8. # # This file was automatically generated by the VMware configuration program. # See Instructions below if you want to modify it. # # We set domain-name-servers to make some DHCP clients happy # (dhclient as configured in SuSE, TurboLinux, etc.). # We also supply a domain name to make pump (Red Hat 6.x) happy. # ###### VMNET DHCP Configuration. Start of "DO NOT MODIFY SECTION" ##### # Modification Instructions: This section of the configuration file contains # information generated by the configuration program. Do not modify this # section. # You are free to modify everything else. Also, this section must start # on a new line # This file will get backed up with a different name in the same directory # if this section is edited and you try to configure DHCP again. # Written at: 07/02/2016 03:48:07 allow unknown-clients; default-lease-time 1800; # default is 30 minutes max-lease-time 7200; # default is 2 hours subnet 192.168.109.0 netmask 255.255.255.0 { range 192.168.109.128 192.168.109.254; option broadcast-address 192.168.109.255; option domain-name-servers 192.168.109.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.109.2; option routers 192.168.109.2; } host vmnet8 { hardware ethernet 00:50:56:C0:00:08; fixed-address 192.168.109.1; option domain-name-servers 0.0.0.0; option domain-name ""; option routers 0.0.0.0; } ####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######
说明: "range 192.168.109.128 192.168.109.254" 是动态分配的IP地址段。网络
编辑 dhcpd.conf 文件app
sudo vim /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf
在文件末尾添加如下配置dom
host master { hardware ethernet 00:0C:29:61:B0:BF; fixed-address 192.168.109.137; } host slave01 { hardware ethernet 00:0C:29:B8:B8:5c; fixed-address 192.168.109.139; } host slave02 { hardware ethernet 00:0C:29:0D:BE:68; fixed-address 192.168.109.138; }
虚拟机的 MAC 地址能够在 "网络适配器 -> 高级选项" 中查看到, fixed-address 后面的 IP 地址就是为虚拟机所指定的 IP 地址, IP 地址的范围须要在 range 后面指定的IP地址段范围内。oop