VNICDemo

Crossbow Demo (5 Minutes)

Description

This demos shows how to create a virtual network interface card (NIC) which has the characteritics as a physical NIC, plus more.

OpenSolaris Versions Supported

2009.06

Points to Hit

With OpenSolaris 2009.06, virtualization has expanded to the network. This allows you to better take advantage of other virtualization technologies such as containers.

Demo Prep

  • None

Gotchas

  • Crossbow and NWAM don't play nice together (see nwam should be able to manage vnic, vlan, and aggr links). It's not that big of a deal, but after a reboot you may find that VINCs you've created now longer show up when you run dladm show-link. However, when you attempt to create a VNIC it fails because the object already exists? What gives? It's just that the VNIC was not brought up by NWAM. To see the list of vnics on your machine use dladm show-link -P. You can then bring them up using dladm up-vnic <vnic>.
  • This demo works best if you have a wired ethernet connection. If not, your link speed will show up as 0.

Demo

  • Look at the physical network interfaces on the machine:
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

* Use one of the physical interfaces to create a virtual interface, replacing e1000g0 with your LINK (adapter) name:

pfexec dladm create-vnic -l e1000g0 vnic0

* Show the new vitrual interface:

bleonard@opensolaris:~$ dladm show-vnic
LINK         OVER         SPEED  MACADDRESS           MACADDRTYPE         VID
vnic0        e1000g0      1000   2:8:20:73:7e:fb      random              0

* Notice it's SPEED matches that of the physical NIC. Say we wanted to limit the bandwitdh on that NIC:

pfexec dladm set-linkprop -p maxbw=400m vnic0

* View the VNIC again:

bleonard@opensolaris:~$ dladm show-vnic
LINK         OVER         SPEED  MACADDRESS           MACADDRTYPE         VID
vnic0        e1000g0      400    2:8:20:73:7e:fb      random              0

* If you run ifconfig -a, you'll notice the new VNIC doesn't appear in the output. That's because it needs to be plumbed:

pfexec ifconfig vnic0 plumb

* Then you need to assign it an IP address. If you're using DHCP:

pfexec ifconfig vnic0 dhcp start

     To set a static IP address:

pfexec ifconfig vnic0 <ip address>
pfexec ifconfig vnic0 up

* Now the VNIC will appear in ipconfig.

  • In addition to 'dladm show-phys' and 'dladm show-vnic', you can run 'dladm show-link' to see all links:
bleonard@opensolaris:~$ dladm show-link
LINK        CLASS    MTU    STATE    OVER
e1000g0     phys     1500   up       --
iwh0        phys     1500   down     --
vboxnet0    phys     1500   unknown  --
vnic0       vnic     1500   up       e1000g0

* Now you can use the VNIC like any other NIC - assign it to a virtual machine (beware of this issue with VirtualBox) or a container...

Testing the VNIC
  • Create a 100MB file
mkfile 100M big-file

* Set the link speed to 2MB / Second

pfexec dladm set-linkprop -p maxbw=2 vnic0

* Copy the file over the VNIC (do this from a virtual machine configured with bridged networking - for some reason the bandwidith isn't throttled when this is run locally):

pfexec scp big-file <user>@<ip address>:big-file

e.g.

bleonard@os200906:~$ scp big-file bleonard@10.0.1.14:big-file
Password:
big-file               2% |                             |  2560 KB    11:43 ETA

* Note the ETA of over 10 minutes. Change the maxbw property to 1000GB / Second and watch the speed dynamically increase:

pfexec dladm set-linkprop -p maxbw=1000 vnic0

* Back in the virtual machine:

bleonard@os200906:~$ scp big-file bleonard@10.0.1.14:big-file
Password:
big-file             100% |*****************************|   100 MB    00:45

What was initially estimated to take over 10 minutes took less than 1!

Demo Cleanup

These are the necessary steps to take in order to successfully run the demo again on the same machine.

  • Release the DHCP lease:
pfexec ifconfig vnic0 dhcp release

* Unplumb the interface:

pfexec ifconfig vnic0 unplumb

* Delete the VNIC:

pfexec dladm delete-vnic vnic0
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact