For some configurations, you may need to set up more than one host-only network on the same host computer. You may, for example, want to have two virtual machines connected to one host-only network and at the same time have other virtual machines connected to another host-only network so the network traffic on each network is isolated from the other. Or you may want to test routing between two virtual networks. Or test a virtual machine with multiple network interface cards without using any physical Ethernet adapters.
On Linux hosts, the first host-only network was set up when you ran the vmware-config.pl script after you installed VMware Workstation, provided you agreed to install host-only networking. If you did not agree to use host-only networking, you need to run the script again to set up host-only networking.
To set up the second host-only network, follow the steps outlined below for your host operating system.
# Start the host-only network user service
vmware_start_hostonly() {
local vHubNr="$1" # IN
local vHostIf="$2" # IN
local ifIp="$3"# IN
local ifMask="$4" # IN
local run_dhcpd="$5" # IN
local run_samba="$6" # IN
local ifNet
#
# Do a cursory check to see if the host-only network
# configuration is still ok. We do this so that mobile
# hosts don't get setup at install time and then moved to
# a new locale where the host-only network config is no
# longer valid.
#
# NB: This really needs to be done at power-on time when
# VM is configured to use host-only networking so that
# we aren't fooled by dynamic changes in the network.
#
# XXX ping takes 10 seconds to timeout if noone answers;
# that slows boot too much so we do this bit in the
# background.
#
if lookForHostOnlyNetwork "$ifIp"; then
echo 'Host-only networking disabled because '"$ifIp"
echo 'appears to be a real, physical, existing address.'
echo 'Please run "'"$vmware_bin_dir"'/vmware-config.pl" to'
echo 'modify your host-only network configuration.'
exit 1
fi
vmware_start_netifup "$vHostIf" "$vHubNr" || exit 1
# Configure the virtual host Ethernet interface and define the private IP
# network
#
# . We provide the broadcast address explicitly because versions of ifconfig
# prior to 1.39 (1999-03-18) seem to miscompute it
# . 2.0.x kernels don't install a route when the interface is marked up, but
# 2.2.x kernel do. Since we want to see any errors from route we don't
# just discard messages from route, but instead check if the route got
# installed before manually adding one.
ifNet=`ipv4_subnet "$ifIp" "$ifMask"`
if ifconfig "$vHostIf" inet "$ifIp" netmask
"$ifMask" \
broadcast `ipv4_broadcast "$ifIp" "$ifMask"` up \
&& noRoutePresent "$ifNet" "$vHostIf"; then
route add -net "$ifNet" netmask "$ifMask"
"$vHostIf"
fi
if [ "$run_dhcpd" = 'yes' ]; then
vmware_start_dhcpd "$vHostIf" || exit 1
fi
if [ "$run_samba" = 'yes' ]; then
vmware_start_nmbd "$vHostIf" || exit 1
vmware_start_smbd "$vHostIf" || exit 1
fi
+# Enabling the vmnet2 interface
+ vHubNr=2 # IN
+ vHostIf=vmnet2 # IN
+ ifIp=192.168.225.1 # IN Whatever IP address you want for the vmnet2 interface
+ ifMask=255.255.255.0 # IN
+ vmware_start_netifup "$vHostIf" "$vHubNr" || exit 1
+ ifNet=`ipv4_subnet "$ifIp" "$ifMask"`
+ if ifconfig "$vHostIf" inet "$ifIp" netmask
"$ifMask" \
+ broadcast `ipv4_broadcast "$ifIp" "$ifMask"` up \
+ && noRoutePresent "$ifNet" "$vHostIf"; then
+ route add -net "$ifNet" netmask "$ifMask"
"$vHostIf"
+ fi
exit 0
}
**** And in the following ****
# Stop the host-only network user service
vmware_stop_hostonly() {
local vHostIf="$1" # IN
local ifIp="$2"# IN
local ifMask="$3" # IN
local ifNet
local ifPresent
# Terminate the private network
ifNet=`ipv4_subnet "$ifIp" "$ifMask"`
noRoutePresent "$ifNet" "$vHostIf" \
|| route del -net "$ifNet" netmask "$ifMask" || exit 1
# To test if the interface exists, we can not just look at the exitcode
# because old versions of ifconfig don't exit with 1 when invoked with a
# non-existing interface
ifPresent=`ifconfig "$vHostIf" 2>/dev/null`
if [ "$ifPresent" != '' ]; then
ifconfig "$vHostIf" down || exit 1
fi
vmware_stop_netifup "$vHostIf" || exit 1
+# Downing the vmnet2 interface
+ vHostIf=vmnet2 # IN
+ ifIp=192.168.225.1 # IN Whatever IP address you want for the vmnet2 interface
+ ifMask=255.255.255.0 # IN
+ ifPresent=`ifconfig "$vHostIf" 2>/dev/null`
+ if [ "$ifPresent" != '' ]; then
+ ifconfig "$vHostIf" down || exit 1
+ fi
+ vmware_stop_netifup "$vHostIf" || exit 1
exit 0
}
This creates the second host-only interface.
Now you have two host-only interfaces (VMnet1 and VMnet2). You are ready to configure your virtual machines for one of the following scenarios:
Scenario 1 Connect to the Default Host-Only Interface
Scenario 2 Connect to the Newly Created Host-Only Interface
Scenario 3 Connect to Two Host-Only Interfaces
At this point you can power on the virtual machine and install your guest operating system. In scenarios 1 and 2 you should see one AMD PCNet Family Adapter. In scenario 3 you should see two AMD PCNet Family Adapters within the guest operating system. Configure the virtual network adapters as you would configure physical adapters on a physical computer, giving each an IP address on the appropriate VMnet subnet.
To find out the network address for your virtual private network, you can run the following command from a shell window:
>ifconfig
© 2002 VMware, Inc. All rights reserved.