VirtualBox

Opened 16 years ago

Closed 16 years ago

Last modified 14 years ago

#1498 closed defect (fixed)

vnic_setup.sh doesn't work on OpenSolaris => Fixed in 2.0.2

Reported by: Mark Shellenbaum Owned by:
Component: network Version: VirtualBox 1.6.0
Keywords: Cc:
Guest type: other Host type: Solaris

Description

On a system with OpenSolaris build 88 the vnic_setup.sh script fails

# ./vnic_setup.sh 08:00:27:c1:71:1f

Invalid link name: LINK

Change History (16)

comment:1 by Ramshankar Venkataraman, 16 years ago

Yes we're aware of this error and it's been fixed internally. Problem was with evolving Crossbow interfaces with newer Solaris releases.

comment:2 by Ramshankar Venkataraman, 16 years ago

The fix is to replace:

vnic_name=/usr/lib/vna $phys_nic $mac

with

vnic_name="vnic"/usr/lib/vna $phys_nic $mac

comment:3 by Mark Shellenbaum, 16 years ago

I don't think thats all that needs to be changed.

This line is also wrong

phys_nic=`/usr/sbin/dladm show-dev | /usr/bin/awk 'NF==7 && $3=="up" { print

$1 }'`

I think it should be

phys_nic=`/usr/sbin/dladm show-dev | /usr/bin/awk 'NF==4 && $2=="up" { print

$1 }'`

comment:4 by Ramshankar Venkataraman, 16 years ago

That works as it should. The output of dladm show-dev is :

# /usr/sbin/dladm show-dev wpi0 link: down speed: 0Mb duplex: unknown rge0 link: up speed: 100Mb duplex: full #

7 fields and we're interested in field 3.

in reply to:  4 comment:5 by Sean Walmsley, 16 years ago

Replying to ramshankar:

That works as it should. The output of dladm show-dev is :

# /usr/sbin/dladm show-dev wpi0 link: down speed: 0Mb duplex: unknown rge0 link: up speed: 100Mb duplex: full #

7 fields and we're interested in field 3.

On Solaris 10 8/07 "dladm show-dev" gives 7 fields as described by ramshankar, but on OpenSolaris 5/08 you get:

LINK STATE SPEED DUPLEX wpi0 down 0Mb unknown bge0 up 100Mb full

In other words, just as described by mshellenbaum.

comment:6 by Jay Galvin, 16 years ago

Just verified on OpenSolaris RC3, the line should read:

phys_nic=`/usr/sbin/dladm show-dev | /usr/bin/awk 'NF==4 && $2=="up" { print$1 }'`

I'm trying to run Windows XP in VB 1.6 on OpenSolaris RC3

Problem: When I use the vnic_setup.sh script from Virtual Box 1.6 
to set up Host Interface networking, it creates the following OpenSolaris 
virtual nic config:

root@gard03:~:>dladm show-link
LINK        CLASS    MTU    STATE    OVER
nge0        phys     1500   up       --
nge1        phys     1500   unknown  --
e1000g0     phys     1500   unknown  --
e1000g1     phys     1500   unknown  --
vnic0       vnic     1500   unknown  nge0

root@gard03:~:>ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
nge0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
        inet 10.6.141.90 netmask ff000000 broadcast 10.255.255.255
        ether 0:14:4f:cd:a5:b8
vnic0: flags=201000851<UP,POINTOPOINT,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 3
        inet 192.168.1.100 --> 192.168.1.200 netmask ffffff00
        ether 8:0:27:25:42:56
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
        inet6 ::1/128

It seems that this default addressing is unusable.  What values should 
be used here?  How do I control the IP Address assigned to vnic0.  I 
would think something like 10.6.141.91 --> 10.6.141.90 so that the vnic 
gets an address on the subnet and is reached via the physical address 
assigned to nge0.

Then, what do I do in Windows XP to use the vnic0?  Do I setup Windows 
to use DHCP or statically assign the allocated IP Address (in this 
example: 192.168.1.100)?  

Lot's of questions, not much documented..  :^(

comment:7 by jkeil, 16 years ago

It seems that VirtualBox 1.6.2 has a slightly updated vnic_setup.sh script for use with current OpenSolaris versions.

But apparently the script should test if phys_nic was set to a non-empty string after phys_nic=/usr/sbin/dladm show-dev | /usr/bin/awk 'NF==4 && $2=="up" { print $1 }'

    # Try obtain a physical NIC that is currently active
    phys_nic=`/usr/sbin/dladm show-dev | /usr/bin/awk 'NF==7 && $3=="up" { print $1 }'`
    if [ -z "$phys_nic" ]; then
        # Try obtain a physical NIC that is currently active
        phys_nic=`/usr/sbin/dladm show-dev | /usr/bin/awk 'NF==4 && $2=="up" { print $1 }'`
