1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > VMware Workstation Player的vmnet8没启动 虚拟机没法NAT的问题分析与解决

VMware Workstation Player的vmnet8没启动 虚拟机没法NAT的问题分析与解决

时间:2020-10-29 03:41:17

相关推荐

VMware Workstation Player的vmnet8没启动 虚拟机没法NAT的问题分析与解决

现象

虚拟机启动时如下提示

分析

使用vmware自带的工具分析其网络设备状态:

$ vmware-networks --statusFailed to initializeubuntu@u:~$ sudo vmware-networks --statusBridge networking on vmnet0 is runningDHCP service on vmnet1 is runningHostonly virtual adapter on vmnet1 is enabledDHCP service on vmnet8 is not runningNAT service on vmnet8 is not runningHostonly virtual adapter on vmnet8 is disabledSome/All of the configured services are not running

其中显示:Hostonly virtual adapter on vmnet8 isdisabled

于是,尝试手动启动,失败。

$ sudo vmware-networks --start

Started Bridge networking on vmnet0

Enabled hostonly virtual adapter on vmnet1

Started DHCP service on vmnet1

Subnet on vmnet8 is no longer available for usage, please run the network editor to reconfigure different subnet

Failed to start some/all services

查看网络日志,部分日志如下:

Oct 24 15:05:42 VNLNetCfgEnumDHCPMACToIP - List of mappings is empty

Oct 24 15:05:42 VNL_UpdateDHCPFromConfig - Writing DHCP configuration file succeeded for vnet: vmnet8

Oct 24 15:05:42 VNLFileExists - Cannot check for file or directory: /etc/vmware/vmnet8/nat/nat.conf ,error: No such file or directory

Oct 24 15:05:42 VNLCreateFile - Directory: /etc/vmware/vmnet8 already exists

Oct 24 15:05:42 VNLNetCfgEnumNATPortFwd - List of forwarded ports is empty

Oct 24 15:05:42 VNLNetCfgEnumNATPortFwd - List of forwarded ports is empty

Oct 24 15:05:42 VNL_UpdateNATFromConfig - Writing NAT configuration file succeeded for vnet: vmnet8

Oct 24 15:05:42 VNL_UpdateDHCPFromConfig - Removing DHCP configuration file succeeded for vnet: vmnet9

Oct 24 15:05:42 VNL_UpdateNATFromConfig - Removing NAT configuration file succeeded for vnet: vmnet9

Setting vmnet-dhcp IP address: 172.16.49.254

Opened: /dev/vmnet1

Recving on VNet/vmnet1/172.16.49.0

Sending on VNet/vmnet1/172.16.49.0

Forked child process, pid=1494

Oct 24 15:08:53 VNL_StartService - Started “DHCP” service for vnet: vmnet1

Failed to start some/all services

Oct 24 15:41:11 VNL_Load - LOG_OK logged

Oct 24 15:41:11 VNL_Load - Successfully initialized Vnetlib

Oct 24 15:41:11 VNLPingAndCheckSubnet - Return value of vmware-ping: 0

Oct 24 15:41:11 VNL_CheckSubnetAvailability - Subnet: 192.168.16.0 on vnet: vmnet8 is not available

Oct 24 15:41:12 VNL_Unload2 - Vnetlib unloaded.

Oct 24 16:03:10 VNL_Load - LOG_ERR logged

Oct 24 16:03:10 VNL_Load - LOG_WRN logged

Oct 24 16:03:10 VNL_Load - LOG_OK logged

Oct 24 16:03:10 VNL_Load - Successfully initialized Vnetlib

Oct 24 16:03:10 VNL_Unload2 - Vnetlib unloaded.

Oct 24 16:03:17 VNL_Load - LOG_ERR logged

Oct 24 16:03:17 VNL_Load - LOG_WRN logged

Oct 24 16:03:17 VNL_Load - LOG_OK logged

Oct 24 16:03:17 VNL_Load - Successfully initialized Vnetlib

