[OmniOS-discuss] Cloned Zones and Networking
Stephen Nelson-Smith
stephen at atalanta-systems.com
Fri Dec 14 09:39:32 EST 2012
Hi Sergey,
On 14 December 2012 12:29, sergey ivanov <sergey57 at gmail.com> wrote:
> I think you have missed "ipadm create-if" before "ipadm create-addr". There
> should be "ipadm create-if z2".
I'm not convinced that's needed. It certainly isn't needed when
creating a zone from scratch, and the Solaris 11 docs don't state that
it is required. At any rate it doesn't make a difference.
Here's a step-by-step process. If people are interested in trying to
reproduce this (and of course fix it), follow these steps:
1) Create a vnic for an example zone
root at omnios:~# dladm create-vnic -l bge0 c1
2) Create the zone
root at omnios:~# zonecfg -z clone1
clone1: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:clone1> create
zonecfg:clone1> set zonepath=/zones/clone1
zonecfg:clone1> set brand=ipkg
zonecfg:clone1> set autoboot=true
zonecfg:clone1> set limitpriv=default,dtrace_proc,dtrace_user
zonecfg:clone1> set ip-type=exclusive
zonecfg:clone1> add net
zonecfg:clone1:net> set physical=c1
zonecfg:clone1:net> end
zonecfg:clone1> commit
zonecfg:clone1> verify
zonecfg:clone1> exit
3) Install the zone
root at omnios:~# zoneadm -z clone1 install
A ZFS file system has been created for this zone.
Publisher: Using omnios (http://pkg.omniti.com/omnios/release/ ).
Image: Preparing at /zones/clone1/root.
Cache: Using /var/pkg/publisher.
Sanity Check: Looking for 'entire' incorporation.
Installing: Packages (output follows)
Packages to install: 388
Create boot environment: No
Create backup boot environment: No
Services to change: 4
DOWNLOAD PKGS FILES XFER (MB)
Completed 388/388 40180/40180 307.0/307.0
PHASE ACTIONS
Install Phase 58638/58638
PHASE ITEMS
Package State Update Phase 388/388
Image State Update Phase 2/2
Note: Man pages can be obtained by installing pkg:/system/manual
Postinstall: Copying SMF seed repository ... done.
Done: Installation completed in 178.089 seconds.
Next Steps: Boot the zone, then log into the zone console (zlogin -C)
to complete the configuration process.
4) Configure the zone
root at omnios:~# zoneadm -z clone1 boot
root at omnios:~# zlogin clone1
[Connected to zone 'clone1' pts/4]
OmniOS 5.11 omnios-33fdde4 2012.10.04
root at clone1:~# ipadm create-addr -T static -a 10.1.1.151/24
c1/v4address $
root at clone1:~# cp /etc/nsswitch.dns /etc/nsswitch.conf
root at clone1:~# echo "nameserver 8.8.8.8" > /etc/resolv.conf
root at clone1:~# route -p add default 10.1.1.1
add net default: gateway 10.1.1.1
root at clone1:~# ipadm show-addr
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
c1/v4address static ok 10.1.1.151/24
lo0/v6 static ok ::1/128
root at clone1:~# ping 10.1.1.1
10.1.1.1 is alive
root at clone1:~# exit
logout
workstation> ping 10.1.1.151
PING 10.1.1.151 (10.1.1.151): 56 data bytes
64 bytes from 10.1.1.151: icmp_seq=0 ttl=255 time=0.803 ms
64 bytes from 10.1.1.151: icmp_seq=1 ttl=255 time=0.702 ms
64 bytes from 10.1.1.151: icmp_seq=2 ttl=255 time=0.847 ms
^C
--- 10.1.1.151 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.702/0.784/0.847/0.061 ms
5) Halt clone1
root at omnios:~# zoneadm -z clone1 halt
6) Create a new vnic for the machine we're going to create by cloning
root at omnios:~# dladm create-vnic -l bge0 c2
7) Create the zone config for the new machine
root at omnios:~# zonecfg -z clone1 export | sed
's/clone1/clone2/g;s/c1/c2/g' | tee /tmp/c2.config
$
create -b
set zonepath=/zones/clone2
set brand=ipkg
set autoboot=true
set limitpriv=default,dtrace_proc,dtrace_user
set ip-type=exclusive
add net
set physical=c2
end
8) Create the new zone
root at omnios:~# zonecfg -z clone2 -f /tmp/c2.config
9) Clone the first machine to the second machine
root at omnios:~# zoneadm -z clone2 clone clone1
root at omnios:~# zoneadm list -vc | grep clone
- clone1 installed /zones/clone1 ipkg excl
- clone2 installed /zones/clone2 ipkg excl
10) Boot the new machine
root at omnios:~# zoneadm -z clone2 boot
11) Attempt to configure networking on clone2
root at clone2:~# dladm show-link
LINK CLASS MTU STATE BRIDGE OVER
c2 vnic 1500 up -- ?
root at clone2:~# ipadm create-if c2
ipadm: Could not create c2 : Object not found
root at clone2:~# ipadm show-if
IFNAME STATE CURRENT PERSISTENT
lo0 ok -m-v------46 ---
root at clone2:~# ipadm create-addr -T static -a 10.1.1.152/24 c2/v4address
ipadm: Could not create address: Object not found
Thanks,
S.
--
Stephen Nelson-Smith,
Founder, Principal Consultant,
Atalanta Systems Ltd,
Web: http://agilesysadmin.net
Twitter: @lordcope
Skype: atalanta.systems
Direct: +44 (0) 1329 550203
Mobile: +44 (0) 7917 101919
Atalanta Systems: The Agile Infrastructure Enablers
http://atalanta-systems.com
More information about the OmniOS-discuss
mailing list