From c4fa7297af8ed16f9680c84cfcd0ee965e0d5927 Mon Sep 17 00:00:00 2001 From: mitty Date: Mon, 21 Jun 2010 03:38:42 +0000 Subject: [PATCH] * mkdir for vmware scripts * hotaddbridge from http://blog.hurricanelabs.com/2009/01/adding-vmware-bridge-interfaces-while.html git-svn-id: https://lab.mitty.jp/svn/lab/vendor@40 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- vmware/hotaddbridge | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 vmware/hotaddbridge diff --git a/vmware/hotaddbridge b/vmware/hotaddbridge new file mode 100755 index 0000000..a79fe24 --- /dev/null +++ b/vmware/hotaddbridge @@ -0,0 +1,59 @@ +#!/bin/bash +############################################## +# Add VMWare Network Bridged devices hot +# +# Revisions +# J.Gargano - 2009-07-08 - 1.1 +# +############################################# + +echo "Locating Existing Devices" +for dev in $(ls /dev/vmnet*); +do +echo " Found $dev" +done +echo +printf "Please enter a device number that does not exist in this list: " +read num +# Check if it exists +if [ -f /dev/vmnet$num ];then +echo "/dev/vmnet$num exists! Exiting." +exit 1 +fi + + +# Select an interface +echo +echo "Locating interfaces to bridge" +for int in $(ifconfig |grep "^[a-z,A-Z]" |cut -d' ' -f1); +do +echo $int +done +printf "Please enter a interface: " +read interface + +# Check if it exists +ifconfig $interface >/dev/null 2>&1 +ret=$? +if [ $ret != 0 ];then +echo "Can't find interface. Exiting!" +exit 1 +fi + + +# Create device +echo "Creating device /dev/vmnet$num" +mknod /dev/vmnet$num c 119 $num + +# Add to vmware netmap configuration +# open netmap.conf and get next number in list +let nextnetnum=$(cat /etc/vmware/netmap.conf | tail -1 | cut -d'.' -f1 | sed -e s/network//)+1 + +echo "Adding network$nextnetnum to /etc/vmware/netmap.conf" + +echo "network$nextnetnum.name=\"$interface\"">> /etc/vmware/netmap.conf +echo "network$nextnetnum.device=\"vmnet$num\"">> /etc/vmware/netmap.conf + + +# Start Service +vmnet-bridge -d /var/run/vmnet-bridge-$num.pid -n $num -i $interface -- 1.7.9.5