Overblog
Editer l'article Suivre ce blog Administration + Créer mon blog
30 mars 2013 6 30 /03 /mars /2013 22:20

 

Everyone knows that one of the major problem for consolidating Solaris 10 is network. if each Solaris Zones use a different network (vlan), the configuration of the Global Zone becomes a real headache.

 

In Solaris 11, Crosbow effectively addresses this problem. This article explains how to create several Solaris Zone an emphasis on network configuration (several vlan).

 

In this example, there are 3 Solaris Zone running on dedicated systems that are exposed to the external networks. Each Solaris Zone runs a different vlan.

  • The Global Zone running in vlan id 1 (Address: 192.168.1.10/24 - Router: 192.168.1.1)
  • The Solaris Zone zone1 running in vlan id 1 (Address: 192.168.1.11/24 - Router: 192.168.1.1)
  • The Solaris Zone zone2 running in vlan id 2 (Address: 192.168.2.10/24 - Router: 192.168.2.1)
  • The Solaris Zone zone3 running in vlan id 3 (Address: 192.168.3.10/24 - Router: 192.168.3.1)
  • Each port of NIC used by aggregation is configured in different vlans (vlan id 1, 2 and 3)

Let's go... Just wait... The network configuration of switch must be already configured (please contact network team !?)

 

 

Step 1: Create link aggregation

 

My system (Sparc M5000) includes 4 NICs. There is no network configuration yet (I connect on XSCF).

 

# dladm show-phys
LINK       MEDIA         STATE      SPEED  DUPLEX    DEVICE
net1       Ethernet      unknown    0      unknown   bge1
net0       Ethernet      unknown    0      unknown   bge0
net3       Ethernet      unknown    0      unknown   bge3
net2       Ethernet      unknown    0      unknown   bge2

 

