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>
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!
ifconfig net1 addif 10.10.11.3 netmask 255.255.255.0 zone srvdbt up
Created new logical interface net1:1
root@srvt7-2 # ifconfig aggr0 addif 10.10.40.3 netmask 255.255.255.0 zone srvdbt up
Created new logical interface aggr0:1