<<<< some test is missing here >>>>>
        # Failed to get a currently active NIC, get the first available NIC.
        phys_nic=`/usr/sbin/dladm show-link | /usr/bin/nawk '/legacy/ {next} {print $1; exit}'`
        if [ -z "$phys_nic" ]; then
            # Failed to get any NICs!
            echo "Failed to get a physical NIC to bind to."
            exit 1
        fi
    fi
# bash -x /opt/VirtualBox/vnic_setup.sh 00:11:22:33:44:55
+ '[' -z 00:11:22:33:44:55 ']'
+ mac=00:11:22:33:44:55
+ '[' -z '' ']'
++ /usr/sbin/dladm show-dev
++ /usr/bin/awk 'NF==7 && $3=="up" { print $1 }'
+ phys_nic=
+ '[' -z '' ']'
++ /usr/sbin/dladm show-dev
++ /usr/bin/awk 'NF==4 && $2=="up" { print $1 }'
+ phys_nic=nge0
++ /usr/sbin/dladm show-link
++ /usr/bin/nawk '/legacy/ {next} {print $1; exit}'
+ phys_nic=LINK
+ '[' -z LINK ']'
++ /usr/lib/vna LINK 00:11:22:33:44:55
Invalid link name: LINK
+ vnic_name=vnic
+ '[' 255 '!=' 0 ']'
+ exit 1

Ok, fixing this isn't that difficult. But there is a new problem now; on snv_92 (probably since snv_83, see bug 6647697) I get

# bash -x /opt/VirtualBox/vnic_setup.sh-new 00:11:22:33:44:55
+ '[' -z 00:11:22:33:44:55 ']'
+ mac=00:11:22:33:44:55
+ '[' -z '' ']'
++ /usr/sbin/dladm show-dev
++ /usr/bin/awk 'NF==7 && $3=="up" { print $1 }'
+ phys_nic=
+ '[' -z '' ']'
++ /usr/sbin/dladm show-dev
++ /usr/bin/awk 'NF==4 && $2=="up" { print $1 }'
+ phys_nic=nge0
+ '[' -z nge0 ']'
++ /usr/lib/vna nge0 00:11:22:33:44:55
+ vnic_name=vnicvnic4
+ '[' 0 '!=' 0 ']'
+ vnic_id=4
+ '[' 4 -lt 10 ']'
+ host_ip=192.168.1.104
+ guest_ip=192.168.1.204
+ netmask=255.255.255.0
+ '[' -z '' ']'
+ /sbin/ifconfig vnicvnic4 plumb
ifconfig: cannot open link "vnicvnic4": DLPI link does not exist
+ /sbin/ifconfig vnicvnic4 192.168.1.104 destination 192.168.1.204 netmask 255.255.255.0 up
ifconfig: SIOCGLIFNETMASK: vnicvnic4: no such interface
+ echo vnicvnic4
vnicvnic4
+ exit 0

/usr/lib/vna returns the vnic interface name now, in the past it just returned the vnic id...

I've changed it like this:

--- /opt/VirtualBox/vnic_setup.sh~	Di Jun 10 14:19:21 2008
+++ /opt/VirtualBox/vnic_setup.sh	Di Jun 10 14:46:29 2008
@@ -33,24 +33,32 @@
     if [ -z "$phys_nic" ]; then
         # Try obtain a physical NIC that is currently active
         phys_nic=`/usr/sbin/dladm show-dev | /usr/bin/awk 'NF==4 && $2=="up" { print $1 }'`
-        # Failed to get a currently active NIC, get the first available NIC.
-        phys_nic=`/usr/sbin/dladm show-link | /usr/bin/nawk '/legacy/ {next} {print $1; exit}'`
-        if [ -z "$phys_nic" ]; then
-            # Failed to get any NICs!
-            echo "Failed to get a physical NIC to bind to."
-            exit 1
+	if [ -z "$phys_nic" ]; then
+	    # Failed to get a currently active NIC, get the first available NIC.
+	    phys_nic=`/usr/sbin/dladm show-link | /usr/bin/nawk '/legacy/ {next} {print $1; exit}'`
+	    if [ -z "$phys_nic" ]; then
+		# Failed to get any NICs!
+		echo "Failed to get a physical NIC to bind to."
+		exit 1
+	    fi
         fi
     fi
 
     # To use a specific physical NIC, replace $phys_nic with the name of the NIC.
-    vnic_name="vnic"`/usr/lib/vna $phys_nic $mac`
+    vnic_name=`/usr/lib/vna $phys_nic $mac`
     if [ $? != 0 ]; then
         exit 1
     fi
+    case $vnic_name in
+    vnic[0-9]*)
+	;;
+    *)
+	vnic_name="vnic$vnic_name";;
+    esac
 else
     vnic_name=$2
 fi
