Datenschutz
Home/IT/Solaris/Zones  

 

 

This page is about adding zones to a Solaris 10 x86 VMware machine.

Origin is a Solaris 10 x86 virtual machine which has one IDE hard disk attached as IDE 0:0 (c0d0). Add two hard disks of the same size as IDE 1:0 and IDE 1:1. The Solaris device tree must be reconfigured by adding -r to the kernel boot options in Grub. If you missed this one reboot with the -r option:

reboot -- -r

The Solaris zones will be mirrored over both new disks. Instead of dealing with legacy meta devices ZFS is used as the device manager.

zpool create zones mirror c1d0 c1d1

It might be useful to have an extra filesystem for sharing software or data to all zones.

zfs create zones/common
zfs set quota=4G zones/common
touch /zones/common/foo
touch /zones/common/bar

Before installing new Solaris zones their identities should be discussed. My existing VM fenny is in a vmnet8 NAT network. The new zones should be in the same network. This is my setup:

 


Existing (Global zone)New local zoneNew local zone
hostnamefennyfenny0fenny1
IPv4 address192.168.4.233192.168.4.234192.168.4.235
IPv4 gateway192.168.4.2192.168.4.2192.168.4.2
IPv4 DNS server192.168.4.2192.168.4.2

192.168.4.2

 The new hosts are announced to the global zone:

echo "192.168.4.234 fenny0" >> /etc/hosts
echo "192.168.4.235 fenny1" >> /etc/hosts
zonecfg -z fenny0
create
set zonepath=/zones/zone-fenny0
set autoboot=false
set bootargs="-m verbose"
add net
set address=192.168.4.234
set physical=e1000g0
set defrouter=192.168.4.2
end
add fs
set dir=/data
set special=/zones/common
set type=lofs
end
add attr
set name=comment
set type=string
set value="fenny0 (local zone)"
end
verify
commit
exit
zonecfg -z fenny1
create
set zonepath=/zones/zone-fenny1
set autoboot=false
set bootargs="-m verbose"
add net
set address=192.168.4.235
set physical=e1000g0
set defrouter=192.168.4.2
end
add fs
set dir=/data
set special=/zones/common
set type=lofs
end
add attr
set name=comment
set type=string
set value="fenny1 (local zone)"
end
verify
commit
exit
zonecfg -z fenny0 info
zonecfg -z fenny1 info
zoneadm -z fenny0 install
zoneadm -z fenny1 install
zfs list
zfs set quota=12G zones/zone-fenny0
zfs set quota=12G zones/zone-fenny1
zfs list
cd /zones/zone-fenny0/root/etc/
cp nsswitch.dns nsswitch.conf
echo "nameserver 192.168.4.2" >> resolv.conf
echo "192.168.4.233 fenny" >> hosts
echo "192.168.4.234 fenny0" >> hosts
echo "192.168.4.235 fenny1" >> hosts
cd
cd /zones/zone-fenny1/root/etc/
cp nsswitch.dns nsswitch.conf
echo "nameserver 192.168.4.2" >> resolv.conf
echo "192.168.4.233 fenny" >> hosts
echo "192.168.4.234 fenny0" >> hosts
echo "192.168.4.235 fenny1" >> hosts
cd
zoneadm -z fenny0 boot
zoneadm -z fenny1 boot
zlogin fenny0
zlogin fenny1
zoneadm -z fenny0 halt
zoneadm -z fenny1 halt