I create a basic link aggregation (I don't use LACP) with 4 NICs.

 

# dladm create-aggr -P L2,L3 -l net0 -l net1 -l net2 -l net3 default0

 

I check quicly the status of the aggregation.

 

# dladm show-link
LINK          CLASS     MTU    STATE    OVER
net1          phys      1500   up       --
net0          phys      1500   up       --
net3          phys      1500   up       --
net2          phys      1500   up       --
default0      aggr      1500   up       net0 net1 net2 net3

 

Yet, I configure address on this aggregation.

 

# ipadm create-ip default0
# ipadm create-addr -T static -a local=192.168.1.10/24 default0/v4

 

Don't forget, the configuration of router.

 

# route add -p default 192.168.1.1 -ifp default0

 

 

Step 2: Create Solaris Zone for Cloning

 

It is much faster to clone Solaris Zone than to create one from scratch, because building an image from packages takes longer than, in essence, copying an existing zone. I use the cloning technique in this example to first create one Solaris Zone and then clone it three times.

 

# zfs create -o mountpoint=/zones -o dedup=on rpool/zones
# zfs create -o mountpoint=/zones/zclone rpool/zones/zclone
# chmod 700 /zones/zclone

 

# zonecfg -z zclone
Use 'create' to begin configuring a new zone.
zonecfg:zclone> create
create: Using system default template 'SYSdefault'
zonecfg:zclone> set zonepath=/zones/zclone
zonecfg:zclone> set ip-type=exclusive
zonecfg:zclone> exit

 

# zoneadm -z zclone install
Progress being logged to /var/log/zones/zoneadm.20130329T161207Z.zclone.install
       Image: Preparing at /zones/zclone/root. 
[...] 
  Next Steps: Boot the zone, then log into the zone console (zlogin -C)
              to complete the configuration process.
Log saved in non-global zone as /zones/zclone/root/var/log/zones/zoneadm.20130329T161207Z.zclone.install

 

# zoneadm -z zclone boot ; zlogin -C zclone
[Connected to zone 'zclone' console]
Loading smf(5) service descriptions: 115/115

 

When I obtain the screen to configure this Solaris Zone, I halt this zone.

 

# zoneadm -z zclone halt

 

 

Step 3: Create Solaris Zones zone1

 

Remimber, Solaris Zone zone1 use a same vlan that Global Zone. First, I create a vlan link over a datalink (default0).

 

# dladm create-vnic -v 1 -l default0 vnic1

 

Next, I create zone1 from the zclone zone (don't forget a profile creation - new sysidcfg).

 

# zonecfg -z zone1 "create -t zclone"
# zonecfg -z zone1
zonecfg:zone1> set zonepath=/zones/zone1
zonecfg:zone1> select anet linkname=net0
zonecfg:zone1:anet> set linkname=vnic1
zonecfg:zone1:anet> set lower-link=default0
zonecfg:zone1:anet> end
zonecfg:zone1> commit
zonecfg:zone1> exit

 

# zoneadm -z zone1 clone -c /tmp/sc_profile1.xml zclone
The following ZFS file system(s) have been created:
    rpool/zones/zone1
Progress being logged to /var/log/zones/zoneadm.20130329T172124Z.zone1.clone
Log saved in non-global zone as /zones/zone1/root/var/log/zones/zoneadm.20130329T172124Z.zone1.clone

 

 

Step 4: Create Solaris Zones zone2

 

Solaris Zone zone2 use a vlan id 2. First, I create a vlan link over a datalink (default0).

 

# dladm create-vnic -v 2 -l default0 vnic2

 

Next, I create zone2 from the zclone zone (don't forget a profile creation - new sysidcfg). Beware, I use the following paramater to configure the vlan id: vlan-id.

 

# zonecfg -z zone2 "create -t zclone"
# zonecfg -z zone2
zonecfg:zone2> set zonepath=/zones/zone2
zonecfg:zone2> select anet linkname=net0
zonecfg:zone2:anet> set linkname=vnic2
zonecfg:zone2:anet> set lower-link=default0
zonecfg:zone2:anet> set vlan-id=2
zonecfg:zone2:anet> end
zonecfg:zone2> commit
zonecfg:zone2> exit

 

# zoneadm -z zone2 clone -c /tmp/sc_profile2.xml zclone
The following ZFS file system(s) have been created:
    rpool/zones/zone2
Progress being logged to /var/log/zones/zoneadm.20130329T174913Z.zone2.clone
Log saved in non-global zone as /zones/zone2/root/var/log/zones/zoneadm.20130329T174913Z.zone2.clone

 

 

Step 5: Create Solaris Zones zone3

 

It's the same configuration than zone2, the only change comes from vlan id. This zone uses a vlan id 3.

 

# dladm create-vnic -v 3 -l default0 vnic3

 

# zonecfg -z zone3 "create -t zclone"
# zonecfg -z zone3
zonecfg:zone3> set zonepath=/zones/zone3
zonecfg:zone3> select anet linkname=net0
zonecfg:zone3:anet> set linkname=vnic3
zonecfg:zone3:anet> set lower-link=default0
zonecfg:zone3:anet> set vlan-id=3
zonecfg:zone3:anet> end
zonecfg:zone3> commit
zonecfg:zone3> exit

 

# zoneadm -z zone3 clone -c /tmp/sc_profile3.xml zclone
The following ZFS file system(s) have been created:
    rpool/zones/zone3
Progress being logged to /var/log/zones/zoneadm.20130329T175707Z.zone3.clone
Log saved in non-global zone as /zones/zone3/root/var/log/zones/zoneadm.20130329T175707Z.zone3.clone

 

 

Step 6: Start all Solaris Zone

 

My configuration is finished. I just start all zone.

 

# zoneadm list -cv
  ID NAME      STATUS     PATH               BRAND    IP   
   0 global    running    /                  solaris  shared
   - zclone    installed  /zones/zclone      solaris  excl 
   - zone1     installed  /zones/zone1       solaris  excl 
   - zone2     installed  /zones/zone2       solaris  excl 
   - zone3     installed  /zones/zone3       solaris  excl 

 

# zoneadm –z zone1 boot ; zoneadm –z zone2 boot ; zoneadm –z zone3 boot

 

 

Conclusion: We hope this step-by-step guide will give you some ideas for future consolidation. With Oracle Solaris 11 capabilities, you can easily set up fairly complex environments.

 

 

See Also

 

Partager cet article

commentaires

S
Nice really dig me out of confusion :)<br /> <br /> Just have a below question, here <br /> <br /> zonecfg:zone1> select anet linkname=net0 ****<br /> <br /> -why you are setting anet as nic0<br /> -what will happen to non-global zones if net0 down<br /> <br /> Thanks <br /> Shirish
Répondre
B
Hi Julien,<br /> <br /> You are right. When we use option"anet", the virtual interface (vnic) is automatically created. In fact, I only use these virtual interfaces for monitoring (otherwise it is not necesary).<br /> <br /> Thank you for your obeservation which allows a better understanding of this option.<br /> <br /> Regards,<br /> Bruno Philippe
Répondre
J
Hi,<br /> <br /> Good article Bruno, as always. Just a question though: why not just let the anet zonecfg property instanciate atomagically the vnet at the launch of the Zone (and destroy it (the vnet) when the<br /> Zone is halted)?<br /> <br /> --<br /> Best regards,<br /> Julien Gabel.
Répondre