Vnetlib - Documenting the command line

Vnetlib - Documenting the command line

I have been working on a utility that will let you attach VMware  Workstation 6.5.1 to ANY running windows based livecd/Preinstallation  Environment (xp/2003/vista/2008) and run VM's on top of it.
One of the hurdles has been to correctly set up and register all the  services. At first crv_ctl was used in combination with registry  patches, but that is an ugly way of setting it up.
While playing with this little powerful tool it became evident that it  will aid alot in repairing broken installations as well. That is because  you can install/uninstall start/stop all these services in different  ways with this utility.

Forgive me if this is already documented, at least I didn't find it, but will share my findings nevertheless.

My research was all collected and conducted from 32bit xp sp3 based  machines, and is mainly based on common sense, logic reasoning and a  little bit of pe analysis.

Although common sense was helpful, it also kind of confused me a little. Se the note in the end about Bug or Feature.

Following a string dump of the exe the first string that caught my attention was:
"vnetlib: this utility is not intended to be run as a standalone application".
But obviously it's possible to use it as such anyway.

Some configuration commands that modify settings seems already kind of  documented by Ulli at www.sanbarrow.com. I will not cover those here.

Before we start I need to mention that you need to have the binaries located at a path according to this registry entry:
HKEY_LOCAL_MACHINE\Software\VMware, Inc.\VMware Workstation
"InstallPath"="Path_to_cat/sys/inf/dll/exe"

Namely 4 services are dependant on this entry: adapter, authd, bridge and vmkbd.

First a list of all the services that vnetlib is able to interact with:
userif - VMware Network Application Interface (vmnetuserif)
dhcp - hcp Service for virtual networks (vmnetdhcp)
nat - Network address translation for virtual networks (vmware nat service)
bridge - VMware Bridge Protocol (vmnetbridge)
vmkbd - VMware Keyboard Driver (vmkbd)
vmx86 - VMware Virtualization Driver (vmx86)
vmci - VMware vmci Driver (vmci)
hcmon - VMware USB Driver (hcmon)
usb - VMware USB Client Driver (vmusb) -- (appears broken, use rundll32.exe to install)
vmmem - VMware Memory Driver (vmmemctl)
vmcpu - VMware CPU Driver (vmdesched-driver)
authd - VMware Authorization Service (vmauthdservice)
serverd - VMware Registration Service (vmserverdwin32)
vmparport - VMware Paralell Port Driver (vmparport)
adapter - VMware Virtual Ethernet Adapter Driver (vmnetadapter)

The first word is the service name used by vnetlib. The last word in  parentheses is the windows service name. The windows description is in  the middle.

Some of the commandline switches handling the services are:
"vnetlib -- install userif"
"vnetlib -- uninstall userif"
"vnetlib -- reinstall adapters"
"vnetlib -- start userif"
"vnetlib -- stop userif"

The "-- install" will take these parameters:
userif
dhcp
nat
bridge
vmkbd
vmx86
vmci
hcmon
usb (not working in install mode)
vmmem
vmcpu
authd
serverd
vmparport

Additionally there are some special ones for -- install:

devices - (will install 5 services; adapter, bridge, dhcp, nat, userif)
host - (will install 3 services; hcmon, vmparport, vmx86) -- may require  to be executed from within the "vmware workstation" directory of your  installation -- really not sure.

The "-- uninstall" will take these parameters:
userif
dhcp
nat
bridge
vmkbd (some problems uninstalling this)
vmx86
vmci
hcmon
usb
vmmem
vmcpu
authd
serverd
vmparport

Additionally there are some special ones for -- uninstall:

legacy - (will uninstall 3 services; bridge, dhcp, nat)
all - (will uninstall 4 services; bridge, dhcp, nat, userif)
host - (will uninstall 3 services; hcmon, vmparport, vmx86)
adapter/aggressive - (will uninstall 5 services; adapter, bridge, dhcp, nat, userif)
netDevices - (have not got this one working - supposedly a parameter)

