Showing posts with label solaris zones. Show all posts
Showing posts with label solaris zones. Show all posts

Monday 11 September 2017

Solaris – Add/remove network interface to a running zone (dynamic Change)

This will describe how to add a network interface to a running non-global zone, without having to reboot the zone. The new interface will persist between reboots.

First you add the entry to the zone configuration. This is the part that lets it persist between reboots. This is done from the global zone:

!-[solaris]# zonecfg -z sunz01
zonecfg:slabsunz01> add net
zonecfg:slabsunz01:net> set address=XXX.XXX.XX.XXX
zonecfg:slabsunz01:net> set physical=bge0
zonecfg:slabsunz01:net> end
zonecfg:slabsunz01> verify
zonecfg:slabsunz01> commit
zonecfg:slabsunz01> exit

Now we have to manually add a new interface to the running zone. Do this from the global zone as well

!-[solaris]# ifconfig bge0 addif XXX.XXX.XX.XXX netmask XXX.XXX.X.X zone sunz01 up

Created new logical interface bge0:3

Note: The ‘addif’ tells ifconfig to create a logical interface using the next available.

!-[solaris]# ifconfig -a
lo0:1: flags=2001000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000
bge0:1: flags=1000843 mtu 1500 index 2 inet XXX.XXX.XX.XXX netmask ffffff00 broadcast XXX.XXX.XX.XXX
bge0:3: flags=1000843 mtu 1500 index 2 inet XXX.XXX.XX.XXX netmask ffffff00 broadcast XXX.XXX.XX.XXX

That's it! you're done.

In case you want to remove the interface -

To remove the interface from a running zone. From the global zone, remove the interface. You must first determine which logical interface [alias] you wish to remove.

!-[solaris]# ifconfig bge0:3 down
!-[solaris]# ifconfig bge0:3 unplumb
!-[solaris]# zonecfg -z sunz01
zonecfg:slabsunz01> remove net address=XXX.XXX.XX.XXX
zonecfg:slabsunz01> commit
zonecfg:slabsunz01> exit

Tuesday 18 July 2017

NFS mount on Solaris 11 Non-Global zones systems

In this article, we would learn how we mount folder from one Non-Global zone to another zone on Solaris 11 operating system using network file sharing.

For an example, we can use take a two local zone "sunz01" & "sunz02". We will mount one folder named "/export/backup" from "sunz01" local zone to another zone "sunz02" on "/project/export/data" location.

Step by Step method of NFS mount on Solaris 11:
 
➦ In the first step we will create the directory on "sunz02" zone where we want to mount the folder.

sunz02#mkdir /project/export/data
 
➦ In second step, we will make a configuration for this process. So for this work you need to login on global zone with root access and make an entry on the dfstb configuration file.

sun#vi /etc/dfs/dfstab

share -F nfs -o rw=sunz02 /zones/sunz01/root/export

If you see the above entry, we have provided the read/write access to directory on sunz02 server where we mount the folder from sunz01 local zone.
 
➦ In next step you need to login on sunz02 server and mount the shared folder using below command.

sunz02#mount sun:/zones/sunz01/root/export/backup /project/export/data
 
➦ Once you run the above command the folder is mount from one local zone to another zone temporarily. You can go to the directory and verify that the data which is listed on /export/backup folder is show on sunz02 directory.
 
➦ In the last step you need to restart the NFS service on the global zone so the configuration files and other changes makes affect. But these configuration are available until we are not taking reboot of the zone.

If you have any query regarding this topic, please post your comment here, we will get back to you shortly.

Tuesday 11 July 2017

How to Remove or Delete a Non-Global Zone from Solaris Operating system

As you aware that Non-Global zone are hosted on Global zone on Solaris Operating system. You can check the Non-Global zone list using "zoneadm" command. It will show you are running and installed zones on Global zones.
 
Please find the below step by step method to remove of local zone from global zone.

Step by Step Method of removal a Non-Global Zone:

First of all you need to check the Non-Global Zone list to ensure which zone is running on the server.

global# zoneadm list -iv

You will see a display that is similar to the following:

ID  NAME     STATUS       PATH                           BRAND      IP
 0    global       running         /                                   solaris    shared
 1    sunz01       running         /zones/sunz01                solaris    shared
In the above command output you can see the Non-Global Zone "sunz01" is running, which we need to remove or delete from Solaris Server.

Now, we need to shutdown the required zone which we need to delete. We can shutdown the Non-Global zone using below commands.
--------------------------------------------
global#zoneadm -z sunz01 halt
or
global#zoneadm -z sunz01 shutdown
or
global#zlogin sunz01 shutdown
-------------------------------------------
In next step when your Non-Global zone shutdown you need to uninstall the local zone. You can used the below method to uninstall the Non-Global Zone.

global#zoneadm -z sunz01 uninstall

Using above command Non-Global zone "sunz01" has been uninstall successfully.

In the last step you need to remove or delete all dataset and configuration files of Non-Global zone "sunz01" from Global zone.

global#zonecfg -z sunz01 delete

Using above command all the configuration files related to this Non-Global zone has been deleted successfully. Now you can remove the folder related to this zone.

