It isn't possible to run multiple VMWare instances with the current port (at least not with networking) - starting the second one fails with: Could not open /dev/vmnet1: Device or resource busy Failed to configure ethernet0. From some experimentation and source browsing, it seems that the only problem is that each instance needs its own vmnet interface. This is a limitation of course, but I think it's acceptable - however the config and start script can't deal with it. Fix: The patches below extend the per-vmnet config of IP address and netmask that is already in /usr/local/etc/vmware/config, making also "Bridged" and "BridgeInterface" be per-vmnet parameters, and make the start script set up as many vmnet interfaces as specified, in the appropriate mode. For bridged mode, a single bridge per physical BridgeInterface is created, connecting the BridgeInterface and those vmnet interfaces that specify that BridgeInterface. Additionally the VMWare config must specify "Custom" and "/dev/vmnetN" for the Ethernet Adapter of those instances that won't be using vmnet1. Also the arguably inappropriate and in some cases problematic setting of an IP address on vmnet devices that are in a bridge was removed - whether this (and in particular the method used) works may be ${OSVERSION}-dependant (it works fine on 5.2.1-RELEASE), in which case the VMNET_ADDR_ON_BRIDGED_INTERFACE setting in the Makefile can be appropriately conditionalized. Also the on-the-fly creation of vmnet interfaces will surely not work in pre-devfs releases - but the "standard" setup/config done at port install time is not dependant on that, it is only needed when the user actually adds additional vmnet interfaces in the config file (via manual editing). The port install setup will produce a config that is functionally equivalent to what is done without the patches, modulo the VMNET_ADDR_ON_BRIDGED_INTERFACE thing. With this, I have successfully run 4 networked VMWare instances simultaneously, two bridged and two non-bridged, with this config file: vmware.fullpath = "/usr/local/lib/vmware/bin/vmware" wizard.fullpath = "/usr/local/lib/vmware/bin/vmware-wizard" dhcpd.fullpath = "/usr/local/lib/vmware/bin/vmnet-dhcpd" loop.fullpath = "/usr/local/lib/vmware/bin/vmware-loop" libdir = "/usr/local/lib/vmware" vmnet1.Bridged = "NO" vmnet1.BridgeInterface = "" vmnet1.HostOnlyAddress = "172.31.254.1" vmnet1.HostOnlyNetMask = "255.255.255.240" vmnet2.Bridged = "NO" vmnet2.BridgeInterface = "" vmnet2.HostOnlyAddress = "172.31.254.17" vmnet2.HostOnlyNetMask = "255.255.255.240" vmnet3.Bridged = "YES" vmnet3.BridgeInterface = "em0" vmnet3.HostOnlyAddress = "192.168.0.1" vmnet3.HostOnlyNetMask = "255.255.255.0" vmnet4.Bridged = "YES" vmnet4.BridgeInterface = "em0" vmnet4.HostOnlyAddress = "192.168.0.1" vmnet4.HostOnlyNetMask = "255.255.255.0" Resulting network config: # ifconfig em0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500 options=3<RXCSUM,TXCSUM> inet 192.168.128.49 netmask 0xffffff00 broadcast 192.168.128.255 ether 00:0c:f1:de:9e:c0 media: Ethernet autoselect (100baseTX <full-duplex>) status: active plip0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500 lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 inet 127.0.0.1 netmask 0xff000000 vmnet1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet 172.31.254.1 netmask 0xfffffff0 broadcast 172.31.254.15 ether 00:bd:70:05:00:01 Opened by PID 949 vmnet2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet 172.31.254.17 netmask 0xfffffff0 broadcast 172.31.254.31 ether 00:bd:71:05:00:02 Opened by PID 2011 vmnet3: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500 ether 00:bd:73:05:00:03 Opened by PID 950 vmnet4: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500 ether 00:bd:7e:05:00:04 Opened by PID 2019 # ngctl list There are 7 total nodes: Name: ngctl50429 Type: socket ID: 00000021 Num hooks: 0 Name: vmnet_bridge1 Type: bridge ID: 00000016 Num hooks: 4 Name: vmnet4 Type: ether ID: 0000000e Num hooks: 1 Name: vmnet3 Type: ether ID: 00000004 Num hooks: 1 Name: vmnet2 Type: ether ID: 00000003 Num hooks: 0 Name: vmnet1 Type: ether ID: 00000002 Num hooks: 0 Name: em0 Type: ether ID: 00000001 Num hooks: 2 # ngctl show vmnet_bridge1: Name: vmnet_bridge1 Type: bridge ID: 00000016 Num hooks: 4 Local hook Peer name Peer type Peer ID Peer hook ---------- --------- --------- ------- --------- link3 vmnet4 ether 0000000e lower link2 vmnet3 ether 00000004 lower link1 em0 ether 00000001 upper link0 em0 ether 00000001 lower How-To-Repeat: Start a networked VMWare instance. Start one more.
Addendum regarding the "removed setting of IP address on vmnet devices that are in a bridge": With some more experimenting, I found that the requirement for this to work isn't actually the OS version, but the fact that you use "Custom" + "/dev/vmnetN" in the VMWare ethernet config. If you leave it at "Host Only" for vmnet1, VMWare (the binary) requires that an IP address is configured. Since this will be very confusing for a user that doesn't care about the possibility of having multiple instances, but just sets up a single, bridged one via the default port build/install, the VMNET_ADDR_ON_BRIDGED_INTERFACE=NO setting is a bad idea. The patches below (to be applied on top of the others) revert the default to the previous behaviour, and allow for the "no IP address" in a different way: If the config file specifies 0.0.0.0 as the HostOnlyAddress for a bridged interface, it will end up without an IP address configured. --Per Hedeland per@hedeland.org --- /usr/ports/emulators/vmware3/Makefile.ORIG Thu Jul 1 17:49:51 2004 +++ /usr/ports/emulators/vmware3/Makefile Thu Jul 1 21:18:00 2004 @@ -68,8 +68,6 @@ VMNET1_MINOR= 0x00800001 .endif -VMNET_ADDR_ON_BRIDGED_INTERFACE= NO - SCRIPTS_ENV+= LINUXBASE="${LINUXBASE}" \ VMNET_HOST_IP="${VMNET_HOST_IP}" \ VMNET_NETMASK="${VMNET_NETMASK}" \ @@ -145,7 +143,6 @@ ${SED} -e 's;@@PREFIX@@;${PREFIX};' \ -e 's;@@LINUXBASE@@;${LINUXBASE};' \ -e 's;@@NETWORKING@@;${VMNET_NETWORKING};' \ - -e 's;@@ADDR_BRIDGE_IF@@;${VMNET_ADDR_ON_BRIDGED_INTERFACE};' \ ${FILESDIR}/001.vmware.sh > ${WRKDIR}/001.vmware.sh ${SED} -e 's;@@PREFIX@@;${PREFIX};' \ --- /usr/ports/emulators/vmware3/files/001.vmware.sh.ORIG Thu Jul 1 17:49:51 2004 +++ /usr/ports/emulators/vmware3/files/001.vmware.sh Thu Jul 1 21:17:59 2004 @@ -24,7 +24,6 @@ vmware=`vmware_config vmware.fullpath` vmware_libdir=`vmware_config libdir` networking=@@NETWORKING@@ -addr_on_bridge_if=@@ADDR_BRIDGE_IF@@ dev_vmnet1=/dev/vmnet1 if [ ! -x $vmware ]; then @@ -65,7 +64,7 @@ echo -n > /dev/$vmnet 2>&1 ifconfig $vmnet $host_ip netmask $netmask if [ X$bridged = XYES ]; then - if [ X$addr_on_bridge_if = XNO ]; then + if [ X$host_ip = X0.0.0.0 ]; then # XXX Still need to configure + delete to make it RUNNING ifconfig $vmnet delete $host_ip fi @@ -111,7 +110,7 @@ host_ip=`vmware_config $vmnet.HostOnlyAddress` ifconfig $vmnet down if [ X$bridged = XYES ]; then - if [ X$addr_on_bridge_if = XYES ]; then + if [ X$host_ip != X0.0.0.0 ]; then ifconfig $vmnet delete $host_ip fi bridge_interface=`vmware_config $vmnet.BridgeInterface`
State Changed From-To: open->feedback To the maintainer: do you approve or disapprove of these changes?
Responsible Changed From-To: freebsd-ports-bugs->emulation Over to the mailing list.
As far as I am concerned, this PR can be closed now, since the requested changes (with some modifications and additions) have been committed. --Per Hedeland per@hedeland.org
State Changed From-To: feedback->closed Submitter said changes have been committed. Thanks for your submission!