Starting & Stopping Services:
"vnetlib -- start" and "vnetlib -- stop" will take these parameters:
dhcp
nat
userif
bridge
vmx86
vmci
vmmem
vmcpu
authd
serverd
hcmon
vmparport
vmkbd

Reinstalling services:

"vnetlib -- reinstall" will take these parameters:
all
host
network
drivers/adapters

Updating the settings:

"vnetlib -- update" will take these parameters:
dhcp
nat
adapter
all

Configuration of adapters:

"vnetlib -- add adapter vmnet5"
"vnetlib -- set adapter vmnet5 addr 11.11.11.1"
"vnetlib -- set vnet vmnet5 mask 255.255.255.0"
"vnetlib -- update adapter vmnet5"

*Configuration of services (NAT & DHCP*):

vnetlib -- set dhcp vmnet6 addipmac 33.33.33.33 00:50:56:C0:99:99
; quoted in seconds, 3600 = 1 hour, 86400 = 1 day, 432000 = 5 days
vnetlib -- set dhcp vmnet6 leasemaximum 7200
vnetlib -- set dhcp vmnet6 leasedefault 1800
vnetlib -- set dhcp vmnet6 leaseend 0.0.0.0
vnetlib -- set dhcp vmnet6 leasebegin 0.0.0.0

vnetlib -- set nat vmnet5 activeftp 1
vnetlib -- set nat vmnet5 forward tcp 40022 192.168.2.2 22
vnetlib -- set nat vmnet5 noforward tcp 40022 192.168.2.2 22
vnetlib -- set nat vmnet5 forward udp 406001 192.168.100.200 6001
vnetlib -- set nat vmnet5 configport 44080
vnetlib -- set nat vmnet5 privport tcp 60
vnetlib -- set nat vmnet5 unprivport tcp 60
vnetlib -- set nat vmnet5 privport udp 70
vnetlib -- set nat vmnet5 autopriv tcp
vnetlib -- set nat vmnet5 autopriv udp
vnetlib -- set nat vmnet5 noautopriv udp
vnetlib -- set nat vmnet5 allowanyoui 1
vnetlib -- set nat vmnet5 dnsautodetect 1
vnetlib -- set nat vmnet5 externalipaddr 193.231.70.70
vnetlib -- set nat vmnet5 internalipaddr 10.10.10.1 (GatewayIPAddress)
vnetlib -- set nat vmnet5 dnspolicy order (order/rotate/burst)
vnetlib -- set nat vmnet5 dnsretries 3
vnetlib -- set nat vmnet5 dnstimeout 2
vnetlib -- set nat vmnet5 dnsserver1 100.100.100.100
vnetlib -- set nat vmnet5 dnsserver2 200.200.200.200
vnetlib -- set nat vmnet5 dnsserver3 222.222.222.222
vnetlib -- set nat vmnet5 nbnstimeout 3
vnetlib -- set nat vmnet5 nbdstimeout 3
vnetlib -- set nat vmnet5 nbnsretries 2
vnetlib -- set nat vmnet5 udptimeout 3

Some nat commands must be deleted manually (adjust vmnet*);

"reg delete "HKLM\SOFTWARE\VMware, Inc.\VMnetLib\VMnetConfig\vmnet3\NAT" /v ActiveFTP /f"
"reg delete "HKLM\SOFTWARE\VMware, Inc.\VMnetLib\VMnetConfig\vmnet3\NAT" /v AllowAnyOUI /f"
"reg delete "HKLM\SOFTWARE\VMware, Inc.\VMnetLib\VMnetConfig\vmnet3\NAT" /v ConfigPort /f"
"reg delete "HKLM\SOFTWARE\VMware, Inc.\VMnetLib\VMnetConfig\vmnet3\NAT" /v ExternalIP /f" (internalipaddr)
"reg delete "HKLM\SOFTWARE\VMware, Inc.\VMnetLib\VMnetConfig\vmnet3\NAT" /v GatewayIPAddress /f" (externalipaddr)


Notes on some of the services:

