Monday, September 12, 2011

Configuring DNS(BIND) in Sun (Oracle) Solaris 10


CONFIGURING BIND DNS SERVER:
==============================

pkginfo -x |grep -i bind

SUNWbind  - main Bind package
SUNWbindr - Service management

pkgchk -l SUNWbindr

pkgchk -l SUNWbind

dig mail.yahoo.com

dig mail.yahoo.com ns

dig mail.yahoo.com mx

By default /var/named and /etc/named.conf does not exist

create /etc/named.conf



options {
directory "/var/named";
};

###Special zone of root of DNS###

zone "." {
type hint;
file "db.cache";
};

###Reverse zone###

zone "0.0.127.in-addr.arpa" {
type master;
file "db.127.0.0";
};

zone "0.16.172.in-addr.arpa" {
type master;
file "db.172.16.0";
};

###Forward Zone###

zone "unix.com" {
type master;
file "db.unix.com";
};

Save and exit

Download hint file,

mkdir /var/named

cd /var/named/

wget ftp://ftp.rs.internic.net/domain/named.root

ls -l

mv named.root db.cache

Creating Zone Files:

>> reverse lookup zone

gedit /var/named/db.127.0.0

@ IN SOA pc1.unix.com. root.unix.com. (
2011062001 ; Serial number
7200 ; Refresh Interval
3600 ; Retry Interval
86400 ; Expiry
600 ); Minimum TTL

NS pc1.

1 IN PTR localhost.

save & exit

gedit /var/named/db.172.16.0

@ IN SOA pc1.unix.com. root.unix.com. (
2011062001 ; Serial number
7200 ; Refresh Interval
3600 ; Retry Interval
86400 ; Expiry
600 ); Minimum TTL

NS pc1.

1 IN PTR pc1.

##1 is for 172.16.0.1##

save & exit

gedit /var/named/db.172.16.0

@ IN SOA pc1.unix.com. root.unix.com. (
2011062001 ; Serial number
7200 ; Refresh Interval
3600 ; Retry Interval
86400 ; Expiry
600 ); Minimum TTL

NS pc1.

1 IN PTR pc1.

##1 is for 172.16.0.1##

save & exit


gedit /var/named/db.unix.com

@ IN SOA pc1.unix.com. root.unix.com. (
2011062001 ; Serial number
7200 ; Refresh Interval
3600 ; Retry Interval
86400 ; Expiry
600 ); Minimum TTL

NS pc1.

pc1 IN  A 172.16.0.1
pc2 IN  A 172.16.0.2


save & exit

svcadm enable dns/server

svcs -l dns/server

dig @localhost pc1.unix.com


vi /etc/resolv.conf

domain unix.com
search unix.com
nameserver 172.16.0.1
nameserver 8.8.8.8

dig @localhost www.google.com
1655ms


dig @localhost www.google.com
1ms

NOTE: Always works as caching-only NS


gedit /var/named/db.unix.com

@ IN SOA pc1.unix.com. root.unix.com. (
2011062002 ; Serial number
7200 ; Refresh Interval
3600 ; Retry Interval
86400 ; Expiry
600 ); Minimum TTL

NS pc1.unix.com.

    IN  MX  10 pc1.unix.com.

pc1 IN  A 172.16.0.1
pc2 IN  A 172.16.0.2


save & exit


svcadm restart dns/server

dig @localhost pc1.unix.com mx


gedit /var/named/db.unix.com

@ IN SOA pc1.unix.com. root.unix.com. (
2011062003 ; Serial number
7200 ; Refresh Interval
3600 ; Retry Interval
86400 ; Expiry
600 ); Minimum TTL

NS pc1.unix.com.

    IN  MX  10 pc1.unix.com.

pc1 IN  A 172.16.0.1
pc2 IN  A 172.16.0.2
www CNAME ns1.unix.com.

save & exit

svcadm restart dns/server


dig @localhost www.unix.com cname

Volume manger and RAID 0,1 and 5 configuration in Sun (Oracle) Solaris 10


VOLUME MANAGER & RAID 
=======================

1.Volume Types:
RAID 0
Concatenation or stripe
RAID 1
mirror
RAID 5
Stripting with Parity
2. Soft partitions - LARGE STORAGES

3. Hot Spare pools - Spare storage to use when Raid1 or 5 has failed

4. State datebase Replica - Must be created to created volumes

5. Data sets - Used for Clustering Solaris / failover

Can not create volumes using format



HOW TO CREATE SDR

wbem service should be running

check using,

/etc/init.d/init.wben status
running on port 898

which smc

smc

This computer>Storage>Enhanced storage

[supply root password]

Volumes Hotsparepool SDR datasets

mount

df

GO TO SDR

Action>create replica

Diskset > do nothing   >> NEXT

Slices ...

select slice is not mounted in MOUNT Command

IF not present Create few from format command

run smc again

refresh

c0t1d0s0 and c0t1d0s1

select 2 slices

8192 x 2

Select one if you want

