Skip to content

Instantly share code, notes, and snippets.

@citrus-it
Last active February 13, 2019 13:26
Show Gist options
  • Select an option

  • Save citrus-it/767a42755825d9dde6d0e8dfb331791f to your computer and use it in GitHub Desktop.

Select an option

Save citrus-it/767a42755825d9dde6d0e8dfb331791f to your computer and use it in GitHub Desktop.

On-demand VNICs in OmniOS

In this zone configuration:

  • test0 has a mac-address specified
  • test2 does not have a global-nic attribute configured, so it's a traditional VNIC that needs creating by hand in the GZ
  • test3 has a configured vlan
bloody# zonecfg -z test info net
net:
        address not specified
        allowed-address: 172.27.10.100/24
        defrouter: 172.27.10.254
        global-nic: vioif0
        mac-addr: 2:8:20:b8:7c:3f
        physical: test0
        vlan-id not specified
net:
        address not specified
        allowed-address not specified
        defrouter not specified
        global-nic: vioif0
        mac-addr not specified
        physical: test1
        vlan-id not specified
net:
        address not specified
        allowed-address not specified
        defrouter not specified
        global-nic not specified
        mac-addr not specified
        physical: test2
        vlan-id not specified
net:
        address not specified
        allowed-address not specified
        defrouter not specified
        global-nic: vioif0
        mac-addr not specified
        physical: test3
        vlan-id: 5
bloody# dladm create-vnic -l vioif0 test2
bloody# dladm show-vnic
LINK         OVER         SPEED  MACADDRESS        MACADDRTYPE         VID
test2        vioif0       1000   2:8:20:ca:9e:40   random              0
bloody# zoneadm -z test boot
  • test3 gets the assigned VLAN ID
  • test0 gets the configured MAC address
bloody# dladm show-vnic
LINK         OVER         SPEED  MACADDRESS        MACADDRTYPE         VID
test2        vioif0       1000   2:8:20:ca:9e:40   random              0
test0        vioif0       1000   2:8:20:b8:7c:3f   fixed               0
test1        vioif0       1000   2:8:20:32:55:db   random              0
test3        vioif0       1000   2:8:20:e1:7b:d3   random              5

Note that mac addresses have now been saved so that they will persist over zone reboots.

bloody# zonecfg -z test info net | egrep '(net|mac-addr|physical):'
net:
        mac-addr: 2:8:20:b8:7c:3f
        physical: test0
net:
        physical: test2
net:
        mac-addr: 2:8:20:32:55:db
        physical: test1
net:
        mac-addr: 2:8:20:e1:7b:d3
        physical: test3

On-demand VNICs are removed on zone halt

bloody# zoneadm -z test halt
bloody# dladm show-vnic
LINK         OVER         SPEED  MACADDRESS        MACADDRTYPE         VID
test2        vioif0       1000   2:8:20:ca:9e:40   random              0

On the next boot, all on-demand VNICs have a fixed MAC address.

bloody# zoneadm -z test boot
bloody# dladm show-vnic
LINK         OVER         SPEED  MACADDRESS        MACADDRTYPE         VID
test2        vioif0       1000   2:8:20:ca:9e:40   random              0
test0        vioif0       1000   2:8:20:b8:7c:3f   fixed               0
test1        vioif0       1000   2:8:20:32:55:db   fixed               0
test3        vioif0       1000   2:8:20:e1:7b:d3   fixed               5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment