tcreech.com

How to get lx zones to DHCP

By default, zadm sort of expects that zones will use static IP addresses.

These zones will still happily DHCP (e.g., with /native/sbin/ipadm) but only with create-addr -t. Without -t, it refuses:

zone# /native/sbin/ipadm create-addr -T  dhcp zone0/v4
ipadm: Could not create address: Persistent operation on temporary object

This is annoying because we want them to remember to DHCP permanently. To allow a permanent address, we must manually fix up the zone configuration with zonecfg:

global# zonecfg -z zone
zonecfg:zone> select net physical=zone0
zonecfg:zone:net> add property (name=ips,value=dhcp)
zonecfg:zone:net> add property (name=primary,value=true)

Alternatively, zadm accepts analagous attributes within a net resource:

"net" : [
   {
      "global-nic" : "stub0",
      "ips" : [
         "dhcp"
      ],
      "mac-addr" : "0:0:0f:0f:0f:0f",
      "physical" : "zone0",
      "primary" : "true"
   }
], ...