Once you have two SDR created check from SDR

CREATING RAID0
==============

c0t1d0s0
c0t2d0s0

Make sure Two disks/slices have SDR

smc

Volumes > Create new volume

Don't create replica

Concatetination RAID0

NOTE: it writes data one of one, only when first is full



STRIPE RAID0

Note: It writes both disks/slices togather (for performances)

Select STRIPE RAID0

volume name d0

will create /dev/md/dsk/d0

SELECT both slices that you have created

NOTE : SAME SIZE in Stripe

next

NO HOT SPARE POOL

next

Command in CMD:

/usr/sbin/metainit d0 1 2 c0t1d0s0 c0t2d0s0

finish

Check RAID0 of d0 in volumes

Right click and properties ... Show..

To format

newfs /dev/md/rdsk/d0

mkdir /raid1

mount /dev/md/dsk/d0 /raid1

df -h

gedit /etc/vfstab

/dev/md/dsk/d0 /dev/md/rdsk/d0 /raid1 ufs 2 yes -

save and exit



properties of SDR

you must see a u

active and up to date

CREATING RAID 1 (Mirror):
======================

umount /raid1

smc

delete last created RAID0

Volume>Create volume

Follow same wizard

Select RAID1 (Mirror)

No hot spare pool

Command line tool,

metainit d0 1 1 c0t1d0s0

NOTE: 1 slice only

next next finish

refresh

Follow same step for one

Stripe 0

d1

command line tool,

metainit d1 1 1 c0t2d0s0

Now should be able to see two volumes

HOw to create mirror

Create volume:

No SDR

Select : Mirror

d2

d0 and d1 Concatination RAID0

select first for Source

Select Target for destination

READ Option: Round Robin
Write : Paralle
Passnumber:1

next

Command line tool,

metainit d2 -m d0
metattach d2 d1

finish

d2

properties :

Size is half of total amount of space

we can add and deattach sub-mirrors

newfs /dev/md/rdsk/d2

mkdir /mirror

mount /dev/ms/dsk/d2 /mirror

df -h


gedit /etc/vfstab

/dev/md/dsk/d2 /dev/md/rdsk/d2 /mirror ufs 2 yes -

save exit


Creating RAID 5(Stripe with parity):
==========================

Make sure you have three slices

umount /mirror

Delete all volumes

Volume> Create volumes

select RAID5

Volumename:

d0

c0t1d0s0 10gb
c0t1d0s1 10gb
c0t2d0s0 10gb

select three SAME SIZE slices

next

interface 16kb

no Hot spare pool

command line tool,

metainit d0 -r c0t1d0s0 c0t1d0s1 c0t2d0s0

finish

refresh

d0

20gb

10+10+10 = 20 GB in RAID5

****

which metastat

metastat d0

status ....

newfs /dev/md/rdsk/d0

mkdir /raid5

mount /dev/md/dsk/d0 /raid5


gedit /etc/vfstab

/dev/md/dsk/d0 /dev/md/rdsk/d0 /raid5 ufs 2 yes -

Patch Management in Sun (Oracle) Solaris 10


Patching Solaris 10 using Shell/GUI: 

Register your copy of Solaris first on a website(some cases its free)

Update Manager is used for Updating Solaris>>

Applications>Utilities>Update Manager

which updatemanager

/usr/bin/updatemanager

[Use Update manager to Register]

Its a GUI TOOL!! :)

Fill up the form!

and SUN SUBCRIPTION KEY

No compulsory to type key (NOTE: Without key it limit updates)

Continues without KEY

Finish

Checks for latest patches which is applicable

Default DIRECTORY for downloading patches is :

/var/sadm/spool

[Can change from Preference option in GUI]

tick mark on patch to download and install

you will see 12912.jar.tmp

[tmp means its still downloading]
NOTE: Look for smaller size patch for demo

Clicking the patch will give discription

We can download patches manually from,

http://Sunsolve.sun.com

open in mozilla and look for SunOS and patch num

[Only look for x86 versions]

Command Version of PATCH management:

[smpatch  - CLI of update manager]

smpatch analyze   - Analysis of patches

Patchid - Built - Description

Dump everything into a text file and use it for updating

smpatch analyze > patch_list.txt



ls -ltr patch_list.txt

smpatch analyze -x idlist=patch_list.txt

[This command processes only patches available in the list]

NOTE: Keep 1 or 2 names only


smpatch analyze -i 121309-03

>>To check dependancies

smpatch download -i 121309-03

>> This will download and store in /var/sadm/spool



smpatch add -i 121309-03

>> for installing specific patch

After installing check in updatemanager

smpatch get

>> to see variables of Updatemanager

cd /var/sadm/spool/patch

ls -ltr

cd 121309-03

tail log

>> displays log file related to specific log

smc

management tools> System config> patches

here shows list of installed patches

Action>Add patch

local or remote location

patchadd >> This command is to install unsigned patches


LOOK FOR UNSIGNED PATCH and COPY the ID
http://sunsolve.sun.com

