VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/solaris/vnicinit_solaris.sh@ 5822

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
5if [ -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
11fi
12
13vnic_id=0
14vnic_name=""
15mac=$1
16
17# Create the VNIC if required
18if [ -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}
24else
25 vnic_name=$2
26 vnic_id=${vnic_name##*[a-z]}
27fi
28
29if [ ${vnic_id} -lt 10 ]; then
30 host_ip="192.168.1.10${vnic_id}"
31 guest_ip="192.168.1.20${vnic_id}"
32elif [ ${vnic_id} -lt 256 ]; then
33 host_ip="192.168.1.${vnic_id}"
34 guest_ip="192.168.2.${vnic_id}"
35elif [ ${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}"
39else
40 # VNIC ID is probably off the scale!
41 host_ip="192.168.1.10"
42 guest_ip="192.168.1.20"
43fi
44
45netmask="255.255.255.0"
46
47if [ -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...
52fi
53
54echo "$vnic_name"
55exit $?
56
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette