博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
VMware Fusion指定虚拟机IP
阅读量:6939 次
发布时间:2019-06-27

本文共 2352 字,大约阅读时间需要 7 分钟。

hot3.png

问题描述

VMware Fusion中虚拟机的IP总是不断变化,导致自己搭建的Hadoop、Spark集群的维护非常不方便, 所以就需要为虚拟机指定IP地址。

解决方案

dhcpd.conf文件

dhcpd.conf 文件记录了动态分配的IP地址段,以及mac地址绑定的IP

# 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:07allow unknown-clients;default-lease-time 1800;                # default is 30 minutesmax-lease-time 7200;                    # default is 2 hourssubnet 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地址段。

为虚拟机指定 IP

编辑 dhcpd.conf 文件

sudo vim /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf

在文件末尾添加以下配置

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地址段范围内。

转载于:https://my.oschina.net/jackieyeah/blog/708858

你可能感兴趣的文章
SSH公钥生成及配置
查看>>
iOS 新浪微博快速集成
查看>>
禁用浏览器返回
查看>>
flask+uwsgi+nginx部署网站
查看>>
从九寨沟地震 细数那些数据中心受过的伤害
查看>>
BIPlatform的安装以及本地开发环境搭建
查看>>
GOF23之适配器模式
查看>>
PHP跨页面SESSION丢失问题
查看>>
Java Socket探究
查看>>
现在在下载Google APIs by Google Inc. 速度为1kib/s,特此纪念又...
查看>>
Android Push开源解决方案
查看>>
安卓constraintLayout中app:srcCompat设置的图片显示不出来
查看>>
webmagic新版文档(更新中)
查看>>
nginx 安装在ubuntu上
查看>>
Xtrabackup全量备份/增量备份脚本
查看>>
白天谋生存,晚上谋发展
查看>>
hive 12及以后,可以使用非同步查询
查看>>
CentOS 7安装部署ELK 6.2.4
查看>>
通过ansible批量安装部署mysql
查看>>
Kafka/Metaq设计思想学习笔记
查看>>