Diary of a Lazy SysAdmin

Skip to: Content | Sidebar | Footer

Solaris – add network interface for a running zone

This will describe how to add a network interface to a running non-global zone, without having to reboot the zone. The new interface will persist between reboots. If you want to add an interface temporarily, you can do so by not modifying the zone configuration.

Note: This process is for shared-ip zones. I believe it is different for exclusive IP zones, but we don’t use those.

First you add the entry to the zone configuration. This is the part that lets it persist between reboots. This is done from the global zone:
zonecfg -z <ZONENAME>
add net
set address=<NEWIPADDRESS>
set physical=<PHYSICALNIC>

Now we have to manually add a new interface to the running zone. Do this from the global zone as well:

ifconfig <PHYSICALNIC> addif <NEWIPADDRESS> netmask <NEWNETMASK> zone <ZONENAME> up

Note: The ‘addif’ tells ifconfig to create a logical interface using the next available. So if you’ve got “e1000g0” and “e1000g0:1”, using addif will use “e1000g0:2”.

To remove the interface from a running zone you basically just reverse this. From the global zone, remove the interface. You must first determine which logical interface [alias] you wish to remove.

ifconfig <LOGICALIFACE> down
ifconfig <LOGICALIFACE> unplumb

Now the interface is no longer visible in the running zone.

If the interface is configured in the zone configuration, and you do not wish the interface to be re-created when the zone is rebooted, you must remove it from the zone’s configuration from the global zone. Conveniently enough this can be done with a single command:

zonecfg -z <ZONENAME> remove net address=<IPADDRESS>

That’s it. You’re done!


Comment from karn
Time October 26, 2009 at 11:50 am

The note is worth appreciating :

Comment from Eric
Time February 3, 2010 at 5:12 am

You save my day, thanks

Comment from Joaquin
Time October 15, 2010 at 9:26 am

Great note! Clean and clear!

Comment from Henrique
Time December 28, 2010 at 8:39 am

Thanks, Dude! I was ready to reboot the zone!

Comment from Ian
Time October 12, 2011 at 5:57 am

Very useful tid-bit :) Thank you!

Comment from Karn
Time February 9, 2012 at 10:21 am

Worth applause ! Very good for the newbei to the zones.

Comment from RK
Time May 21, 2013 at 2:32 pm

Thanks a lot dude…it really helped.

Comment from rjw
Time January 24, 2014 at 5:59 am

very useful reminder that you don’t have to reboot the zone when adding another address, yet it will come up thru the zonecfg automatically the next time the zone is booted. thanks.

Comment from Studia
Time July 8, 2014 at 9:40 am

It is truly a nice and helpful piece of information. I am glad that you
shared this useful information with us. Please stay
us informed like this. Thank you for sharing.

Comment from Mike
Time July 24, 2014 at 9:47 am

Thanks! Saved me from the dreaded zone reboot.

Comment from Nate
Time August 14, 2015 at 3:42 pm

Very useful and easy to follow explanation (which I couldn’t find elsewhere!) Thanks for having it available.

Comment from Matt Warner
Time January 24, 2017 at 11:42 am

The way to add an interface (without rebooting) to a zone and have it be exclusive to that zone is “dladm set-linkprop -t -p zone=zonename net1”

You still have to use zonecfg to make it persist across reboots.

Write a comment