Last change
on this file since 5822 was 5719, checked in by vboxsync, 17 years ago |
Solaris crossbow: allow using existing interfaces.
|
-
Property svn:eol-style
set to
LF
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Revision Id
|
File size:
1.2 KB
|
Line | |
---|
1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # VirtualBox VNIC setup script for Solaris hosts with Crossbow.
|
---|
4 |
|
---|
5 | if [ -z "$1" ]; then
|
---|
6 | echo "Missing MAC address."
|
---|
7 | echo
|
---|
8 | echo "Usage: $0 macaddress [vnicname]"
|
---|
9 | echo " A new VNIC is created if no vnicname is provided."
|
---|
10 | exit 1
|
---|
11 | fi
|
---|
12 |
|
---|
13 | vnic_id=0
|
---|
14 | vnic_name=""
|
---|
15 | mac=$1
|
---|
16 |
|
---|
17 | # Create the VNIC if required
|
---|
18 | if [ -z "$2" ]; then
|
---|
19 | vnic_id=`/usr/lib/vna iprb0 $mac`
|
---|
20 | if [ $? != 0 ]; then
|
---|
21 | exit 1
|
---|
22 | fi
|
---|
23 | vnic_name=vnic${vnic_id}
|
---|
24 | else
|
---|
25 | vnic_name=$2
|
---|
26 | vnic_id=${vnic_name##*[a-z]}
|
---|
27 | fi
|
---|
28 |
|
---|
29 | if [ ${vnic_id} -lt 10 ]; then
|
---|
30 | host_ip="192.168.1.10${vnic_id}"
|
---|
31 | guest_ip="192.168.1.20${vnic_id}"
|
---|
32 | elif [ ${vnic_id} -lt 256 ]; then
|
---|
33 | host_ip="192.168.1.${vnic_id}"
|
---|
34 | guest_ip="192.168.2.${vnic_id}"
|
---|
35 | elif [ ${vnic_id} -gt 899 ]; then
|
---|
36 | let "temp_id = $vnic_id % 900"
|
---|
37 | host_ip="192.168.1.10${temp_id}"
|
---|
38 | guest_ip="192.168.1.20${temp_id}"
|
---|
39 | else
|
---|
40 | # VNIC ID is probably off the scale!
|
---|
41 | host_ip="192.168.1.10"
|
---|
42 | guest_ip="192.168.1.20"
|
---|
43 | fi
|
---|
44 |
|
---|
45 | netmask="255.255.255.0"
|
---|
46 |
|
---|
47 | if [ -z "$2" ]; then
|
---|
48 | /sbin/ifconfig $vnic_name plumb
|
---|
49 | /sbin/ifconfig $vnic_name $host_ip destination $guest_ip netmask $netmask up
|
---|
50 | #else
|
---|
51 | # Do existing VNIC configuration here if needed...
|
---|
52 | fi
|
---|
53 |
|
---|
54 | echo "$vnic_name"
|
---|
55 | exit $?
|
---|
56 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.