So using above method we can remove or delete the Non-Global zone from global zone or Solaris Operating system. Please let me know if you are facing any issue during using this process.

Saturday 24 June 2017

How to create whole root zone on Sun Solaris 11 Operating System

In Solaris 10, we can’t install it without configuring repo on Solaris while in Solaris 11 ,first we need to create a  Solaris 11 repo , then we can install Solaris local zone. In Solaris 11, all the local zones by default uses exclusive ip address. You can’t set the IP address while configuring the zone. After the installation of zone, you can able to configure the IP from the local zone itself.

On my Solaris 11 machine I have already installed one local zone which is used for my R&D work so for this post work I need to install second local zone. So I will clone it from the first local zone.

Step by step method to create a zone on Solaris 11:-

➤ In the first step we will create a new local zone. For the zone creation we will used "zonecfg" command and configure the zones as whole root zone without any options supplied.

!-[solaris]#zonecfg -z sun02
sun02: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:sun> create
zonecfg:sun> info
zonename: sun02
zonepath:
brand: native
autoboot: false
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
hostid:
zonecfg:sun> set zonepath=/zones/sun02
zonecfg:sun > add anet
zonecfg:sun:anet> set linkname=net0
zonecfg:sun:anet> end
zonecfg:sun > verfiy
zonecfg:sun > commit
zonecfg:sun > exit

In the above step, we will create a zne and set the zonepath. In my case my new solaris zone path is "/zones/sun02" in your case you can change your installation zone path. Here, I assign the network interface "net0" for this newly zone.

➤ After successfully zone creation in above step 1, we will go for start the Solaris zone installation in this step. As I explained you for solaris 11 local zone installation we required solaris 11 repo which is used for installation part.

!-[solaris]#zoneadm -z sun02 install
The following ZFS file system(s) have been created:
    rpool/zones/sun02
Progress being logged to /var/log/zones/zoneadm.30220110Z233232Z.sun02.install
       Image: Preparing at /zones/sun02/root.
 AI Manifest: /tmp/manifest.xml.F_ayqq
  SC Profile: /usr/share/auto_install/sc_profiles/enable_sci.xml
    Zonename: sun02
Installation: Starting ...
              Creating IPS image
Startup linked: 1/1 done
        Installing packages from:
solaris  origin:  http://localhost:1008/solaris/ce43f14c4791b5320596e2023cde1ec08709a3af/

DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                            183/183   33556/33556  222.2/222.2  139k/s

PHASE                                          ITEMS
Installing new actions                   46825/46825
Updating package state database               Done
Updating image state                          Done
Creating fast lookup database                 Done
Installation: Succeeded

Note:Man pages can be obtained by installing pkg:/system/manual done. Done: Installation completed in 2392.837 seconds.

Now our newly zone "sun02" has been installed successfully. All the configuration files are keep in /zones/sun02/root directory.

➤ In this step we will boot the newly installed zone "sun02".

!-[solaris]#zoneadm -z sun02 boot

You can check the status of zone that it is running or not after boot.

!-[solaris]#zoneadm list -icv
ID NAME      STATUS     PATH          BRAND    IP
   0 global   running    /            solaris  shared
   1 sun01    running    /zones/sun01 solaris  excl
   3 sun02    running    /zones/sun02 solaris  excl

if you see the above output newly zone "sun02" is running working fine on the solaris 11 operating system.

➤ Now in the next step, we will login on the local zone console to complete the configuration process.

!-[solaris]# zlogin -C sun02
[Connected to zone 'sun02' console]

You can press enter when you will get this message. Now it is asking for some configuration step we need to give a details one by one.

Time Zone: Regions
select the region that contains your time zone.
Regions
UTC/GMT
Africa
Americas
Antarctica
Arctic Ocean
Asia
Atlantic Ocean
Australia
Europe
Indian Ocean
Pacific Ocean
F2_Continue  F3_Back  F6_Help  F9_Quit

Time Zone: Locations
Select the location that contains your time zone.
Locations
x Afghanistan
x Armenia
x Azerbaijan
x Bahrain
x Bangladesh
x Bhutan
x Brunei
x Cambodia
x China
x Cyprus
x East Timor
x Georgia
x Hong Kong
v India
F2_Continue  F3_Back  F6_Help  F9_Quit

Time Zone
Select your time zone.
Time Zones
Asia/Kolkata

F2_Continue  F3_Back  F6_Help  F9_Quit

System Configuration Summary
Review the settings below before continuing. Go back (F3) to make changes.

Time Zone: Asia/Kolkata
Language: *The following can be changed when logging in.
Default language: C/POSIX
Terminal type: vt100

Users:
No user account

Network:
Computer name: sun02
Network Configuration: Automatic

Support configuration:
Not generating a Support profile as OCM and ASR services are not installed.
Hostname: sun02

So now your zone is fully configured ans installed successfully. You can login in zone very easily. So in next step we will see the post configuration settings which is required on local solaris zone.

➤ In the final step you need login to local zone sun02 and configured the ip address on the zone sun02.

!-[solaris]# zlogin -z sun02

You can successfully login in your newly created solaris 11 zone. Please leave a comment if you have any doubt , I will get back to you as soon as possible.