Oct 24 16:03:17 VNLPingAndCheckSubnet - Return value of vmware-ping: 0

Oct 24 16:03:17 VNL_CheckSubnetAvailability - Subnet: 192.168.16.0 on vnet: vmnet8 is not available

Oct 24 16:03:18 VNL_Unload2 - Vnetlib unloaded.

经检查有这个文件: /etc/vmware/vmnet8/nat/nat.conf,从文件创建时间看,应该是日志显示时修改过的。

查看网络配置文件:

$ cat /etc/vmware/networkingVERSION=1,0answer VNET_1_DHCP yesanswer VNET_1_DHCP_CFG_HASH 5205CD20C2ABBFC5BE4F3BF834B14E380183528Aanswer VNET_1_HOSTONLY_NETMASK 255.255.255.0answer VNET_1_HOSTONLY_SUBNET 172.16.49.0answer VNET_1_VIRTUAL_ADAPTER yesanswer VNET_8_DHCP yesanswer VNET_8_DHCP_CFG_HASH DE31AE240D28906CBBE16CE55BD334FD0321EB60answer VNET_8_HOSTONLY_NETMASK 255.255.255.0answer VNET_8_HOSTONLY_SUBNET 192.168.16.0answer VNET_8_NAT yesanswer VNET_8_VIRTUAL_ADAPTER yes

PS: 说句题外话,其实vmnet1与vmnet8几乎一样,只是vmnet8多了一个NAT到外网。

VNET_8_HOSTONLY_SUBNET改为192.268.15.0,重启Host机,没效果。

那再看看安装了哪些组件,VMWare的组件安装器是使用Python编写的,一堆的Python小文件:

$ sudo ./VMware-Player-Full-16.2.0-18760230.x86_64.bundle -tExtracting VMware Installer...ponent NameComponent Long Name Component Version============================ ================================================= ====================vmware-installer VMware Installer 3.0.0.18760230vmware-player-setupVMware Player Setup 16.2.0.18760230vmware-usbarbitrator VMware USB Arbitrator 20.5.0.18760230vmware-network-editor VMware Network Editor 16.2.0.18760230vmware-vmx VMware VMX16.2.0.18760230vmware-virtual-printer VMware Virtual Printer 1.0.18760230vmware-tools-linuxPreGlibc25 VMware Tools for legacy Linux 11.3.5.18760230vmware-tools-linux VMware Tools for Linux 11.3.5.18760230vmware-tools-netware VMware Tools for NetWare11.3.5.18760230vmware-tools-solaris VMware Tools for Solaris11.3.5.18760230vmware-tools-winPre2k VMware Tools for Windows 95, 98, Me and NT 11.3.5.18760230vmware-tools-winPreVistaVMware Tools for Windows 2000, XP and Server 11.3.5.18760230vmware-tools-windows VMware Tools for Windows Vista or later 11.3.5.18760230vmware-player-app VMware Player Application16.2.0.18760230vmware-ovftoolVMware OVF Tool component for Linux4.4.3.18760230vmware-playerVMware Player 16.2.0.18760230

再看看组件vmware-network-editor的安装器脚本们:

$ sudo ./VMware-Player-Full-16.2.0-18760230.x86_64.bundle -L vmware-network-editorExtracting VMware Installer...done./etc/vmware-installer/components/vmware-network-editor/16.2.0/include/versions.py/etc/vmware-installer/components/vmware-network-editor/16.2.0/include/__pycache__/versions.cpython-39.pyc/etc/vmware-installer/components/vmware-network-editor/16.2.0/include/systemType.py/etc/vmware-installer/components/vmware-network-editor/16.2.0/include/__pycache__/systemType.cpython-39.pyc/etc/vmware-installer/components/vmware-network-editor/16.2.0/__init__.py/etc/vmware-installer/components/vmware-network-editor/16.2.0/__pycache__/__init__.cpython-39.pyc/etc/vmware-installer/components/vmware-network-editor/16.2.0/include/initscript.py/etc/vmware-installer/components/vmware-network-editor/16.2.0/include/__pycache__/initscript.cpython-39.pyc/etc/vmware-installer/components/vmware-network-editor/16.2.0/include/update.py/etc/vmware-installer/components/vmware-network-editor/16.2.0/include/__pycache__/update.cpython-39.pyc/etc/vmware-installer/components/vmware-network-editor/16.2.0/vmware-network-editor.py/etc/vmware-installer/components/vmware-network-editor/16.2.0/__pycache__/vmware-network-editor.cpython-39.pyc/usr/lib/vmware/lib/libvmware-netcfg.so/libvmware-netcfg.so/usr/lib/vmware/bin/vmware-netcfg

