Solaris 10 Container(实验)
实验:参照我的前一篇日志http://blog.chinaunix.net/u/26090/showart_326391.html
code:
bash-3.00# zonecfg -z test-zone
test-zone: 没有配置此类区域
使用 'create' 开始配置新区域。
zonecfg:test-zone> create
zonecfg:test-zone> set zonepath=/export/home/test-zone
zonecfg:test-zone> set autoboot=true
zonecfg:test-zone> set pool=pool_default
zonecfg:test-zone> add inherit-pkg-dir
zonecfg:test-zone:inherit-pkg-dir> ?
'inherit-pkg-dir' 资源范围用于将
从全局区域继承的目录配置到只读模式的非全局区域中。
有效命令:
set dir=
从任一资源范围,您 均可:
end (结束此操作)
cancel(取消此操作)
exit (退出区域配置公用程序)
zonecfg:test-zone:inherit-pkg-dir> set dir=/opt
zonecfg:test-zone:inherit-pkg-dir> end
zonecfg:test-zone> add net
zonecfg:test-zone:net> ?
'net' 资源范围用于配置网络接口。
有效命令:
set address=
set physical=
请参阅 ifconfig(1M) 以获取字符串的详细信息。
从任一资源范围,您 均可:
end (结束此操作)
cancel(取消此操作)
exit (退出区域配置公用程序)
zonecfg:test-zone:net> set physical=pcn0
zonecfg:test-zone:net> set address=192.168.0.223
zonecfg:test-zone:net> end
zonecfg:test-zone> verify
zonecfg:test-zone> commit
zonecfg:test-zone> exit
bash-3.00# zonecfg -z test-zone info
zonepath: /export/home/test-zone
autoboot: true
pool: pool_default
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
inherit-pkg-dir:
dir: /opt
net:
address: 192.168.0.223
physical: pcn0
bash-3.00# zoneadm -z test-zone install
Preparing to install zone .
Creating list of files to copy from the global zone.
Copyingfiles to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initializepackages on the zone.
Initializedpackages on zone.
Zoneis initialized.
The filecontains
a log of the zone installation.
我的机器比较慢,至少花了我40分钟
bash-3.00# zoneadm list -vc
ID NAME STATUS PATH
0 global running /
- test-zone installed /export/home/test-zone
bash-3.00# zoneadm -z test-zone boot
bash-3.00# zoneadm list -cv
ID NAME STATUS PATH
0 global running /
1 test-zone running /export/home/test-zone
bash-3.00# zlogin test-zone
[已连接到区域 'test-zone' pts/3]
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
# ifconfig -a
lo0:1: flags=2001000849 mtu 8232 ind
ex 1
inet 127.0.0.1 netmask ff000000
pcn0:1: flags=1000843 mtu 1500 index 2
inet 192.168.0.223 netmask ffffff00 broadcast 192.168.0.255
# ls
bin etc home mnt platformsbin tmp var
dev export lib opt proc system usr
# id
uid=0(root) gid=0(root)
再到我的Global Zone里面查看一些系统信息:
bash-3.00# ifconfig -a
lo0: flags=2001000849 mtu 8232 index
1
inet 127.0.0.1 netmask ff000000
lo0:1: flags=2001000849 mtu 8232 ind
ex 1
zone test-zone
inet 127.0.0.1 netmask ff000000
pcn0: flags=1000843 mtu 1500 index 2
inet 192.168.0.222 netmask ffffff00 broadcast 192.168.0.255
ether 0:c:29:c3:c4:b7
pcn0:1: flags=1000843 mtu 1500 index 2
zone test-zone
inet 192.168.0.223 netmask ffffff00 broadcast 192.168.0.255
bash-3.00#ls
Desktop boot devices lib pool2 test
Documents cdrom etc lost+found poolr tmp
RJ commands.shexport mnt proc usr
a.xml core file4 net sbin var
bak custom.tbx home opt snap.bak vol
bin dev kernel platform system
# exit
[与区域 'test-zone' pts/3 的连接已关闭]
对比一下,IP及根目录的内容,完全不同的两个东西,难说这就是传说中的container,呵呵,顿时找到下个小小目标了。
http://www.cublog.cn/images/face/007.gif
我的虚拟机是4.7G,配置完这个Non-global Zone后,空间添加了500MB左右(1046 packages)
Question:
1.test-zone看上去像一个完整的应用,也有自己的IP地址,但是仍有一些服务不能用,比如ftp telnet等,(前提是我已经正确的修改了配置文件)为什么???
2.普通用户使用zlogin test-zone登录时会发生什么情况???
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/26090/showart_326494.html
页:
[1]