Download specific patch using PATCHFINDER

unzip 122670-01.zip

patchadd /tmp/122670-01

patchadd -p

>> printing all installed patches

patchrm 122670-01

>> to remove installed patch

use Updatemanager to verify

smpatch update

to check / validated patches

shows installed patches

Package Management in Sun (Oracle) Solaris 10


Shell based Package management:

pkginfo|add|rm|chk

pkginfo - information of package
pkgadd - to install package
pkgrm - to remove package
pkgchk - to check package

pkginfo::

pkginfo - all installed packages

pkginfo -l |less

pkginfo -l SFWblue

pkginfo -x |grep - i emacs

To search installed specific packages

pkginfo -i |grep -i emacs

pkgchk ::

pkgchk -v SFWblue  -lists files included in package

pkgchk -lp /opt/sfw/bin/bluefish
  - which a packge this file belongs to?


pkgadd:::

To download free packages:
www.sunfreeware.com
www.blastwave.org/mirrors.php


pkgadd -d  tO install packgages


Spool directory: /var/spool/pkg


Download one package from www.sunfreeware.com

or use DVD


Right click on packge and "Copy link location"
using nano

wget <control+v>


Downloaded packages
:


pkgadd -d nano-1.2.4.*

Configuring SWAP partition in Sun (Oracle) Solaris 10


Creating/Adding Swap file: 

which swap

swap -l     : lists swap devices/space

swap -s     : lists total and used swap space


mkfile 512m /data2/swap2


cd /data2

ls -ltr


file swap2

swap -a /data2/swap2

[to add swap file to swap]

swap -l
swap -s

mounting in vfstab

/data2/swap2 - - swap - no -

How to remove swap file?

swap -d /data2/swap2

format> partition

Creating Swap partition:

swap -a /dev/c0t1d0s6

swap -l

swap -s


Partitioning in Sun (Oracle) Solaris 10

How to Create Paritition and Mount in Solaris 10?


Partitions are called 'Slices' in Solaris

df

df -h

VTOC = volume Table of contents

<FDISK not required in SPARC, because of using SCSI>

***SLICES rules in x86 using VTOC***
~ Maximum 10 slices (0 to 9)
~ Slices 2,8,9 are reserved
~ slice 2 - VTOC (Disk's label and Slices OS) So can't change
~ slices 0,1,3,4,5,6,7 allowed to used (total 7)

/dev/dsk/c0t0d0s0

's0' is reserved for root mount point
 run 'df' to check allocations

prtvtoc /dev/dsk/c0t0d0s0

/dev/dsk/c0t0d0s0

c0 : First controller
t0 : First Target (Only of SCSI Used)
d0 : First DISK
s0 : First Slice (1st partition)

ls -l /dev/dsk/c0t0d0*

format

0

FORMAT MENU:

q

cat /etc/vfstab

format

0

format> disk

format> ?

format> current

format> fdisk

CREATE PARTITION
DELETE PARTITION
..SO ON..

delete first if any...

no partitions

format> fdisk

y

Got first parition

5

format> partition

partition> print

4 Unassigned wm   0   -   0

partition> 4

Partition id tag[unassigned]
partition permission[wm]
new start cyl[0]
size [0b,0c] 5gb

partition> print

partition> quit

format> save


format> quit

To format slices:

newfs /dev/rdsk/c0t1d0s4

To automatically mount file systems during booting process:

gedit /etc/vfstab

/dev/dsk/c0t1d0s4  /dev/rdsk/c0t1d0s4 /data1  ufs 2 yes  -

To verify:

mount -a

df


Configuring Network in Sun (Oracle) Solaris 10


In order to enable Networking in Sun Solaris 10, first we have to assign IP address.


bash

cat /etc/hostname.e1000g0

<if DHCP enabled NIC card, there is no IP address>

create DefaultDomain file

cat /etc/inet/networks
 
   172.16.0.0/255.255.0.0

<Only update if subnetting used>

cat /etc/hosts

172.16.0.2 pc1

netstat -D     : DHCP config for all nics
ifconfig -a     : config for all nics

ifconfig e1000g0 dhcp status

<shows dhcp status>

cd /etc

ls -ltr hostname.e1000g0

ps -ef |grep -i agent
/sbin/dhcpagent

netstat -rn

cat hostname.e1000g0

echo "192.168.1.1" > hostname.e1000g0 && echo $?

cat hostname.e1000g0

echo "linux.com" > /etc/defaultdomian

gedit /etc/inet/networks

192.168.1.0 255.255.255.0

gedit /etc/hosts

192.168.1.2 pc1

gedit /etc/resolv.conf
nameserver 8.8.8.8

<default router is given by DHCP, so no file>

ls -ltr /etc/defaultrouter

gedit /etc/defaultrouter
192.168.1.1

reboot


restart to make changes


<If there is no Internet Connectivity, edit the following>

gedit /etc/nsswitch.conf
hosts : files dns