source: lab.git/vmware/hotaddbridge @ 8ac2029

vendor
Last change on this file since 8ac2029 was c4fa729, checked in by mitty <mitty@…>, 14 years ago

git-svn-id: https://lab.mitty.jp/svn/lab/vendor@40 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

  • Property mode set to 100755
File size: 1.3 KB
RevLine 
[c4fa729]1#!/bin/bash
2##############################################
3# Add VMWare Network Bridged devices hot
4#
5# Revisions
6# J.Gargano - 2009-07-08 - 1.1
7#
8#############################################
9
10echo "Locating Existing Devices"
11for dev in $(ls /dev/vmnet*);
12do
13echo " Found $dev"
14done
15echo
16printf "Please enter a device number that does not exist in this list: "
17read num
18# Check if it exists
19if [ -f /dev/vmnet$num ];then
20echo "/dev/vmnet$num exists! Exiting."
21exit 1
22fi
23
24
25# Select an interface
26echo
27echo "Locating interfaces to bridge"
28for int in $(ifconfig |grep "^[a-z,A-Z]" |cut -d' ' -f1);
29do
30echo $int
31done
32printf "Please enter a interface: "
33read interface
34
35# Check if it exists
36ifconfig $interface >/dev/null 2>&1
37ret=$?
38if [ $ret != 0 ];then
39echo "Can't find interface. Exiting!"
40exit 1
41fi
42
43
44# Create device
45echo "Creating device /dev/vmnet$num"
46mknod /dev/vmnet$num c 119 $num
47
48# Add to vmware netmap configuration
49# open netmap.conf and get next number in list
50let nextnetnum=$(cat /etc/vmware/netmap.conf | tail -1 | cut -d'.' -f1 | sed -e s/network//)+1
51
52echo "Adding network$nextnetnum to /etc/vmware/netmap.conf"
53
54echo "network$nextnetnum.name=\"$interface\"">> /etc/vmware/netmap.conf
55echo "network$nextnetnum.device=\"vmnet$num\"">> /etc/vmware/netmap.conf
56
57
58# Start Service
59vmnet-bridge -d /var/run/vmnet-bridge-$num.pid -n $num -i $interface
Note: See TracBrowser for help on using the repository browser.