Updated 22 March 2010
Linux Logo

Changing Zone Network Parameters


Description:
  • This procedure describes how to modify the network parameters of an existing zone configuration
Prerequisites:
  • Access to the global zone server. Zone must be configured and Installed.
Notes:
  • The network parameters can be changed without halting the zone. But they will only take affect if the zone is rebooted.
  • To use any network interface with a local zone, the interface must be plumbed (e.g. ifconfig <interface> plumb) in the global zone. If no network is assigned on the global zone to an existing network, its default address will be inet 0.0.0.0 netmask 0.
References:

Step Action Description
1 Use zoneadm list on the global zone server to show status of zone
# /usr/sbin/zoneadm list -vc

On the global zone, use the zoneadm list -cv to show current status of all installed zones.

global# zoneadm list -cv
  ID NAME             STATUS         PATH                          
   0 global           running        /                             
   1 myzone           running        /zones/myzone                 
   - test             configured     /zones/test                   
global# 
Note: You may also use /usr/sbin/zoneadm -z <zone name> list -v to verify the specific zone status.
2 Use zonecfg -z <zone name> to enter the zone modifying environment
# zonecfg -z <zone name>

On the global zone, use the /usr/sbin/zonecfg -z <zone name> to enter the zone configuration environment. The enviromental prompt "zonecfg:<zone name>" will display.

Use info in the zone configuration environment to verify the network values.

global# zonecfg -z myzone
zonecfg:myzone> info
zonepath: /zones/myzone
autoboot: true
pool: 
inherit-pkg-dir:
        dir: /lib
inherit-pkg-dir:
        dir: /platform
inherit-pkg-dir:
        dir: /sbin
inherit-pkg-dir:
        dir: /usr
net:
        address: 192.168.3.44/24
        physical: hme0
        defrouter: 255.255.255.0
zonecfg:myzone>
3 Use set address=<value> and set physical=<value> to change the network address and physical interface.
zonecfg:myzone:net> set address=<value>
zonecfg:myzone:net> set physical=<value>

First add net ant then use set address=<value>, set physical=<value> and set defrouter=<value> in the zone configuration environment .

zonecfg:myzone> add net 
zonecfg:myzone:net> set address=192.168.3.129/24
zonecfg:myzone:net> set physical=hme1
zonecfg:myzone:net> set defrouter=255.255.255.0
zonecfg:myzone:net> info
net:
        address: 192.168.3.129/24
        physical: hme1
        defrouter: 255.255.255.0
zonecfg:myzone:net> end
zonecfg:myzone> verify
zonecfg:myzone> info
zonepath: /zones/myzone
autoboot: true
pool: 
inherit-pkg-dir:
        dir: /lib
inherit-pkg-dir:
        dir: /platform
inherit-pkg-dir:
        dir: /sbin
inherit-pkg-dir:
        dir: /usr
net:
        address: 192.168.3.44/24
        physical: hme0
        defrouter: 255.255.255.0
net:
        address: 192.168.3.129/24
        physical: hme1
        defrouter: 255.255.255.0
zonecfg:myzone> remove net address=192.168.3.44/24
zonecfg:myzone> info
zonepath: /zones/myzone
autoboot: true
pool: 
inherit-pkg-dir:
        dir: /lib
inherit-pkg-dir:
        dir: /platform
inherit-pkg-dir:
        dir: /sbin
inherit-pkg-dir:
        dir: /usr
net:
        address: 192.168.3.129/24
        physical: hme1
        defrouter: 255.255.255.0
zonecfg:myzone> commit
zonecfg:myzone>

The zone does not require a reboot for this parameter to take place as the zone will use the new value if it is halted.

Note:
  • If you set the autoboot resource property in a zone’s configuration to true, that zone is automatically booted when the global zone is booted. The default setting is false.
  • for the zones to autoboot, the zones service svc:/system/zones:default must also be enabled.
4 Use remove net address=<value> to remove the old network values.
zonecfg:myzone> remove net address=<value> Use exit in the environment to save the changes and leave the zone configuration environment.
zonecfg:myzone> info
zonepath: /zones/myzone
autoboot: true
pool: 
inherit-pkg-dir:
        dir: /lib
inherit-pkg-dir:
        dir: /platform
inherit-pkg-dir:
        dir: /sbin
inherit-pkg-dir:
        dir: /usr
net:
        address: 192.168.3.44/24
        physical: hme0
net:
        address: 192.168.3.129/24
        physical: hme1
zonecfg:myzone> remove net address=192.168.3.44/24
zonecfg:myzone> info
zonepath: /zones/myzone
autoboot: true
pool: 
inherit-pkg-dir:
        dir: /lib
inherit-pkg-dir:
        dir: /platform
inherit-pkg-dir:
        dir: /sbin
inherit-pkg-dir:
        dir: /usr
net:
        address: 192.168.3.129/24
        physical: hme1
zonecfg:myzone> commit
zonecfg:myzone>
Note:

Performing either
remove net address=<value>
or
remove net physical=<value>
will delete both network parameters. You do not nor can you perform both command after you have issue one of them.

5 Use commit and exit to save the changes to the parameter
zonecfg:<zone name> commit
zonecfg:<zone name> exit
Use commit and exit in the environment to save the changes and leave the zone configuration environment.
zonecfg:myzone> verify
zonecfg:myzone> commit
zonecfg:myzone> exit
global#
Use zoneadm -z <zone name> halt followed by zoneadm -z <zone name> boot
# zoneadm -z myzone halt
# zoneadm -z myzone boot

The new entwork parameters will not be enabled until the zone is booted. Use zoneadm -z <zone name> halt the zone. Then use zoneadm -z <zone name> boot to start the zone with the new network parameters.

global# zoneadm -z myzone halt
global# zoneadm -z myzone boot
global# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000 
lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        zone myzone
        inet 127.0.0.1 netmask ff000000 
hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.3.8 netmask ffffff00 broadcast 192.168.3.255
        ether 8:0:20:b6:b:f7 
hme0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        zone myzone
        inet 192.168.3.44 netmask ffffff00 broadcast 192.168.3.255
hme1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 192.168.3.199 netmask ffffff00 broadcast 192.168.3.255
        ether 8:0:20:a3:f:8c 
global# zoneadm -z myzone halt
global#  ifconfig -a           
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000 
hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.3.8 netmask ffffff00 broadcast 192.168.3.255
        ether 8:0:20:b6:b:f7 
hme1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 192.168.3.199 netmask ffffff00 broadcast 192.168.3.255
        ether 8:0:20:a3:f:8c 
global#  zoneadm -z myzone boot
global# bash-3.00# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000 
lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        zone myzone
        inet 127.0.0.1 netmask ff000000 
hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.3.8 netmask ffffff00 broadcast 192.168.3.255
        ether 8:0:20:b6:b:f7 
hme1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 192.168.3.199 netmask ffffff00 broadcast 192.168.3.255
        ether 8:0:20:a3:f:8c 
hme1:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        zone myzone
        inet 192.168.3.129 netmask ffffff00 broadcast 192.168.3.255
global# 
Click for more info