在 VMWware 中让虚拟操作系统拥有静态 IP 地址的最佳方法是什么?我想保持 IP 地址静态,因为它是虚拟服务器。

有帮助吗?

解决方案

假设您没有使用基于 NAT 的 VMWare 网络,那么虚拟(来宾)服务器的答案与真实服务器没有任何不同。你可以:

  • 通过来宾操作系统支持的任何机制分配静态 IP。
  • 配置来宾操作系统从 DHCP 服务器获取其 IP 地址,并将 DHCP 服务器配置为返回 VMWare 实例 MAC 地址的静态 IP 地址。

其他提示

您可以配置VMware DHCP服务器[在主机操作系统上运行],以便每次为虚拟机分配固定IP地址。

根据 VMware 文档, ,配置存储在以下位置:

视窗XP

C:\Documents and Settings\All Users\Application Data\VMware\vmnetdhcp.conf

Windows Vista 或 Windows 7

C:\ProgramData\VMware\vmnetdhcp.conf

Linux(仅限主机)

/etc/vmware/vmnet1/dhcp/dhcp.conf

Linux(网络地址转换)

/etc/vmware/vmnet8/dhcp/dhcp.conf

VMWare Fusion for Mac(仅限主机)

/Library/Preferences/VMware Fusion/vmnet1/dhcpd.conf

适用于 Mac 的 VMWare Fusion (NAT)

/Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf

按 MAC 的静态 IP 和 DNS 名称示例:

host ubuntu {
    hardware ethernet 00:0c:29:c0:2c:58;
    fixed-address 192.168.118.3;
} 

有关这方面的更多详细信息,请参阅此 博客文章.

如果你想要的VM片/ VM机(来宾)有一个静态IP,将其分配给虚拟机切片。然后VM Server上选择“桥接”网络适配器设置。这告诉VMWare的使用已在来宾上建立什么都IP设置。

此作品在我的机器上

按照这些简单的步骤。只需5分钟。

1. Note the MAC of the VM
2. On the host machine open C:\ProgramData\VMware\vmnetdhcp.conf
    a. Or C:\Documents and Settings\All Users\Application Data\VMware\vmnetdhcp.conf 
    b. These 2 files are auto synced or mirrored. 
    c. Open the editor in Administrator mode. Eg notepad++. Otherwise you will get access denied message
3. Add a new entry at bottom of the configuration file, right before the "# End" marker. MyGuestVM is any unique name. Example below

host sunilW2008Server {
hardware ethernet 00-0C-29-05-2B-A0;
fixed-address 192.168.63.222;
}

3. Shutdown the VM and close the Workstation
4. Re-start the VMWare DHCP and NAT services for changes to take effect (From services.msc)

注意: 下面的文件夹是在同步自动..在一个地方发生变化,同样会在其他文件夹中被反射

C:\ ProgramData \ VMware的 C:\ Documents和Settings \所有用户\应用数据\ VMware的

一个简单的解决方法,配置 VMware的DHCP服务器使用较长的租赁。 在的VMware 配置文件夹(在窗7 - C:\ProgramData\vmware)编辑文件 vmnetdhcp.conf 和改变default-lease-timemax-lease-time的值,以 更大的东西说,4个月(4mo*30days*24hours*60min*60sec = 10368000)。 然后重新启动的的VMware DHCP服务器。然后释放并更新在来宾租赁。 现在,你的客人的 IP 的是静态的为未来四个月。

如果你宁愿让VM主机配置为默认值,也可以将来宾机器配置要求的固定地址的DHCP。这将工作,即使是NAT网络。在Ubuntu和dhclient的情况下,这是通过下面的块中dhclient.conf实现:

interface "eth0" {
    send dhcp-requested-address 192.168.1.222;
}

来源: https://serverfault.com/a/381137

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top