-vnic_id=${vnic_name##*[a-z]}
+vnic_id=`echo $vnic_name | sed 's/^[a-z][a-z]+//'`
 
 if [ ${vnic_id} -lt 10 ]; then
     host_ip="192.168.1.10${vnic_id}"

Now the next problem is: only root is allowed to use dladm show-dev, etc... Well. ok, I can run virtualbox when su'ed to root.

Running with root permissions gets me to this error popup:

Failed to open VNIC "vnic2" in raw mode.
VBox status code: -3100 (VERR_HOSTIF_INIT_FAILED).


Fehlercode:
0x80004005
Komponente:
Console
Interface:
IConsole {d5a1cbda-f5d7-4824-9afe-d640c94c7dcf}

in reply to:  7 comment:8 by jkeil, 16 years ago

Replying to jkeil:

Running with root permissions gets me to this error popup:

Failed to open VNIC "vnic2" in raw mode.
VBox status code: -3100 (VERR_HOSTIF_INIT_FAILED).


Fehlercode:
0x80004005
Komponente:
Console
Interface:
IConsole {d5a1cbda-f5d7-4824-9afe-d640c94c7dcf}

Oops, that part isn't correct. When running everything as user root (and using the patched vnic_setup.sh script), virtualbox *is* able to open the vnic.

(What didn't work what a hack to use setuid root scripts for vnic_setup.sh and vnic_term.sh; while this does setup the new vnic, virtualbox is unable to open it)

comment:9 by Ramshankar Venkataraman, 16 years ago

Making a script with setuid has no effect.

Regarding the ever changing vna/vnic issues, we are working with the concerned teams and persons to have this sorted out. We are hoping to shield VirtualBox and possibly Xen from these subtle changes. Because the change is propagates across teams and layers this is taking time but we will get there.

We trying to support various Nevada builds, Solaris 10 as well as OpenSolaris. We'll fix the scripts again to support the platforms but the real solution we are working will address all this cleanly. Stay tuned.

comment:10 by Akhilesh Mritunjai, 16 years ago

Please check the following thread:

http://www.opensolaris.org/jive/thread.jspa?threadID=63220

The script is trying to parse an output which is not meant to be in a stable format.

in reply to:  9 comment:11 by jkeil, 16 years ago

Replying to ramshankar:

Making a script with setuid has no effect.

That's why I replaced the bash specific syntax with standard bourne shell syntax, so that I could make vnic_setup.sh a /bin/sh script. When using #!/bin/sh -p as the interpreter, setuid works. But I removed those setuid hacks...

For now I solved the problem by adding this line to /etc/security/exec_attr, and starting virtualbox with "pfexec /opt/VirtualBox/VirtualBox":

Basic Solaris User:solaris:cmd:::/opt/VirtualBox/VirtualBox:privs=net_rawaccess,sys_net_config

comment:12 by Ramshankar Venkataraman, 16 years ago

We've now fixed the script to support older (pre 83 nevada builds) and the newer OpenSolaris2008.05 (snv_86) builds and using the parsing format. Thanks for reporting the breakage with the newer builds.

comment:13 by hashampathan, 16 years ago

I am able get it working by following the below steps:

I am not using the script "vnic_setup.sh". I followed the manual interface creation steps.

ON THE HOST ( I have OpenSolaris 2008.05)

  1. /usr/lib/vna nge0 00:e0:81:5b:a8:a9 vnic1
  2. dladm show-link (vnic1 appears in the list)

-bash-3.2# dladm show-link LINK CLASS MTU STATE OVER nge0 phys 1500 up -- vnic1 vnic 1500 unknown nge0

  1. Plumb the VNIC

-bash-3.2# ifconfig vnic1 plumb

NOW I moved to Guest OS configuration( I have Solaris 10 05/08 as Guest OS)

Virtual Box GUI console, Guest OS Settings - Network section:

Select the Appropriate adopter type Attached to - Host Interface MAC Address - Used the same MAC address that was supplied in VNIC creation step Interface Name - vnic1 (from vnic creation step)

When I boot the guest os, it comes up with DHCP IP on my subnet. (Same subnet as my Host OS). Note that before I switched to Host Interface mode configuration, my Guest OS was configured to use NAT.

Now I am able to access Guest OS over the network.

HTH, Hasham

comment:14 by Frank Mehnert, 16 years ago

Host type: otherSolaris

comment:15 by Frank Mehnert, 16 years ago

Component: othernetwork

comment:16 by Frank Mehnert, 16 years ago

Resolution: fixed
Status: newclosed
Summary: vnic_setup.sh doesn't work on OpenSolarisvnic_setup.sh doesn't work on OpenSolaris => Fixed in 2.0.2
Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use