Create a VNIC on Solaris Nevada (Solaris Express) Builds, and Use It for an Exclusive IP Stack in Zones

Given that I discovered quite a while ago that you can create vnic’s WITHOUT crossbow, in the early 80’s builds (b83+ appears to work), I decided today to try using the vnic’s for exclusive ip stacks in zones. The good news is, it works! The bad news is, besides already being unsupported (as this is Solaris Express), doing things like this is probably super, super unsupported.

So, lets do it.

Create a VNIC:

/usr/lib/vna <physicalAdapter> <fakeMacAddress>

You will get the vnic name returned as “vnic0″, then vnic1, and so on the more times you do this. Always use a different mac address of course, else, fail.

Create a new zone, and when configuring it, set the physical NIC to vnic0, and DO NOT set an address on it.

So, either type the commands below into zonecfg when creating a new zone:

# zonecfg -z <zoneName>
zonecfg:<zoneName>> set ip-type=exclusive
zonecfg:<zoneName>> add net
zonecfg:<zoneName>:net> set physical=vnic0
zonecfg:<zoneName>:net> end
zonecfg:<zoneName>> commit

OR remove the NIC config from an existing zone, and configure the new nic

zonecfg -z <zoneName> "remove net; set ip-type=exclusive; add net; set physical=vnic0; end"

Good to go - now boot the zone, and get on the zone console:

zlogin -C -e \# <zoneName>

Login as root, and then plumb the interface to verify it works:

ifconfig vnic0 plumb

And now, configure the zone like a regular Solaris 10 host, creating the /etc/hostname.vnic0 file, with a hostname in it, editing /etc/hosts, setting up /etc/resolv.conf, /etc/netmasks, /etc/defaultrouter and so on, and you should be good to go!

You may also wish to write a startup script that runs before the zones come up at boot, to avoid the zone boot failing. It will simply need to contain the /usr/lib/vna lines you used above to configure the vnic’s in the first place.

Leave a Reply