vmusb:
Installing with vnetlib.exe seems broken. Actually vnetlib will never  throw you any error messages of any kind telling you if something did  not go as planned, but for vmusb even the log tells you it went ok.

vminst.log:
inst : 02/21/09 17:29:20 I1:VNL_InstallUSB: installing USB inf: 'C:\Programfiler\VMware\VMware Workstation\vmusb.inf'
inst : 02/21/09 17:29:22 I1:ParseCommand: operation: successful

But no vmusb service installed in registry and no driver files copied either. Workaround is using rundll32.exe.

Executing this will NOT work;
"rundll32 setupapi,InstallHinfSection _Install1.NT 128 "drive\full path\vmusb.inf""

But this WILL WORK;
"rundll32 setupapi,InstallHinfSection _Install1.NT 128 drive\full path\vmusb.inf"

(Important to NOT have any quotation marks around the last parameter, even though spaces are in the path.)

Note:
I see usb is not listed as a service that vnetlib will take as parameter  for the -- start switch, so it might not be possible to get it working  through vnetlib.exe.
"vnetlib -- uninstall usb" is working though.
I believe the activation of the service is handled internally inside the player and workstation binary (guessing).

vmnetadapter:
"vnetlib -- install adapter" will NOT work and cannot be installed  separately as all the other services can be. Instead vmnetadapter must  be installed standalone with rundll32.exe.
Installing VMnetAdapter1:
"rundll32 setupapi,InstallHinfSection VMnetAdapter1.Install 128 C:\path\netadapter.inf"
Important to NOT have spaces and NOT have any quotation marks around the last parameter.

Important
Uninstalling adapter or driver and a subsequent install of driver/devices will require a reboot.
It is then necessary to issue a "vnetlib -- update all" to get vmnetadapter visible again after the reboot.

Adding a virtual network adapter:
"vnetlib -- add adapter vmnet1" (vmnet2/vmnet3/vmnet4/vmnet5/vmnet6/vmnet7/vmnet8/vmnet9/vmnet0)

Removing a virtual network adapter:
"vnetlib -- remove adapter vmnet1" (vmnet2/vmnet3/vmnet4/vmnet5/vmnet6/vmnet7/vmnet8/vmnet9/vmnet0)

Disable a virtual network adapter:
"vnetlib -- disable adapter vmnet1" (vmnet2/vmnet3/vmnet4/vmnet5/vmnet6/vmnet7/vmnet8/vmnet9/vmnet0)

Enable a virtual network adapter:
"vnetlib -- enable adapter vmnet1" (vmnet2/vmnet3/vmnet4/vmnet5/vmnet6/vmnet7/vmnet8/vmnet9/vmnet0)

Update a virtual network adapter:
"vnetlib -- update adapter vmnet1" (vmnet2/vmnet3/vmnet4/vmnet5/vmnet6/vmnet7/vmnet8/vmnet9/vmnet0)

vmnetbridge:
"vnetlib -- install bridge" == "vnetlib -- bridge install"
A second way to install bridging is with rundll32:
"rundll32 setupapi,InstallHinfSection VMnetBridge.Install 128 c:\path\netbridge.inf"

Some notes on already documented configuration commands:
"vnetlib -- set vnet vmnet3 addr 10.10.10.10" == "vnetlib -- set adapter vmnet3 addr 10.10.10.10"


vnetlib.dll related findings:

"rundll32 vnetlib.dll,VNL_SetSuppressDriverPrompt" will write this to registry:

HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMnetLib\VMnetConfig
"SuppressPrompts"=dword:00000000

Setting this value to 1 will effectively suppress the warnings for  unsigned drivers (emulate a click on "Continue Anyway"), that will be  thrown at you if playing with modified inf files.

"rundll32 vnetlib.dll,VNL_RemoveAllNetworkDevices" will be the same as "vnetlib -- remove adapter all"

"rundll32 vnetlib.dll,VNL_StopDHCP" will be the same as "vnetlib -- stop dhcp"
"rundll32 vnetlib.dll,VNL_StartDHCP" will be the same as "vnetlib -- start dhcp"
and the same goes for nat.

