问题描述
我通过 vmware 包在 ESX(在 vSphere Client 上)上创建了虚拟机:看这里.但我无法从代码中设置 IP 地址.
I created virtual machine on ESX (on vSphere Client) by vmware package:Look here. but I can not set the IP address from the code.
我试过了:
ServiceInstance si = new ServiceInstance(new URL(Url), user, password, true);
VirtualMachine vm = (VirtualMachine) new InventoryNavigator(si.getRootFolder()).searchManagedEntity("VirtualMachine", "NewVmName");
System.out.println( vm.getGuest().toolsRunningStatus);
vm.getGuest().setIpAddress(ipAddress);
但它并没有改变.有谁知道可以做什么来更新IP地址?
But it didn't change. Does anyone know what can be done to update IP Address?
推荐答案
虚拟机的 IP 地址由虚拟机本身控制.如果确实要设置虚拟机的 IP 地址,请将网络适配器更改为桥接"并在虚拟机本身中设置 IP 地址.请参阅:在 Windows 上设置 IP 地址、Linux, 和 Mac.
来源:Superuser,OSXDaily
The IP Address of a Virtual Machine is controlled by the Virtual Machine itself. If you do want to set the IP Address of the Virtual Machine, change the network adapter to "Bridged" and set the IP Address in the Virtual Machine itself. Refer to: Setting IP Address on Windows, Linux, and Mac.
Sources: Superuser, OSXDaily
这篇关于我可以使用 vmware 包更改虚拟机的 IP 地址吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!