Wednesday, December 12, 2012

Setup basic Primary DNS Server


Please go through theory. This is Just a basic to setup DNS Server. DNS server require bind packages to Setup DNS server. for this example our DNS server hostname will be yum-dns.mylabs.org. where mylabs.org is our local domain.
We have installed yum-dns.mylabs.org on rhel5.8. Make sure Firewall and selinux are disabled, if you are not sure , how it works.

Server Side

1. yum install bind

2. yum install bind-util

3. yum install system-config-bind

4. system-confg-bind

5. download and copy named.root from internet under /var/named

6. Now update the /etc/named.conf with zone file information for example ( first zone file is
forward dns and second is reverse zone file.)

=============================================
zone "mylabs.org." IN {

type master;

file "mylabs.org";

allow-update { none; };

};

zone "133.168.192.in-addr.arpa." IN {

type master;

file "133.168.192.in-addr.arpa";

allow-update { none; };

};
=================================================
Now make Zone File ( first Forward zone file and then reverse zone file )

7. vi /var/named/mylabs.org

==============================================================

$TTL    86400
mylabs.org.     IN SOA  ns1.mylabs.org.       root.mylabs.org (
                                        2012110914      ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           ns1.mylabs.org.

yum-dns.     IN A            192.168.133.10




==============================================================



Now create reverse  Zone File

9. vi /var/named/133.168.192.in-addr.arpa

======================================================

$TTL    86400
@       IN      SOA     ns1.mylabs.org. root.mylabs.org.  (
                                      2012110901 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum

        IN      NS      ns1.mylabs.org.

                   10      IN      PTR     yum-dns.mylabs.org.

======================================================================


10. /etc/init/named restart


Client Side

1. vi /etc/resolv.conf

search mylabs.org

nameserver 192.168.133.10

2. Check using below command

for forward DNSentry

• dig

• nslookup

for reverse DNSentry

• dig -x

• nslookip


Monday, October 25, 2010

Creating your own Yum Repository Server

One of the best tool (YUM) provided by Redhat Linux for Installing complete Package. Using Yum you can build your own repository server, which can be used to upgrade all systems in network. Simple steps for creating repository server can be found below. In this example we will be using FTP share as location for our repository.


Pre Requisit's:
  1. Server with Rhel 5 OS installed. hostname of that server in this example is kept ftp.xyz.com
  2. FTP server to installed . ( No need to setup FTP share, as by default /var/ftp/pub is shared, once FTP server is installed. Make sure that vsftpd demon is running. )
Server Side


1. Copy the iso to pub
 # cp -r /media/RHEL...../Server /var/ftp/pub
2. install create repo package Create repo
 # cd /var/ftp/pub/Server
 # rpm  -ivh createrepo*
3. copy the core.xml file in Server and create repo using below commands
 # cd /media/RHEL..../Server/repodata
 # cp comps-rhel5-Server-core.xml  /var/ftp/pub/Server
 #cd /ver/ftp/pub/Server
 # createrepo -g comps-rhel5-Server-core.xml
4. Edit yum.conf file
  # vi /etc/yum.conf     ( Add Below line at end of file (
                [Server]
                name=Server
                baseurl=file:///var/ftp/pub/Server
                enabled=1
  # yum clean all
  # yum update
  # yum repo list
  # rpm --import /etc/pki/rpm-gpg/*
Client side


1. remove rhel.debug.info
  # cd /etc/yum.repos.d/
  # rm  -rf rhel.debug.info
2. create client.repo
   # vi client.repo
                [Client]
                name=Client
                baseurl=ftp://yum-server.mylabs.org(yum-serv's  ip)/pub/Server
                enabled=1
3. start ftp daemon
     # /etc/init.d/vsftpd start
     # chkconfig --level 35 vsftpd on
4. Update yum client
     # yum clean all
     # yum update
     # yum repolist
     # rpm --import  /etc/pki/rpm-gpg/*
 5. now from client is ready to use to yum server, example, we will install mysql package
   # yum install mysql*
    

Monday, October 19, 2009

Veritas Volume Manager

Veritas Volume manager is a tool designed by Veritas to aid the management of data. As a
tool it can be used to manage, equally well, one or two disks in a small system or a
large data centre with two or three hundred disks. This disk management is achieved
by utilizing a virtual device which provides access to the underlying disks. These
virtual devices (volumes) are accessed by the file system, database, etc. in the same
way that a physical disk would be utilized on a desktop machine
.

RAID 0 - Concatenation and striping.
This is the process whereby a number of disks are presented to the OS as a single disk
entity. RAID 0 provides no redundancy for the data, however, in the striping format
will produce a performance enhancement as the data can be written to multiple
spindles concurrently
.


RAID 0 - Concatenation




RAID 0 - Concatenation



RAID 1 - Mirroring
This is the process whereby a single volume contains multiple copies of the data on
separate physical devices. RAID 1 provides redundancy, however there is no
performance improvement.


Raid1 - Mirroring

RAID 5 - Striping with Parity

In this level, a parity check sum is calculated from the data and this is then distributedacross the disks. This provides redundancy because any data lost when a disk diescan be reconstructed from the remaining data and the parity information. RAID 5 willgive a performance benefit for the read cycle but it is very slow on the write cycle dueto the requirement to calculate the parity. Usually 70% of disk is used for Actual data & 30% of disk is used for parity.


Raid5 - Striping with Parity

Other than this there are some some other type of Raid groups like (Raid 0+1 and Raid 1+0). This Documents is basically for for learners, so we will not go much into theory and start with basic BAU which are usually performed in company enviroment.

Some Basic Commands

1> Command to check Disk status in VXVM

# vxdisk list

2> Command to check diskgroup

# vxdisk –o alldgs list

If the diskgroup in the output of this is in () for eg ( newdg ), then the diskgroup in newdg is deported.

3> Command to Check Max size of the disk group

# vxassist –g DG_NAME maxsize

4> Command to check the size free in the Diskgroup

# vxdg free

5> Command to check upto what size a volume can be grown of a disk group

# vxassist –g DG_NAME maxgrow VOL_NAME

6> Command to check status of the volume.

# vxinfo –g DG_NAME

7> Command to check status of the task going in VXVM background

# vxtask list

8> Command to trace all i/o on the volume

# vxtrace -g DG_NAME VOL_NAME

9> Command to check Disk Statistics

# vxstat –g DG_NAME –d

10> Command to check if dynamic Multipathing for disk exist or not.

# vxdisk path egrep VX_DISNAME

Being a System admin one has to know, how to create the volume and need to decide which type of volume is required. for example if data is very important so we can use mirroring. but if io r/w is also important then we can use raid5. creation completely depends upon the business requirement. below are the for creating any volume and how to recover if any problem occurs..

How to create Striped Volume in veritas Volume manager
1> For creating Stripedvolume in Veritas Volume manager we will require minimum Two Disks. 2> First Step is to initialize both Disl into VXVM using below Command.

# cd /etc/vx/bin

#./vxdisksetup –i sde format=sliced

#./vxdisksetup –i sdf format=sliced

3> After initilizing the disk in error status will become online.

4> Now initialize the first to create a Disk Group using below command

# vxdg init newdg newdg01 =sde cds=off

Use below command to see the output

[root@myserver /]vxdisk list

DEVICE TYPE DISK GROUP STATUS

sda auto:none - - online invalid

sdb auto:none - - online invalid

sdc auto:none - - online invalid

sdd auto:none - - online invalid

sde auto:sliced newdg01 newdg online

Now create a volume using vxassist command. We are not creating subdisk and plex manulally as there may be confussion in naming conventions and also we have to be more precise while creating the plex and subdisk. Vxassist command will directly create subdisk, plex and volume. Kinldy see the command below.

# vxassist -g newdg make newvol01 100M layout=striped

5> Below command will display the Details of the created volume

# vxprint –g newdg –htq new newvol01

v newvol01 - ENABLED ACTIVE 4096000 SELECT newvol01-01 fsgen

pl newvol01-01 newvol01 ENABLED ACTIVE 4096000 STRIPE 2/128 RW

sd newdg01-01 newvol01-01 newdg01 0 2048000 0/0 sde ENA

sd newdg02-01 newvol01-01 newdg02 0 2048000 1/0 sdf ENA

6> Make the format the file system using below command

# mkfs –t vxfs /dev/vx/rdsk/newdg/newcol01
7> Make the mount pouint using below command

#mkdir /new2 8> Mount the filesystem using below command

# mount –t vxfs /dev/vx/dsk/newdg/newcol01 /new2

now use df -h command to see the the new filesystem named /new2. if u want the entry to be added permenantely, make the entry in /etc/fstab.

How to find if Disk is having problem and how to assign the new disk inthe same DG for Striped Volume.

1> Command to Check if Disk is failed.

# vxdisk list

DEVICE TYPE DISK GROUP STATUS

sda auto:none - - online invalid

sdb auto:none - - online invalid

sdc auto:none - - online invalid

sdd auto:none - - online invalid

sde auto:sliced newdg01 newdg online

- - newdg02 newdg failed was:sdf

2> Now we have to bring this disk as in vertias volume manager using below command

# cd /etc/vx/bin

# ./vxdisksetup –i sdf format=sliced

3> Now we have to assign sdf to veritas disk newdg02 using below command

# vxdiskadm

Volume Manager Support Operations

Menu:: VolumeManager/Disk

1 Add or initialize one or more disks

2 Encapsulate one or more disks

3 Remove a disk

4 Remove a disk for replacement

5 Replace a failed or removed disk

6 Mirror volumes on a disk

7 Move volumes from a disk

8 Enable access to (import) a disk group

9 Remove access to (deport) a disk group

10 Enable (online) a disk device

11 Disable (offline) a disk device

12 Mark a disk as a spare for a disk group

13 Turn off the spare flag on a disk

14 Unrelocate subdisks back to a disk

15 Exclude a disk from hot-relocation use

16 Make a disk available for hot-relocation use

17 Prevent multipathing/Suppress devices from VxVM's view

18 Allow multipathing/Unsuppress devices from VxVM's view

19 List currently suppressed/non-multipathed devices

20 Change the disk naming scheme

21 Change/Display the default disk layouts

22 Mark a disk as allocator-reserved for a disk group

23 Turn off the allocator-reserved flag on a disklist List disk information

? Display help about menu

?? Display help about the menuing system

q Exit from menusSelect an operation to perform: 5

We have to select the operation number 5 (Replace a failed or removed disk).

will get below option when you select 5

Replace a failed or removed disk

Menu:: VolumeManager/Disk/ReplaceDisk

Use this menu operation to specify a replacement disk for a diskthat you removed with the "Remove a disk for replacement" menu operation, or that failed during use. You will be prompted fora disk name to replace and a disk device to use as a replacement.You can choose an uninitialized disk, in which case the disk willbe initialized, or you can choose a disk that you have alreadyinitialized using the Add or initialize a disk menu operation.

Select a removed or failed disk [,list,q,?] list

Disk group: newdg

DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE

DM NAME DEVICE TYPE PRIVLEN PUBLEN STATE

dm newdg02 - - - - NODEVICE

Select a removed or failed disk [,list,q,?] newdg02

The following devices are available as replacements:sdf

You can choose one of these devices to replace newdg02.

Choose "none" to initialize another device to replace newdg02.

Choose a device, or select "none"[,none,q,?] (default: sdf)sdf

VxVM INFO V-5-2-382

The requested operation is to use the initialized device sdf

to replace the removed or failed disk newdg02 in disk group newdg.

Continue with operation? [y,n,q,?] (default: y) y

Use FMR for plex resync? [y,n,q,?] (default: n) n

VxVM INFO V-5-2-282

Replacement of disk newdg02 in group newdg with disk device

sdf completed successfully.Replace another disk? [y,n,q,?] (default: n) n

4> Use Below command to find if the related volume is startable or not.

# vxinfo -g newdg

newvol01 fsgen Unstartable

The above command shows that the volume is newvol01 is unstartable.

We need to recoverthe volume. Below is the procedure to check the status of the volume

5> # vxprint -g newdg -htq newvol01

v newvol01 - DISABLED ACTIVE 4096000 SELECT - fsgen

pl newvol01-01 newvol01 DISABLED RECOVER 4096000 STRIPE 2/128 RW

sd newdg01-01 newvol01-01 newdg01 0 2048000 0/0 sde ENA

sd newdg02-01 newvol01-01 newdg02 0 2048000 1/0 sdf ENA

Here it can be seen that status of the plex newvol01-01 of volume newvol01 is Disabled and recover.

6> The next step is to off the plex and then to start the plex. This will bring the plex in stale state.

# vxmend -g newdg -o force off newvol01-01

# vxprint -g newdg -htq newvol01

v newvol01 - DISABLED ACTIVE 4096000 SELECT - fsgen

pl newvol01-01 newvol01 DISABLED OFFLINE 4096000 STRIPE 2/128 RW

sd newdg01-01 newvol01-01 newdg01 0 2048000 0/0 sde ENA

sd newdg02-01 newvol01-01 newdg02 0 2048000 1/0 sdf ENA

In the above step the plex is brought offline

7> # vxmend -g newdg on newvol01-01

# vxprint -g newdg -htq newvol01

v newvol01 - DISABLED ACTIVE 4096000 SELECT - fsgen

pl newvol01-01 newvol01 DISABLED STALE 4096000 STRIPE 2/128 RW

sd newdg01-01 newvol01-01 newdg01 0 2048000 0/0 sde ENA

sd newdg02-01 newvol01-01 newdg02 0 2048000 1/0 sdf ENA

In the above command we have brought the plex in stale state.

8> Now we bring the plex in clean state from stale state using below command.

# vxmend -g newdg fix clean newvol01-01

# vxprint -g newdg -htq newvol01

v newvol01 - DISABLED ACTIVE 4096000 SELECT - fsgen

pl newvol01-01 newvol01 DISABLED CLEAN 4096000 STRIPE 2/128 RW

sd newdg01-01 newvol01-01 newdg01 0 2048000 0/0 sde ENA

sd newdg02-01 newvol01-01 newdg02 0 2048000 1/0 sdf ENA

9> Now the only step pending is to start the volume. This will solve our problem.

# vxvol -g newdg start newvol01

# vxprint -g newdg -htq newvol01

v newvol01 - ENABLED ACTIVE 4096000 SELECT newvol01-01 fsgen

pl newvol01-01 newvol01 ENABLED ACTIVE 4096000 STRIPE 2/128 RW

sd newdg01-01 newvol01-01 newdg01 0 2048000 0/0 sde ENA

sd newdg02-01 newvol01-01 newdg02 0 2048000 1/0 sdf ENA

10> Check the status of the volume using below command.

# vxinfo -g newdgnewvol01 fsgen Started

11> Before mounting the file system we need to perform the fsck on raw filesystem.

# fsck -t vxfs –o full –y /dev/vx/rdsk/newdg/newvol01

12> # now the filesystemUsing below command

# mount –a

/dev/vx/dsk/newdg/newvol01 2.0G 18M 1.9G 1% /new

The filesystem have been mounted.

The same way we can create mirriored volumes and Raid 5 volume. only thing we have to remember disk required for each layout and perform the steps accordingle. if still have problem for mirrored volumes mail me on sumedhkhobragade@gmail.com.

Monday, October 12, 2009

Linux Administration

.
Linux is PC-UNIX in which the kernel was created for PC/AT compatibles by Linus Torvalds . The name is derived from the kernel's creator.







Advantages of using Linux



  • Free (free of cost and generally free in what you can do with it)
  • Open-source (the code is available)
  • Secure
  • Available on a number of different architectures and platforms
  • Designed for excellent performance

The combination of the kernel and some application software supporting it for use as a OS is called a "distribution". There are basically three types of distibution

  1. RedHat series (Redhat, fedora, madrik, Turbo,Vine)
  2. Slackware series (Slackware, Plamo Linux)
  3. Debian series (Debian, Ubantu)

Out of these Redhat LINUX is most used one and one can find maximum people ceritified in redhat linux. Training and courseware is avalable for redhat. But debian is the most stable amongst all these versions of linux, as per my experience.