Complete list:
VNL_StartBridge
VNL_StartDHCP
VNL_StartHcmon
VNL_StartNAT
VNL_StartUserIf
VNL_StartVMCI
VNL_StartVMX86
VNL_StartVmkbd
VNL_StartVmparport
VNL_StopBridge
VNL_StopDHCP
VNL_StopHcmon
VNL_StopNAT
VNL_StopUserIf
VNL_StopVMCI
VNL_StopVMX86
VNL_StopVmkbd
VNL_StopVmparport

"rundll32 vnetlib.dll,VNL_UninstallDHCP" = "vnetlib -- uninstall dhcp)
"rundll32 vnetlib.dll,VNL_UninstallNAT" = "vnetlib -- uninstall nat)

Note WMI:
For full support for all the commands you must have wmi running on the  system. Vnetlib.exe will still work without it, but interacting with  "bridge" does not work then. That can still be solved if vmnetbridge is  installed with rundll32.exe as described above.

*Bug or Feature*?
There is something wrong in the way vnetlib.exe checks the parameters  supplied. For the install/uninstall switches it appears that it will  accept a whole lot more than suggested above. In fact it will only do  some limited checks to see if the parameter is close enough to the  original/intended. This will vary depending on how many parameters have  similar looking names. In some cases it will only check for the first  letter and in some cases also the total number of characters for that  parameter.

Example:
"dhcp" will be accepted as "d" "dh" "de"
"all" will be accepted as "ali" and "-- install all" = "-- install authd"
"serverd" will be accepted as "status"
"adapter" will be accepted as "anabolics", but also "aggressive" and "aggressively"
"devices" will be accepted as "drivers" "default" and "donjuan", but not  as "devicess". Still not sure what it is supposed to be for this one.
"nat" will be accepted as "n" "net"
"bridge" will be accepted as "b" "br" "bbb" "brittt"
"legacy" will be accepted as "looser", but not as "loooser"
"userif" will only accept "userif"
and so on...

"vnetlib -- set vnet vmnet3 addr 10.10.10.10" = "vnetlib -- set vnnn vmnet3 addr 10.10.10.10"
"vnetlib -- set adapter vmnet3 addr 10.10.10.10" = "vnetlib -- set analsex vmnet3 addr 10.10.10.10"
"vnetlib -- update anabolics vmnet3" = "vnetlib -- update adapter vmnet3"
"vnetlib -- update vnnn vmnet3" = "vnetlib -- update vnet vmnet3"
"vnetlib -- remove adapter vmnet3" = "vnetlib -- remove a vmnet3" =  "vnetlib -- remove aaaaaaa vmnet3",,,,but "vnetlib -- remove v vmnet3"  and "vnetlib -- remove aaaaaaaa vmnet3" will not work

If there is a pattern in this that makes sense and is logically justified, then let me know.

Yes it made me VERY confused in the beginning.

Other commands found:
"vnetlib -- set installpath drive\directory" will set this registry entry:
HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMnetlib
"InstallPath"="C:
LODR
ws651"

The actual meaning of this key is unknown to me. Similarly is  vnetlib.exe also reading a LogLevel key from the same place, but that  one is also not figured out.

Attached is a little kit with scripts that will collect the necessary  files to let you play with these services on a testbox. It will not  require an installation of Workstation, just a few binaries. Different  batches are included as well as registry patches to setup the  environment. Some modified inf files included too.

Hopefully others will comment on and add more information to this.

TODO - what is not resolved yet:

  • Install usb directly with vnetlib.
  • Figure out usage of possible commands like; team, unteam, bridge, unbridge, garp, ungarp, connect, disconnect...


Joakim

This document was generated from the following thread: Vnetlib - Documenting some more

Attachments
Comments

Does this work with Player as well?

Yes, vnetlib is also shipped with player.

Version history
Revision #:
1 of 1
Last update:
‎02-23-2009 09:34 PM
Updated by: