Fun with Crossbow

The Crossbow project is probably the most exciting new feature in OpenSolaris 2009.06. It a nutshell, project Crossbow brings virtualization to the networking layer. In this quick example I'm going to create a virtual network interface card (VNIC) and dynamically alter it's maximum bandwidth as traffic is flowing over it.

The VNIC must be linked to an actual network interface device. To see the existing devices on the system:

bleonard@opensolaris:~$ dladm show-phys
LINK         MEDIA                STATE      SPEED  DUPLEX    DEVICE
e1000g0      Ethernet             up         1000   full      e1000g0
iwh0         WiFi                 down       0      unknown   iwh0
vboxnet0     Ethernet             unknown    0      unknown   vboxnet0

The current device in use is e1000g0, so I'll create my VNIC over that device:

pfexec dladm create-vnic -l e1000g0 vnic0

View the new VNIC:

bleonard@opensolaris:~$ dladm show-vnic
LINK         OVER         SPEED  MACADDRESS           MACADDRTYPE         VID
vnic0        e1000g0      1000   2:8:20:e2:77:62      random              0

Note its speed matches that of the physical link. Let's reduce this from 1000 megabits/second to 2 megabits/second:

pfexec dladm set-linkprop -p maxbw=2 vnic0

Before the VNIC can be used, it must be plumbed:

pfexec ifconfig vnic0 plumb

And assigned an IP address. If you're using DHCP, the following will work:

pfexec ifconfig vnic0 dhcp start

Now you can see vnic0 using ifconfig:

bleonard@opensolaris:~$ ifconfig vnic0
vnic0: flags=1104843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,ROUTER,IPv4> mtu 1500 index 7
	inet 10.0.1.16 netmask ffffff00 broadcast 10.0.1.255

The VNIC has been assigned IP address 10.0.1.16 and is now ready for use. To test it out, we'll copy a large file from one host to another, over the VNIC. To test this on a single machine, use a virtual machine configured with bridged networking or a zone. From the other host:

bleonard@os200906:~$ mkfile 100M big-file
bleonard@os200906:~$ scp big-file bleonard@10.0.1.16:bile-file
The authenticity of host '10.0.1.16 (10.0.1.16)' can't be established.
RSA key fingerprint is f7:1d:2c:d7:24:e3:1c:57:53:0f:59:75:31:4a:0f:7d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.1.16' (RSA) to the list of known hosts.
Password: 
big-file               0% |                             |   128 KB    13:22 ETA

Notice it's estimated to take over 13 minutes to copy this file. While the file is being copied, back on the host machine, change the maxbw property to 1000 megabits / second:

pfexec dladm set-linkprop -p maxbw=1000 vnic0

Immedially you'll notice the copy operation speed up and quickly complete:

big-file             100% |\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*|   100 MB    00:37 

Very cool!

Comments:

Awesome!

Posted by Glynn Foster on June 29, 2009 at 10:28 PM GMT #

Er, great. But why?

Posted by guest on July 20, 2009 at 06:02 AM GMT #

I really like these small info notes you create to get started quickly on these things that show up in the new releases.

So today I was trying to simulate some network delays.. basically wanted to simulate the behavior of a WAN and couldn't get the speed to be lower than 1.2M, so maxbw=2 was the smallest I could use.

I read somewhere that it would be implemented in Crossbow v2 so I'm keeping my fingers crossed.

Posted by Sergio Schvezov on August 05, 2009 at 10:22 AM GMT #

Excellent article Brian!
Also just a small heads up...the vnic name in the dladm create-vnic command must end with a number. If you do not provide a number, you'll probably see an error which goes something like :

dladm: Invalid link name 'test'

Posted by Murali on March 26, 2010 at 09:24 PM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

The Observatory is a blog for users of Oracle Solaris. Tune in here for tips, tricks and more as we explore the Solaris operating system from Oracle.

Connect with Oracle Solaris:


Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
20
21
22
23
24
25
26
27
28
29
30
   
       
Today