即他们把下面的几个主要文件安装至系统:

/usr/lib/vmware/lib/libvmware-netcfg.so/libvmware-netcfg.so/usr/lib/vmware/bin/vmware-netcfg

想运行网络编辑network editor这个组件/usr/lib/vmware/bin/vmware-netcfg,命令行没法单独运行。

$ file /usr/lib/vmware/bin/vmware-netcfg/usr/lib/vmware/bin/vmware-netcfg: symbolic link to /usr/lib/vmware/bin/appLoaderubuntu@u:~/Downloads$ file /usr/lib/vmware/bin/appLoader/usr/lib/vmware/bin/appLoader: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.4, BuildID[sha1]=9322b0ef3bb456d9b7ff73709b901ad603a03289, stripped

$ /usr/lib/vmware/bin/appLoader[AppLoader] "appLoader" cannot be run as a standalone program.

PS:/usr/lib/vmware/bin/vmplayer也是 symbolic link to/usr/lib/vmware/bin/appLoader,其它一堆命令也是,为何运行/usr/lib/vmware/bin/vmplayer却不会提示如上错误呢?

那VMware Workstation Player的network editor GUI程序入口在哪里?

其实刚才多此一举,直接运行vmware-netcfg即可打开network editor的GUI.

PS:ssh -x远程情况下无法打开Virtual Network Editor的GUI, 提示

$ vmware-netcfg==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===Authentication is needed to run `/usr/bin/vmware-netcfg' as the super userAuthenticating as: ubuntu,,, (ubuntu)Password:polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie==== AUTHENTICATION FAILED ===Error executing command as another user: Not authorized

PS:严格来说,Virtual Network Editor GUI只有Pro版本才有的功能,主程序界面没有入口,所以在Linux下,需要从命令行寻找启动入口。

那,Windows下VM Player如何修改vmnet8的subnet呢,目前有两个方法:

从VMware Workstation Player安装包中解压找出 network.cab,现解压找出 vmnetcfg.exe,使用player.exe同目录下的vnetlib.exe,此程序本身设计不单独使用的,但研究人员整理了一份使用文档,VMware Workstation Player 4个服务 adapter, authd, bridge and vmkbd 都基于这个程序入口,足见重要性。

解决

按照出错的提示,修改vmnet8的子网,重启Host机,vmnet8就恢复正常了,ip a也能正常看到了。

$ sudo vmware-networks --statusBridge networking on vmnet0 is runningDHCP service on vmnet1 is runningHostonly virtual adapter on vmnet1 is enabledDHCP service on vmnet8 is runningNAT service on vmnet8 is runningHostonly virtual adapter on vmnet8 is enabledAll the services configured on all the networks are running

但,如果只是手动修改/etc/vmware/networking这个文件后重启系统,是没有效果的。因为其还有其它相关配置文件也需要修改,如/etc/vmware/vmnet8/nat/nat.conf等。

原因

原因应该是所在网络环境已经有了vmnet8期望使用的192.168.16.1/24地址,特别是192.168.16.1

比如,局域网中其它机子最近配置了192.168.16.1地址。

参考:VMware Workstation – Virtual Ethernet failed – sometimes for good!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。