Solaris10

From aldeid
Jump to navigation Jump to search
DRAFT
This page is still a draft. Thank you for your understanding.

Working with zones

List zones

# zoneadm list -iv
  ID NAME             STATUS     PATH                           BRAND    IP    
   0 global           running    /                              native   shared

Create zone and add resources

Create a new zone (e.g. web-server-1):

# zonecfg -z web-server-1
zonecfg:web-server-1> create
zonecfg:web-server-1> set zonepath=/export/home/zones/web-server-1
zonecfg:web-server-1> set autoboot=true

Add the support for network:

zonecfg:web-server-1> add net
zonecfg:web-server-1:net> set address=192.168.100.55/24 
zonecfg:web-server-1:net> set defrouter=192.168.100.1
zonecfg:web-server-1:net> set physical=e1000g0
zonecfg:web-server-1:net> end

Check your configuration and commit:

zonecfg:web-server-1> verify
zonecfg:web-server-1> commit
zonecfg:web-server-1> exit

Install the zone:

# zoneadm -z web-server-1 install

Check that the zone has the status "installed"

# zoneadm list -iv
  ID NAME             STATUS     PATH                           BRAND    IP    
   0 global           running    /                              native   shared
   - web-server-1     installed  /export/home/zones/web-server-1 native   shared

Boot a zone

Start the zone:

# zoneadm -z web-server-1 boot

List the zones and check that the status is now "running"

# zoneadm list -iv
 ID NAME             STATUS     PATH                           BRAND    IP    
  0 global           running    /                              native   shared
  1 web-server-1     running    /export/home/zones/web-server-1 native   shared

Login to a zone

Once created, you should be able to connect to the zone by issuing:

# zlogin -C web-server-1

Uninstall and delete a zone

First halt the zone if running:

# zoneadm -z web-server-1 halt

Then uninstall and delete the zone:

# zoneadm -z web-server-1 uninstall
# zonecfg -z web-server-1 delete

Miscellaneous tasks

List network interfaces

# 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 web-server-1
        inet 127.0.0.1 netmask ff000000 
e1000g0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2
        inet 192.168.100.46 netmask ffffff00 broadcast 192.168.100.255
        ether 0:c:29:49:56:84 
e1000g0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        zone web-server-1
        inet 192.168.100.55 netmask ffffff00 broadcast 192.168.100.255

Restart ssh

# /lib/svc/method/sshd restart