Linux 25 Days

Download as pdf or txt
Download as pdf or txt
You are on page 1of 154

What is Operating System ?

DEFINITION Operating System is a collection of programs that coordinates the operation of computer hardware & software.

Functions of Operating System

Linux Architecture

Process Management Memory Management Data Management I/O Management

Other Programs Shell Kernel

Hardware

What is Kernel ?

What is Shell ?

A set of functions that make up the heart of an OS It is used to provide an application interface between programs and physical devices. Services provided by the kernel Controls execution of processes. Scheduling processes fairly for execution on the CPU. Allocating memory for an executing process.

Shell is the interface between the user and the kernel. Services provided by the shell It interprets all the commands to the kernel The kernel after processing the commands gives back to the shell.

Linux Architecture works

Linux Architecture works

USER
C Shell

USER
C Shell Korn Shell

KERNEL

Borne Shell

Shells
TC Shell

KERNEL

Borne Shell

Shells
TC Shell

Korn Shell

HARDWARE

HARDWARE

History of Unix

History of Unix

MULTICS PROJECT It was started in 1965 on Main frame GE 645 by the joint effort of AT & T Bell Labs General Electricals Massachusetts Institute of Technology (MIT) Multics was written in Assembly Language In 1969 Multics project was dropped. In 1969, Ken Thompson & Dennis Ritchie at Bell Labs - AT&T redesigned the Multics and introduced New OS UNICS (Uniplexed Information &

computing system) It is written in 80 percent of C language and 20 percent assembly language. Later on totally rewritten in C language and named as UNIX (1973 ).

Flavors of UNIX
Vendor OS

History of Unix

In 1988, AT&T shocked the UNIX community by purchasing a percentage of Sun Microsystems which became a threat

AT & T, Bell labs Sun IBM SG SCO BSD HP

SYS III - SYS V SunOS - Solaris AIX IRIX SCO Unix Free BSD Linux HPUX

for other vendors. So, other vendors quickly formed a

consortium group called OSF and former formed their group named UI.
UI (Unix International) AT & T Sun Data General Unisys All Others OSF (Open Software Foundation)

Features of Linux Open Source - Free Multitasking Multi-User Portable Scalability Reliability Biggest servers on this planet running Linux without single second of downtime from last 10yrs Security Inbuilt firewall (iptables)

History of Linux

In 1990s, Linus Torvalds ,a graduate student form University of Helsinky designed a UNIX like kernel on 386 Intel machine and gave this to OSF. Linux Kernel was bundled with many software's from various distributors and it gave rise to many flavors of LINUX.

Linux Distribution

RedHat Linux Versions

Free Editions RedHat 1 To RedHat 9 Fedora core 1 Fedora core 2 Fedora core 3

Commercial Editions

RHEL 1 RHEL 2

RHEL 3 Fedora core 4 Fedora core 5 Fedora core 6 RHEL 4 RHEL 5 - beta

RHEL 4 - Requirements

Red Hat Certifications - RHCE


Editions Processors Minimum RAM Maximum RAM Minimum Hard disk

RHCE One exam, with two parts:


Section I: Troubleshooting and System Maintenance (2.5 hours) Section II: Installation and Configuration (3 hours) Passing the RHCE exam requires the following:
a score of 80 or higher on Section I, consisting of five compulsory and five optionals problems successful completion of Section I compulsory problems within 1 hour 70 percent or more on the RHCT-level skills in Section II 70 percent or more on the RHCE-level skills in Section II

Desktop

128 MB

4 GB

2.3 GB

Workstation

128 MB

4 GB

3 GB

Enterprise

128 MB

8 GB

3 GB

Advanced

16

128 MB

64 GB

3 GB

Red Hat Certifications - RHCT


RHCT One exam, with two parts:
Section I: Troubleshooting and System Maintenance (1 hour) Section II: Installation and Configuration (2 hours) Passing the RHCT exam requires the following:
Successful completion of all troubleshooting problems in Section I A score of 70 percent or higher on Section II

File System Hierarchy

/ /

root root

boot boot

bin bin

var var

etc etc

tmp tmp

media media

home home

sbin sbin

usr usr

dev dev

proc proc

opt opt

lib lib

/root

This Directory is called as root Directory. It is the top of the file system structure. All other Directories are mounted under it.

This is the default home directory of administrator (i.e., root).

/home

/boot

It contains all users home directories.

This Directory contains the Kernel, the core of the operating system. This also contains the files related to booting the system such as the boot loader and the initial ramdisk.

/sbin

/bin

It contains administrative commands used by superuser.

This Directory contains command used by the superuser and the normal users.

/usr

/var

It contains the programs and applications which are available for users (similar to program files on windows)

It contains variable information , such as logs and print queues.

/dev

/etc

This

Directory

contains

devices

nodes

through

It contains all configuration files.

which the operating system can access hardware and software devices on the system.

/proc

/tmp

This

Directory

is

mount currently

point

for

virtual system

This Directory contains temporary files used by the system

information processes.

about

running

This Directory is empty until the proc file system is mounted.

/opt

/media

It contains the third party applications ex:- Corel Word Perfect Sun Star Office

It contains default mount points of removable media such as cdrom, floppy disk, pendrive.

/lib

It

contains

libraries

need

by

no.

of

different

applications as well as linux kernel.

Basic Commands

Print Working Directory Print Working Directory [root@comp1 ~]# pwd [root@comp1 ~]# pwd

Shows list of files & directories Shows list of files & directories [root@comp1 ~]# ls <options> <arguments> [root@comp1 ~]# ls <options> <arguments>

ls Command

ls Command

Listing of files and directories along with the attributes Listing of files and directories along with the attributes [root@comp1 ~]# ls l [root@comp1 ~]# ls l or or [root@comp1 ~]# ll [root@comp1 ~]# ll

Listing of files and directories along with the inode numbers Listing of files and directories along with the inode numbers [root@comp1 ~]# ls il [root@comp1 ~]# ls il

Listing of all files and directories including the hidden Listing of all files and directories including the hidden root@comp1 ~]# ls -a root@comp1 ~]# ls -a

Listing of the attributes of a particular file or directory Listing of the attributes of a particular file or directory [root@comp1 ~]# ls -ld <directory> [root@comp1 ~]# ls -ld <directory>

Listing of all files and directories in reverse order Listing of all files and directories in reverse order [root@comp1 ~]# ls -r [root@comp1 ~]# ls -r

Shows the list of files in Tree structure Shows the list of files in Tree structure [root@comp1 ~]# ls -R <directory> [root@comp1 ~]# ls -R <directory>

Creation of Files

cat command

By using three methods we can create files cat command touch command vi editor
Displaying & Creating Text Files Displaying & Creating Text Files [root@comp1 ~]# cat <options> <arguments> [root@comp1 ~]# cat <options> <arguments>

To create a file To create a file [root@comp1 ~]# cat > <filename> [root@comp1 ~]# cat > <filename>

To view the content of a file To view the content of a file [root@comp1 ~]# cat <filename> [root@comp1 ~]# cat <filename>

To append a file To append a file [root@comp1 ~]# cat >> <filename> [root@comp1 ~]# cat >> <filename>

To transfer the contents of file1 & file2 to file3 To transfer the contents of file1 & file2 to file3 [root@comp1 ~]# cat <file1> <file2> >> <file3> [root@comp1 ~]# cat <file1> <file2> >> <file3>

touch command

Creating Directories

To create a directory To create a directory [root@comp1 ~]# mkdir <directory name> [root@comp1 ~]# mkdir <directory name> To create a file with zero bytes as well as to change the time To create a file with zero bytes as well as to change the time stamp of file or directory. stamp of file or directory. [root@comp1 ~]# touch <filename> [root@comp1 ~]# touch <filename> To create multiple directories To create multiple directories [root@comp1 ~]# mkdir <dir1> <dir2> <dir3> [root@comp1 ~]# mkdir <dir1> <dir2> <dir3> To create multiple files To create multiple files [root@comp1 ~]# touch <file1> <file2> <file3> [root@comp1 ~]# touch <file1> <file2> <file3> To create nested directories To create nested directories [root@comp1 ~]# mkdir -p <dir1>/<dir2>/<dir3> [root@comp1 ~]# mkdir -p <dir1>/<dir2>/<dir3>

Navigation of Directories

Navigation of Directories

To change the directory To change the directory [root@comp1 ~]# cd <path of the directory> [root@comp1 ~]# cd <path of the directory>

To change directory to last working directory To change directory to last working directory [root@comp1 ~]# cd [root@comp1 ~]# cd

To change directory one level back To change directory one level back [root@comp1 ~]# cd .. [root@comp1 ~]# cd ..

To change directory to home directory To change directory to home directory [root@comp1 ~]# cd or [root@comp1 ~]# cd or [root@comp1 ~]# cd ~ [root@comp1 ~]# cd ~

To change directory two levels back To change directory two levels back [root@comp1 ~]# cd ../.. [root@comp1 ~]# cd ../..

Removing a File or Directory

Copying a File or Directory

To remove a file To remove a file [root@comp1 ~]# rm <filename> [root@comp1 ~]# rm <filename> To copy a file To copy a file [root@comp1 ~]# cp <source file path> <destination file path> [root@comp1 ~]# cp <source file path> <destination file path> To remove empty directory To remove empty directory [root@comp1 ~]# rmdir <directory name> [root@comp1 ~]# rmdir <directory name>
To copy a directory To copy a directory [root@comp1 ~]# cp r <source dir path> <destination dir path> [root@comp1 ~]# cp r <source dir path> <destination dir path>

To remove directory recursively and forcefully To remove directory recursively and forcefully [root@comp1 ~]# rm rf <directory name> [root@comp1 ~]# rm rf <directory name>

Moving / Renaming a File or Directory

To move a file/dir to a different location To move a file/dir to a different location [root@comp1 ~]# mv <source path> <destination path> [root@comp1 ~]# mv <source path> <destination path>

To rename file/dir move at same location To rename file/dir move at same location [root@comp1 ~]# mv <old name> <new name> [root@comp1 ~]# mv <old name> <new name>

Editors

Editors are used for inserting or deleting text. Windows DOS Linux/Unix CLI based GUI based : EX , ED , VI : Emacs, Gedit, nedit, nano, pico : Notepad : Edit

VI Editor modes

VI Editor - Modes
Press Press i, I a, A, o, O i, I a, A, o, O or INSERT or INSERT to enter into the to enter into the insert mode from insert mode from command mode command mode

There are three modes of operations in VI Editor : Insert Mode Command Mode Execute Mode

Press Press Shift + :: Shift + to go into execute to go into execute mode mode

Command Mode

Press Press Press Press ESCAPE ESCAPE Insert your ESCAPE ESCAPE You can save Insert your You can Mode save Executecome out to come out Insert Mode to come out from from to come from to from yourtext here outthe excute mode here text text yourtext here mode to excute mode here the the insert mode to the insert to command mode to command mode command mode command mode

How to get into Insert Mode

At Execute Mode

:q i I a A o O r - inserts the text at current cursor position - inserts the text at beginning of line - appends the text after current cursor position - appends the text at end of line - inserts a line below current cursor position - inserts a line above current cursor position - replace a single char at current cursor position :q! :w :wq :wq! :x Shift+ZZ :sh

- quit without saving - quit forcefully without saving - save - save & quit - save & quit forcefully - save & quit - save & quit - Provides temporary shell

At Execute Mode

Delete/Copy/Paste/Undo in command mode

dd :set number :se nu :set nonumber :se nonu :84 - Setting line numbers - Setting line numbers - Removing line numbers - Removing line numbers - Press enter goes to line 84 2dd yy 2yy p

- Deletes a line - Deletes 2 lines - Copy a line - Copies 2 lines - After deleting or copying, by pressing p the deleted or copied contents will be pasted below the position of cursor.

u Ctrl+r G 5G

- Undo (can undo 1000 times) - Redo - Moves cursor to last line of file - Moves cursor to 5th line of file

User & Group Administration

Unix/Linux is multi user and multi tasking OS Redhat Linux uses User Private Group (UPG) Scheme : User always get created with primary group One Primary Group per User When a user is created in Linux :- home directory ( /home/username) mail account (/var/spool/mail/username) unique UID & GID

Types of Users

User and Group Administration Database Files

TYPES OF USERS TYPES OF USERS

/etc/passwd /etc/shadow /etc/group

System Users System Users 0 499 0 499

Normal Users Normal Users 500 60,000 500 60,000

/etc/passwd - Database file of users

/etc/shadow

This file contains the encrypted user passwords assigned by the password binary file

u1:x:500:500:prog:/home/u1:/bin/bash

Passwords are encrypted through DES (Data Encryption Standard ) or MD5 (Message Digest Ver. 5) Algorithm

User User

UID UID

User User Comment Comment Home Home Directory Directory

Shell Shell

u1: hjkadfhs8974uyh5jrt/ :13536:0:99999:7:::

Mask Mask Passwd Passwd

GID GID

User Name User Name

Encrypted Encrypted Password Password

No. of days No. of days Since 1970 Since 1970

Max no. of Max no. of days to change days to change password password

Min. no. of Min. no. of days to change days to change password password

Warning Warning Days Days

/etc/group

User Creation

This file contains Group Name and GID of the groups

Creating a User Creating a User [root@comp1 ~]#useradd <options> <username> [root@comp1 ~]#useradd <options> <username>

u1:x:500:sachin,tom

Options : -u - UID - Primary group name/ GID - Override - Secondary group - Comment - Home directory - Shell

Group Group Name Name

-g GID GID -o -G

Mask Members of Mask Members of Passwd that Group Passwd that Group

-c -d -s

User Modification

User Deletion

Modifying a User Modifying a User [root@comp1 ~]#usermod <options> <username> [root@comp1 ~]#usermod <options> <username>

Deleting a User Deleting a User [root@comp1 ~]#userdel <options> <username> [root@comp1 ~]#userdel <options> <username>

Options : -l -L -U - Change login name - Lock the account - Unlock the account

Options : -r - recursively

Group Creation

Group Modification

Creating a Group Creating a Group [root@comp1 ~]#groupadd <options> <groupname> [root@comp1 ~]#groupadd <options> <groupname>

Modifying a Group Modifying a Group [root@comp1 ~]#groupmod <options> <groupname> [root@comp1 ~]#groupmod <options> <groupname>

Options : -g -o - GID - override

Options : -g -o -n - GID - Override - To change the group name

Group Deletion

Changing user setting

Deleting a Group Deleting a Group [root@comp1 ~]#groupdel <groupname> [root@comp1 ~]#groupdel <groupname>

Changing User setting Changing User setting [root@comp1 ~]#chage <username> [root@comp1 ~]#chage <username>

Group setting

Group setting Group setting [root@comp1 ~]#gpasswd <options> <groupname> [root@comp1 ~]#gpasswd <options> <groupname>

Options : -a -d -M - add a user - Delete a user from group - Creating multiple members

Basic File Permission

The Unix/Linux file has 8 attributes which are listed with ls l


- rw-r--r-- 1 root root 1229 Jan 29 17:44 anacondaks.cfg

Type Type

Links Links

Group Group

Modification Modification Date & Time Date & Time

Access Access Permissions Permissions

Owner Owner

Size Size (Bytes) (Bytes)

File Name File Name

Access Permission

Permission - Access Mode

Type Type
-d d ll p p s s b b c c

rwx
Owner Owner

rwx
Group Group

rwx
Access Mode r File Directory

files files directories directories links links process file process file socket files socket files block devices block devices character character device device

Others Others

To display contents of a file

To list contents of a dir.

To create or append a file.

To create files & directories.

To execute a file.

To execute to a directory.

File Permission Modes

Binary to Decimal Conversion

Permissions Permissions

Total 3 bits, Value will be 0s and 1s i.e. 23 = 8 combination 22 0 0 0 0 1 1 1 1 r 21 0 0 1 1 0 0 1 1 w 20 0 1 0 1 0 1 0 1 x

Symbolic Mode Symbolic Mode rr w x w x

Absolute Mode Absolute Mode 4 2 1 4 2 1

= = = = = = = =

0 1 2 3 4 5 6 7

None None Execute (x) Execute (x) Write (w) Write (w) Write & Execute (wx) Write & Execute (wx) Read (r) Read (r) Read & Execute (rx) Read & Execute (rx) Read & Write (rw) Read & Write (rw) Read, Write & Execute (rwx) Read, Write & Execute (rwx) Permissions Permissions

Default File Permission

Default File Permission

When a file created with the help of cat, touch, vi will get the permissions as 644. - rw- r-- r-i.e.
read-write for the owner. read-only read-only for the owners group and for the others

Actually in the basic UNIX system when a file is created it gets the permission as 666. But this lapses in security, so when ever a file is created in UNIX system it masks some bits, with a mask value of 022. After masking we get the default value of a file as 644. [666 022 = 644] 022 is as the UMASK value.

Umask

Default Directory Permission

To view the Umask value To view the Umask value [root@comp1 ~]#umask [root@comp1 ~]#umask

When a directory is created with the help of mkdir will get the permissions as 755. d rwx r-x r-x

To view Umask value from file To view Umask value from file [root@comp1 ~]#vi /etc/bashrc [root@comp1 ~]#vi /etc/bashrc

Default Directory Permission

chmod Command

Actually in the basic UNIX system when a directory is created it gets the permission as 777. But this lapses in security, so when ever a directory is created in UNIX system it masks some bits, with a mask value of 022. After masking we get the default value of a file as 777. [777 022 = 755] 022 is as the UMASK value.

chmod command is used to change the permissions of a file/directory. chmod can be used by the owner of the file or by root. With chmod command we can assign permissions or remove permissions as required.
Applying permission to File or Directory Applying permission to File or Directory [root@comp1 ~]#chmod <permissions> <file/direccory> [root@comp1 ~]#chmod <permissions> <file/direccory>

Permission parameters used with chmod command Category Operators Permissions Weight u + r 4 g w 2 o = x 1

Example of Permission - Absolute

Example of Permission - Symbolic

Applying permission to Owner (u), Group (g) & Others (o) for File1

Applying permission to Owner (u), Group (g) & Others (o) for File1

chmod

456

file1

chmod

u=r,g=rx,o=rw file1

u u

g g

o o

u u

g g

o o

4=r 4=r

4+1=rx 4+2=rw 4+1=rx 4+2=rw

SUID

SUID stands for Set User ID. SUID allows applications to run by normal user with privileges of root user. That means in case I have an application (eg. ping) whose owner is 'root' and it has its SUID bit set, then when I run this application as a normal user, that application would still run as root. By default the SUID will be applied on ping so that the normal users will also can ping to other systems.

Example
[root@localhost ~]# ping 192.168.0.2

Example

Comp1 192.168.0.1 Administrator

Comp2 192.168.0.2

Comp1 192.168.0.1 Administrator

Comp2 192.168.0.2

Comp3 192.168.0.3

Comp4 192.168.0.4

Comp3 192.168.0.3

Comp4 192.168.0.4

Example
[root@localhost ~]# ping 192.168.0.2 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 time=0.047 time=0.047 time=0.047 time=0.047 ms ms ms ms

--- 192.168.0.2 ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 min/avg/max/mdev [root@localhost ~]#

Comp1 192.168.0.1 Administrator

Comp2 192.168.0.2

Comp3 192.168.0.3

Comp4 192.168.0.4

Example
[user@localhost ~]$ ping 192.168.0.2

Example

Comp1 192.168.0.1 User

Comp2 192.168.0.2

Comp1 192.168.0.1 User

Comp2 192.168.0.2

Comp3 192.168.0.3

Comp4 192.168.0.4

Comp3 192.168.0.3

Comp4 192.168.0.4

Example
[user@localhost ~]$ ping 192.168.0.2 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 time=0.047 time=0.047 time=0.047 time=0.047 ms ms ms ms

--- 192.168.0.2 ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 min/avg/max/mdev [user@localhost ~]$

Comp1 192.168.0.1 User

Comp2 192.168.0.2

Comp3 192.168.0.3

Comp4 192.168.0.4

SUID commands

Example
[root@localhost ~]# ping 192.168.0.2

To remove SUID To remove SUID [root@comp1 ~]#chmod 0755 /bin/ping [root@comp1 ~]#chmod 0755 /bin/ping

Comp1 192.168.0.1 Administrator

Comp2 192.168.0.2

To add SUID To add SUID [root@comp1 ~]#chmod 4755 /bin/ping [root@comp1 ~]#chmod 4755 /bin/ping
Comp3 192.168.0.3 Comp4 192.168.0.4

Example
[root@localhost ~]# ping 192.168.0.2 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 time=0.047 time=0.047 time=0.047 time=0.047 ms ms ms ms

Comp1 192.168.0.1 Administrator

Comp2 192.168.0.2

--- 192.168.0.2 ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 min/avg/max/mdev [root@localhost ~]#

Comp3 192.168.0.3

Comp4 192.168.0.4

Example

Example
[user@localhost ~]$ ping 192.168.0.2

Comp1 192.168.0.1 Administrator

Comp2 192.168.0.2

Comp1 192.168.0.1 User

Comp2 192.168.0.2

Comp3 192.168.0.3

Comp4 192.168.0.4

Comp3 192.168.0.3

Comp4 192.168.0.4

Example
[user@localhost ~]$ ping 192.168.0.2 ping: icmp open socket: Operation not permitted [user@localhost ~]$

Comp1 192.168.0.1 User

Comp2 192.168.0.2

Comp3 192.168.0.3

Comp4 192.168.0.4

Example

SGID

SGID

is

used

for

group

inheritance,

when

SGID is applied to a directory, all sub directories


Comp1 192.168.0.1 User

& files created by any user in that particular


Comp2 192.168.0.2

directory would be owned by the specified group, regardless of users group.

Comp3 192.168.0.3

Comp4 192.168.0.4

Sticky Bit

Sticky bit is used to restrict others from removing the files/dirs. When applied only owner of that particular file/dir can delete them. Root / Superuser can also remove them, even if it is applied.

Partitioning

Pre-Installation tool Disk Druid Post-Installation tools Fdisk Parted Cfdisk sfdisk

Naming Conventions

Commands

Controller

Master / Slave Primary Master

Linux hda hdb hdc hdd

Solaris c0d0 c0d1 c1d0 c1d1

To view list of partitions To view list of partitions [root@comp1 ~]#fdisk -l <device name> [root@comp1 ~]#fdisk -l <device name>

IDE-0 Primary Slave Secondary Master IDE-1 Secondary Slave

Creation of Partition

Creation of Partition
Creating a new partition Creating a new partition [root@comp1 ~]#fdisk /dev/hda [root@comp1 ~]# The number of cylinders for this disk is set to 4865. The number of cylinders for this disk is set to 4865. There is nothing wrong with that, but this is larger than 1024, There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): m Command (m for help): Command action Command action a toggle a bootable flag a toggle a bootable flag b edit bsd disklabel b edit bsd disklabel cc toggle the dos compatibility flag toggle the dos compatibility flag d delete a partition d delete a partition ll list known partition types list known partition types m print this menu m print this menu n add a new partition n add a new partition o create a new empty DOS partition table o create a new empty DOS partition table p print the partition table p print the partition table q quit without saving changes q quit without saving changes ss create a new empty Sun disklabel create a new empty Sun disklabel tt change a partition's system id change a partition's system id u change display/entry units u change display/entry units vv verify the partition table verify the partition table w write table to disk and exit w write table to disk and exit x extra functionality (experts only) x extra functionality (experts only) Command (m for help): Command (m for help):

Creating a new partition Creating a new partition [root@comp1 ~]#fdisk <device name> [root@comp1 ~]#fdisk <device name>

Commands

Ext2 vs Ext3

Updates the partition table to kernel without restarting Updates the partition table to kernel without restarting [root@comp1 ~]#partprobe /dev/sda [root@comp1 ~]#partprobe /dev/sda

Ext2 No journaling support Less speed Less secure

Ext3 Journaling supported More speed More secure

Formatting of partition

Mounting Filesystem

To format partition using ext3 filesystem To format partition using ext3 filesystem [root@comp1 ~]#mkfs.ext3 <partition> [root@comp1 ~]#mkfs.ext3 <partition>

Created a directory for mounting the partition Created a directory for mounting the partition [root@comp1 ~]#mkdir <directory name> [root@comp1 ~]#mkdir <directory name>

To format partition using ext2 filesystem To format partition using ext2 filesystem [root@comp1 ~]#mkfs.ext2 <partition> [root@comp1 ~]#mkfs.ext2 <partition>

To mount the filesystem on the created directory To mount the filesystem on the created directory [root@comp1 ~]#mount <partition> <directory name> [root@comp1 ~]#mount <partition> <directory name>

To format partition using vfat filesystem To format partition using vfat filesystem [root@comp1 ~]#mkfs.vfat <partition> [root@comp1 ~]#mkfs.vfat <partition>

To unmount the filesystem To unmount the filesystem [root@comp1 ~]#umount <directory name> [root@comp1 ~]#umount <directory name>

Mounting Filesystem - Permanently

/etc/fstab

To mount filesystem permanently To mount filesystem permanently [root@comp1 ~]#vi /etc/fstab [root@comp1 ~]#vi /etc/fstab

To add the entry To add the entry # This file is edited by fstab-sync --see 'man fstab-sync' for details # This file is edited by fstab-sync see 'man fstab-sync' for details LABEL=/1 / ext3 defaults 00 LABEL=/1 / ext3 defaults 00 /dev/hda1 /dev/hda1 None None None None LABEL=/home1 LABEL=/home1 none none none none /boot /boot /dev/pts /dev/pts /dev/shm /dev/shm /home /home /proc /proc /sys /sys ext3 ext3 defaults defaults 12 12

devpts gid=5,mode=620 0 0 devpts gid=5,mode=620 0 0 tmpfs tmpfs ext3 ext3 proc proc sysfs sysfs defaults defaults defaults defaults defaults defaults defaults defaults 00 00 00 00 00 00 00 00

/dev/hda2 /usr ext3 /dev/hda2 /usr ext3 LABEL=/var1 /var ext3 LABEL=/var1 /var ext3 LABEL=SWAP-hda7 swap swap LABEL=SWAP-hda7 swap swap /dev/hdd /media/cdrom auto /dev/hdd /media/cdrom auto /dev/hda10 /mnt ext3 /dev/hda10 /mnt ext3

defaults 00 defaults 00 defaults 12 defaults 12 defaults 00 defaults 00 pamconsole,exec,noauto,managed 0 0 pamconsole,exec,noauto,managed 0 0 defaults 00 defaults 00

Converting from Ext2 to Ext3

Converting from Ext3 to Ext2

Unmount the partition Unmount the partition [root@comp1 ~]#umount <partition> [root@comp1 ~]#umount <partition>

Unmount the partition Unmount the partition [root@comp1 ~]#umount <partition> [root@comp1 ~]#umount <partition>

Converting from Ext2 to Ext3 filesystem Converting from Ext2 to Ext3 filesystem [root@comp1 ~]#tune2fs j <partition> [root@comp1 ~]#tune2fs j <partition>

Converting from Ext3 to Ext2 filesystem Converting from Ext3 to Ext2 filesystem [root@comp1 ~]#tune2fs O ^has_ journal <partition> [root@comp1 ~]#tune2fs O ^has_ journal <partition>

Mount the partition to use it Mount the partition to use it [root@comp1 ~]#mount <partition> <directory name> [root@comp1 ~]#mount <partition> <directory name> [root@comp1 ~]#mount [root@comp1 ~]#mount

Mount the partition to use it Mount the partition to use it [root@comp1 ~]#mount <partition> <directory name> [root@comp1 ~]#mount <partition> <directory name> [root@comp1 ~]#mount [root@comp1 ~]#mount

Label

How swap works ?

To assign label To assign label [root@comp1 ~]#e2label <partition> <label_name> [root@comp1 ~]#e2label <partition> <label_name>

New New Process Process

Process D

RAM

To view existing label To view existing label [root@comp1 ~]#e2label <partition> [root@comp1 ~]#e2label <partition>
Idle Idle

Process C Process B Process A Operating System

HDD Swap Partition hda3 hda2 hda1

To see mounted partition with Label To see mounted partition with Label [root@comp1 ~]#mount -l [root@comp1 ~]#mount -l

RAM RAM FULL FULL

Creation of Swap partition

Swap Partition

Creating a new partition Creating a new partition [root@comp1 ~]#fdisk <options> <partition> [root@comp1 ~]#fdisk <options> <partition>

To enable swap on the swap partition To enable swap on the swap partition [root@comp1 ~]#swapon <partition> [root@comp1 ~]#swapon <partition>

To make a partition swap partition To make a partition swap partition [root@comp1 ~]#mkswap <partition> [root@comp1 ~]#mkswap <partition>

To check the status of swap used To check the status of swap used [root@comp1 ~]#swapon -s <partition> [root@comp1 ~]#swapon -s <partition>

To disable the swap partition To disable the swap partition [root@comp1 ~]#swapoff <partition> [root@comp1 ~]#swapoff <partition>

Access Control List

To configure different set of file permissions for different users on a single resource (file/folder), ACLs are implemented. ACLs can be implemented only on ACL enabled partitions ACLs can be applied on Users Groups

Example

Example

File Created by root File Created by root User ::root ::rw_ User root rw_ Group ::root ::r_ _ Group root r_ _ Others ::r_ _ Others r_ _
Hello Hello How r U

Permission :: Permission Read Read


Quotation

Quotation

/aclmount

/aclmount

root

usr1

Example

Example

Applying Permission Applying Permission User ::usr1 ::_ _ _ User usr1 _ _ _ Group ::sales ::rw _ Group sales rw _
Hello Hello

Permission :: Permission Read Read

How r U

Quotation

Quotation

/aclmount

/aclmount

Sales

root

Example

Example

Permission Permission Denied Denied

Hello

Permission Permission Read/Write Read/Write

Hello How r U

Quotation

Quotation

/aclmount

/aclmount

usr1

Sales

Steps

Steps

Create a new partition Create a new partition [root@comp1 ~]#fdisk /dev/hda [root@comp1 ~]#fdisk /dev/hda

Mount New partition with ACL option Mount New partition with ACL option [root@comp1 ~]#mount -o acl /dev/hda9 /aclmount [root@comp1 ~]#mount -o acl /dev/hda9 /aclmount

Format the Partition Format the Partition [root@comp1 ~]#mkfs.ext3 /dev/hda9 [root@comp1 ~]#mkfs.ext3 /dev/hda9

Create Users Create Users [root@comp1 ~]#useradd usr1 [root@comp1 ~]#useradd usr1 [root@comp1 ~]#useradd usr2 [root@comp1 ~]#useradd usr2 [root@comp1 ~]#useradd usr3 [root@comp1 ~]#useradd usr3

Create a new mount point Create a new mount point [root@comp1 ~]#mkdir /aclmount [root@comp1 ~]#mkdir /aclmount

Create Groups Create Groups [root@comp1 ~]#groupadd sales [root@comp1 ~]#groupadd sales

Steps

Applying ACL

Add some users to group Add some users to group [root@comp1 ~]#gpasswd M usr1,usr2 sales [root@comp1 ~]#gpasswd M usr1,usr2 sales

ACL permissions to the directory for the user ACL permissions to the directory for the user [root@comp1 ~]#setfacl m u:usr1: /aclmount/quotation [root@comp1 ~]#setfacl m u:usr1: /aclmount/quotation

Create files into the ACL enabled partition Create files into the ACL enabled partition [root@comp1 ~]#vi /aclmount/quotation [root@comp1 ~]#vi /aclmount/quotation

ACL permissions to the directory for the group ACL permissions to the directory for the group [root@comp1 ~]#setfacl -m g:sales:rw /aclmount/quotation [root@comp1 ~]#setfacl -m g:sales:rw /aclmount/quotation

The default permissions for the directory / file will be The default permissions for the directory / file will be rw_r__r__ rw_r__r__

ACL

To list applied ACL applied on a File To list applied ACL applied on a File [root@comp1 ~]#getfacl /aclmount/quotation [root@comp1 ~]#getfacl /aclmount/quotation

Remove ACL from a file Remove ACL from a file [root@comp1 ~]#setfacl x u:usr1 /aclmount/quotation [root@comp1 ~]#setfacl x u:usr1 /aclmount/quotation

What is LVM ?

LVM is a method of allocating hard drive space into logical volumes that can be easily resized instead of partitions. With LVM, the hard drive or set of hard drives is allocated to one or more physical volumes. The physical volumes are combined into volume groups. Each volume group is divided into logical volumes, which are assigned mount points such as /home and / and file system types such as ext3.

Steps to configure LVM ?

Logical Volume Group

Create physical volumes from the hard drives. Create volume groups from the physical volumes. Create logical volumes from the volume groups and assign the logical volumes mount points.

Logical Volumes

Implementing LVM First create normal partitions.


Create Physical Volume from previously created partitions Create Physical Volume from previously created partitions [root@comp1 ~]# pvcreate /dev/hda9 /dev/hda10 [root@comp1 ~]# pvcreate /dev/hda9 /dev/hda10 /dev/hda11 /dev/hda11

To see the physical volume details To see the physical volume details root@comp1 ~]# pvdisplay |less root@comp1 ~]# pvdisplay |less

Implementing LVM

Access LVM

Creation of Volume Group Creation of Volume Group [root@comp1 ~]# vgcreate <VG name> <PV1> <PV2> [root@comp1 ~]# vgcreate <VG name> <PV1> <PV2>

Resizing Logical Volume Resizing Logical Volume [root@comp1 ~]# mkdir /lvm [root@comp1 ~]# mkdir /lvm

To get the information about Volume Group To get the information about Volume Group root@comp1 ~]# vgdisplay <VG name> root@comp1 ~]# vgdisplay <VG name>

Mount logical volume on mount point Mount logical volume on mount point root@comp1 ~]# mount /dev/zoom/linux /lvm root@comp1 ~]# mount /dev/zoom/linux /lvm

Create Logical Volume Create Logical Volume root@comp1 ~]# lvcreate -L <size> <VG name> n root@comp1 ~]# lvcreate -L <size> <VG name> n <volume name> <volume name>

Access Logical Volume Access Logical Volume root@comp1 ~]# cd /lvm root@comp1 ~]# cd /lvm root@comp1 ~]# touch a1 b1 c1 root@comp1 ~]# touch a1 b1 c1

Managing LVM

Create a mount point Create a mount point [root@comp1 ~]# lvresize -L +sizeM LVname [root@comp1 ~]# lvresize -L +sizeM LVname

Removing Logical Volume Removing Logical Volume root@comp1 ~]# lvremove LVname root@comp1 ~]# lvremove LVname

Resizing Volume Group Resizing Volume Group root@comp1 ~]# vgextend VGname PVname root@comp1 ~]# vgextend VGname PVname

Quotas

Quota allows Administrator to specify restriction in two ways : Restricting a user or a group by creating files in a specific location. Restricting a user or a group by the disk space in a specific location.

Advantages of Quotas

Types of Quotas

The idea behind quotas is that users are forced to stay under their disk consumption limit or with number of files in a particular location.

Quotas are of two types : User level quotas Group level quotas usrquota grpquota

Quota is handled on a per user, per file system basis.

Steps for applying Quota on new partition

Quotas Creation

Initially create a new partition. Create a new mount point. Format the new partition with ext2 or ext3.

To enable the new partition with usrquota and grpquota To enable the new partition with usrquota and grpquota [root@comp1 ~]#mount -o usrquota,grpquota <part_name> [root@comp1 ~]#mount -o usrquota,grpquota <part_name> <mnt_pt> <mnt_pt>

To generate the database files inside the quota partition To generate the database files inside the quota partition [root@comp1 ~]#quotacheck -cugv <quota_mnt_pt> [root@comp1 ~]#quotacheck -cugv <quota_mnt_pt>

Quotas Creation

To turn on the quota To turn on the quota [root@comp1 ~]#quotaon <quota_mnt_pt> [root@comp1 ~]#quotaon <quota_mnt_pt>

To apply the quotas for the users on quota enabled partition To apply the quotas for the users on quota enabled partition [root@comp1 ~]#edquota -u <user name> [root@comp1 ~]#edquota -u <user name>

To apply the quotas for a group on quota enabled partition To apply the quotas for a group on quota enabled partition [root@comp1 ~]#edquota -g <group name> [root@comp1 ~]#edquota -g <group name>

Boot Phases
BIOS Initialization Performs first POST If all H/W connectivity is correct gives a healthy beep. Active Partition 2 Bytes Boot Strap Finds the device from where to boot :- Floppy - CDrom Partition Information 64 Bytes - Harddisk

Hardware Boot

Boot Loader

Boot Loader Initialization - Grub

Kernel

Kernel initializes the devices It mounts the root file system (/) Stage 2 ItStage first process init process (/sbin/init) start 1 Sector of kernel Init reads /etc/inittab - vmlinuz Stage contains what programs or services should Initrd....img This file2 be run at different run levels : init 0 shutdown init 1 single user mode Local host login : init 2 multiuser mode + init 3 multiuser mode + for all services init 4 (unused) init 5 multiuser mode + Fullsupport for all init 6 restart or reboot

Init

Login Screen

only text + No support for NFS only text + Full Support

text mode+ GUI + services

To Manage Services

To display status of all services To display status of all services [root@comp1 ~]#chkconfig [root@comp1 ~]#chkconfig --list --list

To display status of particular service To display status of particular service [root@comp1 ~]#chkconfig --list network [root@comp1 ~]#chkconfig --list network

To change services at certain Runlevel To change services at certain Runlevel [root@comp1 ~]#chkconfig --level 2345 <service> <on/off> [root@comp1 ~]#chkconfig --level 2345 <service> <on/off>

To start / stop any service temporarily To start / stop any service temporarily [root@comp1 ~]#service <service name> <start/stop/restart> [root@comp1 ~]#service <service name> <start/stop/restart>

What is Backup ?

Copy data to alternate media Prevent data loss Only Administrators can backup the data

Back Up Data Back Up Data

Corrupted Data Corrupted Data

Restore Data Restore Data

Types of Data

Types of Backup Full Backup Complete back up of entire system. Incremental Backup It includes all files that were changed since the last backup. It always smaller than differential backup. Differential Backup It includes all the files that were changed since the last full backup. As time increases since the last full-backup the size of differential backup increases.

System Generated Data User Generated Data

Commands for Backup tar (tape archive) cpio (copy input/output) dump

tar command

To take the backup To take the backup [root@comp1 ~]#tar <options> <destination> <source> [root@comp1 ~]#tar <options> <destination> <source>

Options : -c -v -f -t -x -w -z - Create - Verbose - File - Table of content - Extract to - Interactive - Zip

tar Command

tar Command

To take the backup To take the backup [root@comp1 ~]#tar -cvf <path><file name> <source> [root@comp1 ~]#tar -cvf <path><file name> <source>

To backup along with zip To backup along with zip [root@comp1 ~]#tar -cvzf <path><file name> <source> [root@comp1 ~]#tar -cvzf <path><file name> <source>

To list the content of tar file To list the content of tar file [root@comp1 ~]#tar -tvf <path><file name> [root@comp1 ~]#tar -tvf <path><file name>

To uncompress the content of tar.gz file To uncompress the content of tar.gz file [root@comp1 ~]#tar -xvzf <path><file name> [root@comp1 ~]#tar -xvzf <path><file name>

To extract the content of tar file To extract the content of tar file [root@comp1 ~]#tar -xvf <path><file name> [root@comp1 ~]#tar -xvf <path><file name>

cpio copy input output

Dump & Restore

To backup To backup [root@comp1 ~]#ls <options> | cpio ov > <file name> [root@comp1 ~]#ls <options> | cpio ov > <file name>

To backup To backup [root@comp1 ~]#dump -0uf <device> <file name> [root@comp1 ~]#dump -0uf <device> <file name>

To extract To extract [root@comp1 ~]#cpio iv < <file name> [root@comp1 ~]#cpio iv < <file name>

To extract To extract [root@comp1 ~]#restore -f <path> [root@comp1 ~]#restore -f <path>

Remote Backup

Automation Jobs

To store the data at another location is called as remote backup.


To backup To backup [root@comp1 ~]#rsync avz <source> -e [root@comp1 ~]#rsync avz <source> -e ssh <destination ip>:<directory> ssh <destination ip>:<directory> or or [root@comp1 ~]#scp r <source> <destination ip>:<directory> [root@comp1 ~]#scp r <source> <destination ip>:<directory>

As a system administrator some task are repetitive like backup, monitoring log files, etc To automate them: at batch cron

RAIDs available in Linux

RAID 0 (striping without parity) RAID 1 (disk mirroring) RAID 4 (parity) RAID 5 (disk striping with parity)

RAID 0

How RAID 0 works ?

Minimum - 2 Hard Disks Maximum - 32 Hard Disks Data is written alternately and evenly to two or more disks Read & Write Speed is Fast Fault Tolerance is not available
123456 1 3 5 2 4 6

Disk 1 Meta Disk Disk 2

root

How RAID 0 works ?

RAID 1 Minimum - 2 Hard Disks Maximum - 2 Hard Disks Simultaneously data will be written to two volumes on two different disks

123456 1 3 5 2 4 6

Read Speed is Fast & Write Speed is Slow


Disk 1 Meta Disk Disk 2

Fault Tolerance is available 50% overhead

root

How RAID 1 works ?

RAID 4

Minimum - 3 Hard Disks Maximum - 32 Hard Disks Data is written alternately and evenly to two or more disks and a parity is only written on one
123 1 2 3 1 2 3

disk
Disk 1 Meta Disk Disk 2

Read & Write Speed is Fast Fault Tolerance is available

root

How RAID 4 works ?

123456 1 3 5 2 4 6

Disk 1

Disk 2 Meta Disk 3

P=1&2 P=3&4 Disk P=5&6

root

RAID 5

How RAID 5 works ?

Minimum - 3 Hard Disks Maximum - 32 Hard Disks Data is written alternately and evenly to two disks and a parity is written on all disk
123456

Read & Write Speed is Fast Fault Tolerance is available Also Known as Striped with parity

1 3 Disk P=5&6

2 P = Meta Disk 3&4 Disk 2 5 P = 1+2 4 Disk 6

root

What will happen ?

Steps

New Disk DiskDataFails Generate Data Disk2 Fails Generate 2 Recovered Data Loss Data Recovered Data Loss Data

Create multiple partitions Create multiple partitions [root@comp1 ~]#fdisk /dev/sda [root@comp1 ~]#fdisk /dev/sda

1 3 Disk P=5&6 2 P=3&4 Disk 5 P = 1+2 4 Disk 6

1 2 3

To update the Kernel without restarting To update the Kernel without restarting [root@comp1 ~]#partprobe /dev/sda [root@comp1 ~]#partprobe /dev/sda

Meta Disk

root

RAID Commands

RAID Commands

To club all the RAID partitions in to a single array To club all the RAID partitions in to a single array [root@comp1 ~]#mdadm -C /dev/md0 -n3 /dev/sda8 [root@comp1 ~]#mdadm -C /dev/md0 -n3 /dev/sda8 /dev/sda9 /dev/sda10 -l5 /dev/sda9 /dev/sda10 -l5

Create Mount Point of RAID Device Create Mount Point of RAID Device [root@comp1 ~]#mkdir /raid [root@comp1 ~]#mkdir /raid

To display RAID device To display RAID device [root@comp1 ~]#mdadm -D /dev/md0 [root@comp1 ~]#mdadm -D /dev/md0

Mount the Raid device Mount the Raid device [root@comp1 ~]#mount /dev/md0 /raid [root@comp1 ~]#mount /dev/md0 /raid [root@comp1 ~]#cd /raid [root@comp1 ~]#cd /raid

To format RAID device To format RAID device [root@comp1 ~]#mkfs.ext3 /dev/md0 [root@comp1 ~]#mkfs.ext3 /dev/md0

RAID Commands

RAID Commands

To make a partition faulty To make a partition faulty [root@comp1 ~]#mdadm -f /dev/md0 /dev/sda10 [root@comp1 ~]#mdadm -f /dev/md0 /dev/sda10

To stop the RAID To stop the RAID [root@comp1 ~]#mdadm -S /dev/md0 [root@comp1 ~]#mdadm -S /dev/md0

To remove partition from RAID array To remove partition from RAID array [root@comp1 ~]#mdadm -r /dev/md0 /dev/sda10 [root@comp1 ~]#mdadm -r /dev/md0 /dev/sda10

To activate RAID To activate RAID [root@comp1 ~]#mdadm -A /dev/md0 /dev/sda8 [root@comp1 ~]#mdadm -A /dev/md0 /dev/sda8

/dev/sda9 /dev/sda10 /dev/sda9 /dev/sda10

To add a new device into the RAID array To add a new device into the RAID array [root@comp1 ~]#mdadm -a /dev/md0 /dev/sda11 [root@comp1 ~]#mdadm -a /dev/md0 /dev/sda11

RPMS

RPM is the acronym for RedHat Package Manager. By using RPM utility the user can install the new packages, can upgrade and can also remove existing packages.

RPM Pattern

RPM - Install

xmms-1.2.10-9.i386.rpm

To install the RPM package To install the RPM package [root@comp1 ~]#rpm <options> <package name-version> [root@comp1 ~]#rpm <options> <package name-version> --force --aid --force --aid

Options : Version Version Number Number Package Package Name Name Extension Extension of RedHat of RedHat -i -v -h Type of Type of Architecture Architecture --force --aid - To install the package - Verbose - To Display the progress in hashes - To install package forcefully - To install package along with dependencies

RPM - Upgrade

RPM - Remove

To upgrade the existing RPM package To upgrade the existing RPM package [root@comp1 ~]#rpm <options> <package name.version> [root@comp1 ~]#rpm <options> <package name.version>

To remove the existing RPM package To remove the existing RPM package [root@comp1 ~]#rpm <options> <package name> --nodeps [root@comp1 ~]#rpm <options> <package name> --nodeps

Options : -U -v -h - To Upgrade the existing the package - Verbose - To Display the progress in hashes

Options : -e --nodeps - To uninstall the package from the system - To uninstall package even if dependencies are there.

RPM Options

To query the RPM Package To query the RPM Package [root@comp1 ~]#rpm <options> <package name> [root@comp1 ~]#rpm <options> <package name>
Options : -q -qa -qc -qd -qi -qs -ql - To query the availability of installed package. - Queries all installed RPMs in OS. Does not require any package specification. - Lists only the configuration files stored in the queried RPM. - Lists only the documentation files stored in the queried RPM. - Displays complete information about the queried RPM. - Displays the states of files in the queried RPM. - Display all the files related to the queried RPM.

Recovering Root Password

Root Password can be recovered in a specialized troubleshooting mode (i.e. init 1) init 1 level provides a shell (i.e. sh) without logging in.

Recovering Root Password

Assigning Grub Password

Procedure Procedure Restart the system Restart the system In the splash screen Select RedHat Enterprise Linux In the splash screen Select RedHat Enterprise Linux Press e Press e Select Kernel /vmlinuz-2.6.9-5.EL ro root=LABEL=/rhgb quiet Select Kernel /vmlinuz-2.6.9-5.EL ro root=LABEL=/rhgb quiet Press e to edit Press e to edit Edit Kernel /vmlinuz-2.6.9-5.EL ro root=LABEL=/rhgb quiet 1 Edit Kernel /vmlinuz-2.6.9-5.EL ro root=LABEL=/rhgb quiet 1 Press Enter Press Enter Press b to boot with the selected run level Press b to boot with the selected run level directly you will get shell prompt to assign the root password directly you will get shell prompt to assign the root password

Assigning Grub Password Assigning Grub Password [root@comp1~]# grub-md5-crypt >> /boot/grub/grub.conf [root@comp1~]# grub-md5-crypt >> /boot/grub/grub.conf [root@comp1~]# vi /boot/grub/grub.conf [root@comp1~]# vi /boot/grub/grub.conf

Add line in /boot/grub/grub.conf Add line in /boot/grub/grub.conf hidden menu hidden menu password --md5 <password> password --md5 <password> title Red Hat -----title Red Hat ------

sh-3.00#passwd root sh-3.00#passwd root

Recovering Grub Password

Other Configurations

Recovering Grub Password Recovering Grub Password Boot the System in Rescue Mode Boot the System in Rescue Mode # chroot /mnt/sysimage # chroot /mnt/sysimage # vi /boot/grub/grub.conf # vi /boot/grub/grub.conf

To configure printer To configure printer [root@comp1~]# system-config-printer [root@comp1~]# system-config-printer

To configure modem To configure modem [root@comp1~]# system-config-network [root@comp1~]# system-config-network

Remove line from /boot/grub/grub.conf Remove line from /boot/grub/grub.conf hidden menu hidden menu password -- md5 <password> password -- md5 <password> title Red Hat -----title Red Hat ------

Other Configurations

To view the process To view the process [root@comp1~]# ps -aux [root@comp1~]# ps -aux

To kill a specific process To kill a specific process [root@comp1~]# kill -9 <process id> [root@comp1~]# kill -9 <process id>

To view CPU usage by all process To view CPU usage by all process [root@comp1~]# top [root@comp1~]# top

What is FQDN ?

Identifies a hosts name within the DNS namespace hierarchy Host name + DNS domain name = FQDN e.g. mail.zoomgroup.com

Hostname Hostname

Domain Domain name name

Configuring Hostname

Configuring IP Address

Assigning Hostname --Temporary Assigning Hostname Temporary [root@comp1 ~]# hostname <system name> [root@comp1 ~]# hostname <system name>

Assigning IP address --Temporary Assigning IP address Temporary [root@comp1 ~]# ifconfig eth0 <ipaddr> netmask <netmask> [root@comp1 ~]# ifconfig eth0 <ipaddr> netmask <netmask>

Assigning Hostname --Permanent Assigning Hostname Permanent [root@comp1 ~]# vi /etc/sysconfig/network [root@comp1 ~]# vi /etc/sysconfig/network

Assigning IP address --Permanent Assigning IP address Permanent [root@comp1 ~]# netconfig [root@comp1 ~]# netconfig [root@comp1 ~]# service network restart [root@comp1 ~]# service network restart

Modify below setting in /etc/sysconfig/network Modify below setting in /etc/sysconfig/network NETWORKING=yes NETWORKING=yes HOSTNAME= <system name> HOSTNAME= <system name>

Assigning Virtual IP address Assigning Virtual IP address [root@comp1 ~]# netconfig --device <interface>:<n> [root@comp1 ~]# netconfig --device <interface>:<n> [root@comp1 ~]# service network restart [root@comp1 ~]# service network restart

Configuring IP Address

Configuring Network Interface

Graphical tool for assigning IP address Graphical tool for assigning IP address [root@comp1 ~]# neat [root@comp1 ~]# neat OR OR [root@comp1 ~]# system-config-network [root@comp1 ~]# system-config-network

To check whether NIC is detected To check whether NIC is detected [root@comp1 ~]# ethtool <interface> [root@comp1 ~]# ethtool <interface>

Enabling Network Interface Enabling Network Interface [root@comp1 ~]# ifup <interface> [root@comp1 ~]# ifup <interface>

Disabling Network Interface Disabling Network Interface [root@comp1 ~]# ifdown <interface> [root@comp1 ~]# ifdown <interface>

Locations

For IP address For IP address [root@comp1 ~]# cd /etc/sysconfig/network-scripts [root@comp1 ~]# cd /etc/sysconfig/network-scripts [root@comp1 ~]# vi ifcfg-eth0 [root@comp1 ~]# vi ifcfg-eth0

For virtual IP address For virtual IP address [root@comp1 ~]# vi ifcfg-eth0:1 [root@comp1 ~]# vi ifcfg-eth0:1

For Primary DNS For Primary DNS [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

What is NFS?

The NFS environment contains the following components: NFS server A system that contains the file resources to be shared with other systems on the network. NFS client A system that mounts the file resources shared over the network and presents the file resources as if they were local.

Benefits of NFS

NFS works ?

The benefits of an NFS include: Centralized file access Common software access Easy to use
NFS NFS Server Server 192.168.0.253 192.168.0.253 /var/zoom /var/zoom
A B

Linux Linux Client Client

Linux Linux Client Client

/nfs /nfs
User1 User2

/nfs /nfs

Requirements Packages portmap-4.0-63.i386.rpm nfs-utils-1.0.6-46.i386.rpm Port Numbers 2049 Nfsd Portmap 111 Configuration File /etc/exports Service portmap nfs Daemons nfsd mountd statd lockd

NFS Configuration

NFS NFS Server Server 192.168.0.253 192.168.0.253 /var/zoom /var/zoom

Linux Linux Client Client

Linux Linux Client Client

/nfs /nfs

/nfs /nfs

Configuring NFS Server

/etc/exports

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@com~]#rpm ivh --force --aid ftp://192.168.0.250:/pub/Server/nfs* [root@com~]#rpm ivh --force --aid ftp://192.168.0.250:/pub/Server/nfs*

To add the below To add the below

/var/zoom /var/zoom

192.168.0.0/255.255.255.0(ro,async) 192.168.0.0/255.255.255.0(ro,async)

Create directory to be shared Create directory to be shared [root@comp1~]# mkdir /var/zoom [root@comp1~]# mkdir /var/zoom

Open configuration for editing Open configuration for editing [root@comp1~]# vi /etc/exports [root@comp1~]# vi /etc/exports

NFS Server

Configuring Client

To restart the NFS services To restart the NFS services [root@comp1 ~]# service nfs restart [root@comp1 ~]# service nfs restart

Create Mount point on client Create Mount point on client [root@comp1 ~]# mkdir /nfs [root@comp1 ~]# mkdir /nfs

To check NFS server To check NFS server [root@comp1 ~]# showmount -e <servername or server ip> [root@comp1 ~]# showmount -e <servername or server ip>

Mount remote shared filesystem on local mount point Mount remote shared filesystem on local mount point [root@comp1 ~]# mount 192.168.0.253:/var/zoom /nfs [root@comp1 ~]# mount 192.168.0.253:/var/zoom /nfs [root@comp1 ~]# cd /nfs [root@comp1 ~]# cd /nfs

What is FTP?

File Transfer Protocol is one of the oldest members of the TCP/IP protocol stack, yet it is still in common use today. As the name suggests, it is optimized for transferring files.

FTP Server for Linux/Unix

How FTP works ?

vsFTPd - Very Secure FTP Daemon WU-FTP - Washington Universitys (St. Louis) Proftpd
FTP FTP Server Server 192.168.0.253 192.168.0.253 /var/ftp/pub /var/ftp/pub
A B

Linux Linux Client Client

Windows Windows Client Client

User1

User2

Requirements

FTP Server Configuration - Anonymous Access

Packages vsftpd-2.0.1-5.i386.rpm Port Numbers 20 21 Ftp Data Transfer Ftp Control Connection
FTP FTP Server Server 192.168.0.253 192.168.0.253 /var/ftp/pub /var/ftp/pub

Configuration File /etc/vsftpd/vsftpd.conf Service vsftpd Daemon vsftpd


Linux Linux Client Client Windows Windows Client Client

FTP Server Configuration Local User Access

Configuring FTP Server

FTP FTP Server Server 192.168.0.253 192.168.0.253 /var/ftp/pub /var/ftp/pub

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@c~]#rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/vsftpd* [root@c~]#rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/vsftpd*

Linux Linux Client Client

Windows Windows Client Client

Open configuration for editing Open configuration for editing [root@comp1~]# vi /etc/vsftpd/vsftpd.conf [root@comp1~]# vi /etc/vsftpd/vsftpd.conf

/etc/vsftpd/vsftpd.conf

Configuring FTP Server

Change the below options Change the below options anonymous_enable=YES anonymous_enable=YES local_enable=NO local_enable=NO anon_upload_enable=YES anon_upload_enable=YES dirmessage_enable=YES dirmessage_enable=YES ftpd_banner=Welcome to ZOOM FTP service. ftpd_banner=Welcome to ZOOM FTP service.

Creating upload directory Creating upload directory [root@comp1 ~]# mkdir /var/ftp/upload [root@comp1 ~]# mkdir /var/ftp/upload

Giving Upload permissions Giving Upload permissions [root@comp1 ~]# chmod 777 /var/ftp/upload [root@comp1 ~]# chmod 777 /var/ftp/upload

To restart the FTP services To restart the FTP services [root@comp1 ~]# service vsftpd restart [root@comp1 ~]# service vsftpd restart

FTP Client Linux


Accessing FTP via Command Line Interface Accessing FTP via Command Line Interface [root@comp1 ~]# ftp 192.168.0.253 [root@comp1 ~]# Connected to 192.168.0.253. Connected to 192.168.0.253. 220 (vsFTPd 2.0.1) 220 (vsFTPd 2.0.1) 530 Please login with USER and PASS. 530 Please login with USER and PASS. 530 Please login with USER and PASS. 530 Please login with USER and PASS. KERBEROS_V4 rejected as an authentication type KERBEROS_V4 rejected as an authentication type Name (192.168.0.253:root): ftp Name (192.168.0.253:root): 331 Please specify the password. 331 Please specify the password. Password: . Password: 230 Login successful. 230 Login successful. Remote system type is UNIX. Remote system type is UNIX. Using binary mode to transfer files. Using binary mode to transfer files. ftp> ls ftp> 227 Entering Passive Mode (192,168,0,12,80,246) 227 Entering Passive Mode (192,168,0,12,80,246) 150 Here comes the directory listing. 150 Here comes the directory listing. drwxr-xr-x 20 0 4096 Mar 01 06:42 pub drwxr-xr-x 20 0 4096 Mar 01 06:42 pub drwxr-xrwx 2 0 0 4096 Mar 01 07:05 upload drwxr-xrwx 2 0 0 4096 Mar 01 07:05 upload 226 Directory send OK. 226 Directory send OK. ftp> bye ftp> 221 Goodbye. 221 Goodbye. [root@comp1 ~]# [root@comp1 ~]#

FTP Client Linux

Accessing FTP via Graphical User Interface Accessing FTP via Graphical User Interface [root@comp1 ~]# gftp 192.168.0.253 [root@comp1 ~]# gftp 192.168.0.253

Accessing FTP via Graphical User Interface Accessing FTP via Graphical User Interface Open Mozilla or Fire Fox browser. Open Mozilla or Fire Fox browser. In the address box type ftp://192.168.0.253 In the address box type ftp://192.168.0.253

FTP Client Windows


Accessing FTP via Command Line Interface Accessing FTP via Command Line Interface C:\Documents and Settings\Administrator > ftp 192.168.0.253 C:\Documents and Settings\Administrator > Connected to 192.168.0.253. Connected to 192.168.0.253. 220 (vsFTPd 2.0.1) 220 (vsFTPd 2.0.1) User (192.168.0.15:(none)): ftp User (192.168.0.15:(none)): 331 Please specify the password. 331 Please specify the password. Password:. Password: 230 Login successful. 230 Login successful. ftp> ls ftp> 200 PORT command successful. Consider using PASV. 200 PORT command successful. Consider using PASV. 150 Here comes the directory listing. 150 Here comes the directory listing. pub pub upload upload 226 Directory send OK. 226 Directory send OK. ftp: 50 bytes received in 0.02Seconds 3.13Kbytes/sec. ftp: 50 bytes received in 0.02Seconds 3.13Kbytes/sec. ftp> bye ftp> C:\Documents and Settings\Administrator > C:\Documents and Settings\Administrator >

FTP Client Windows

Accessing FTP via Graphical User Interface Accessing FTP via Graphical User Interface Open Internet Explorer or Netscape Navigator browser. Open Internet Explorer or Netscape Navigator browser. In the address box type ftp://192.168.0.253 In the address box type ftp://192.168.0.253

/etc/vsftpd/vsftpd.conf

Configuring FTP Server

Change the below options Change the below options anonymous_enable=NO anonymous_enable=NO local_enable=YES local_enable=YES

Creating users Creating users [root@comp1 ~]# useradd user1 [root@comp1 ~]# useradd user1 [root@comp1 ~]# useradd user2 [root@comp1 ~]# useradd user2

Assigning password to the users Assigning password to the users [root@comp1 ~]# passwd user1 [root@comp1 ~]# passwd user1 [root@comp1 ~]# passwd user2 [root@comp1 ~]# passwd user2

FTP Client Linux


Accessing FTP via Command Line Interface Accessing FTP via Command Line Interface [root@comp1 ~]# ftp 192.168.0.253 [root@comp1 ~]# Connected to 192.168.0.253. Connected to 192.168.0.253. 220 (vsFTPd 2.0.1) 220 (vsFTPd 2.0.1) 530 Please login with USER and PASS. 530 Please login with USER and PASS. 530 Please login with USER and PASS. 530 Please login with USER and PASS. KERBEROS_V4 rejected as an authentication type KERBEROS_V4 rejected as an authentication type Name (192.168.0.253:root): user1 Name (192.168.0.253:root): 331 Please specify the password. 331 Please specify the password. Password: **** Password: 230 Login successful. 230 Login successful. Remote system type is UNIX. Remote system type is UNIX. Using binary mode to transfer files. Using binary mode to transfer files. ftp> pwd ftp> 227 Entering Passive Mode (192,168,0,12,80,246) 227 Entering Passive Mode (192,168,0,12,80,246) 150 Here comes the directory listing. 150 Here comes the directory listing. /home/user1 /home/user1 226 Directory send OK. 226 Directory send OK. ftp> bye ftp> 221 Goodbye. 221 Goodbye. [root@comp1 ~]# [root@comp1 ~]#

What is SAMBA?

Samba is the way a Linux computer communicates with SMB and CIFS. With Samba, you can make your Linux computer a part of a Microsoft-based network. Computers with various Microsoft operating systems can communicate with each other using the Server Message Block (SMB) protocol. When a Microsoft operating system shares files or printers on a TCP/IP network, it uses the Common Internet File System (CIFS).

Example

How SAMBA works ?

SMB

CIFS NetBios

NetBios CIFS SMB

SAMBA SAMBA Server Server 192.168.0.253 192.168.0.253

A B

/var/zoom /var/zoom

SMBD / NMBD SMBD / NMBD CIFS

CIFS SMB

Linux Linux Client Client

Windows Windows Client Client /smb /smb

Z: Z:
User2

User1

How SAMBA works ?

Requirements Packages samba-common-3.0.10-1.4E.i386.rpm samba-3.0.10-1.4E.i386.rpm samba-client-3.0.10-1.4E.i386.rpm Port Numbers NetBios Name Service 137 NetBios Datagram Service 138 139 NetBios Session Service Configuration File /etc/samba/smb.conf Service smb Daemons nmbd smbd

SAMBA SAMBA Server Server 192.168.0.253 192.168.0.253 /smb /smb


User1

Linux Linux Client Client

Windows Windows Client Client

Share Share
User2

SAMBA Configuration Scenario 1

SAMBA Configuration Scenario 2

SAMBA SAMBA Server Server 192.168.0.253 192.168.0.253 /var/zoom /var/zoom

SAMBA SAMBA Server Server 192.168.0.253 192.168.0.253 /smb /smb

Linux Linux Client Client

Windows Windows Client Client /smb /smb

Linux Linux Client Client

Windows Windows Client Client

Z: Z:

Share Share

Configuring SAMBA Server

/etc/samba/smb.conf

To change the options To change the options


Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1~]#rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/samba* [root@comp1~]#rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/samba*

[myshare] [myshare] comment = Zooms share comment = Zooms share path = /var/zoom path = /var/zoom valid users = user1 user2 valid users = user1 user2 public = no public = no writable = yes writable = yes printable = no printable = no create mask = 0765 create mask = 0765

Create directory to be shared Create directory to be shared [root@comp1~]# mkdir /var/zoom [root@comp1~]# mkdir /var/zoom

Open configuration for editing Open configuration for editing [root@comp1~]# vi /etc/samba/smb.conf [root@comp1~]# vi /etc/samba/smb.conf

Samba Server

Samba Server

To restart the Samba services To restart the Samba services [root@comp1 ~]# service smb restart [root@comp1 ~]# service smb restart

Create Users Create Users [root@comp1 ~]# useradd user1 [root@comp1 ~]# useradd user1 [root@comp1 ~]# useradd user2 [root@comp1 ~]# useradd user2

To test smb.conf file To test smb.conf file [root@comp1 ~]# testparm [root@comp1 ~]# testparm

Create directory to be shared Assign them Samba password Create directory to be shared Assign them Samba password [root@comp1~]# smbpasswd a user1 [root@comp1~]# smbpasswd a user1 [root@comp1~]# smbpasswd a user2 [root@comp1~]# smbpasswd a user2 Samba password entries can be found at /etc/samba/smbpasswd Samba password entries can be found at /etc/samba/smbpasswd

Samba Client Linux

Samba Client Windows

Mount Method Mount Method [root@comp1 ~]# mkdir /smb [root@comp1 ~]# mkdir /smb [root@comp1 ~]# mount t cifs //192.168.0.253/myshare [root@comp1 ~]# mount t cifs //192.168.0.253/myshare /smb o username=user1 /smb o username=user1 Password ::**** Password **** [root@comp1 ~]# cd /smb [root@comp1 ~]# cd /smb

Map Drive Samba Drive Map Drive Samba Drive Right click My Network Places Right click My Network Places Select Map Network Drive Select Map Network Drive In the dialog box provide In the dialog box provide Drive :: Z: Drive Z: Folder :: \\192.168.0.253\myshare Folder \\192.168.0.253\myshare It opens authentication dialogbox, where It opens authentication dialogbox, where username ::user1 username user1 password ::**** password **** Open Windows Explorer to find Z: drive mapped to Open Windows Explorer to find Z: drive mapped to Linux shared folder. Linux shared folder.

FTP Method FTP Method [root@comp1 ~]# smbclient //192.168.0.253/myshare [root@comp1 ~]# smbclient //192.168.0.253/myshare U user1 U user1 Password Password smb/> ls smb/> ls ::**** ****

SAMBA Server Client

Mount Method Mount Method [root@comp1 ~]# mkdir /smb [root@comp1 ~]# mkdir /smb [root@comp1 ~]mount t cifs //192.168.0.253/myshare [root@comp1 ~]mount t cifs //192.168.0.253/myshare /smb o username=administrator /smb o username=administrator Password ::**** Password **** [root@comp1 ~]# cd /smb [root@comp1 ~]# cd /smb

FTP Method FTP Method [root@comp1 ~]# smbclient //192.168.0.253/myshare [root@comp1 ~]# smbclient //192.168.0.253/myshare Password Password smb/> ls smb/> ls U administrator U administrator ::**** ****

Hostname Resolution

Server Server 192.168.0.253 192.168.0.253 server1 server1

ZOOM.COM ZOOM.COM Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1

Linux Linux Client Client 192.168.0.2 192.168.0.2 client2 client2

Host File

Host File Configuration

Host File provides resolution of hostnames to IP addresses. It can only resolve the names provide in the local host file. It cannot be used as central Database. You can add the name and ip address in /etc/hosts
ZOOM.COM ZOOM.COM Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 192.168.0.253 192.168.0.253 Server Server server1 server1

Linux Linux Client Client 192.168.0.2 192.168.0.2 client2 client2

Checking - Hostname Resolution

What is DNS?

Domain Name System


Server Server 192.168.0.253 192.168.0.253 server1 server1

Provides resolution of names to IP addresses and resolution of IP addresses to names. Defines a hierarchical namespace where each level of the namespace is separated by a .

ZOOM.COM ZOOM.COM Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 Linux Linux Client Client 192.168.0.2 192.168.0.2 client2 client2

DNS Namespace

How DNS works ?

.
.org .org .com .com .edu .edu mtu.edu msu.edu gov.in mtu.edu msu.edu gov.in .in .in co.in co.in unicef.org msn.com unicef.org msn.com redhat.com.

DNS DNS Server Server 192.168.0.253 192.168.0.253


r fo g om kin oo.c f o lo ah so y es m Im ww. dr o.co 5 w ad ho 2.1 es a 5 er w.y .10.1 H w 0 w 21

Im looking for www.yahoo.com I dont know it, But heres .com address Im looki ng for www.yah oo.com But he I dont know res ya it hoo.co , m add ress Im ww lookin w.y aho g for o.c om Her e ww s add w re 210 .yahoo ss of .10 .15 .com 2.1 5

Root (.) Root (.)

.com .com

rpm.redhat.com. Linux Linux Client Client

yahoo.com yahoo.com

rpm.
Subdomain Subdomain

redhat .com .
Top-Level Domain Top-Level Domain Root Root

192.168.0.1 192.168.0.1

Linux Linux Client Client 192.168.0.2 192.168.0.2

Second-Level Domain Second-Level Domain

210.10.152.15 210.10.152.15

ZONE

How Lookup works ?


client1 192.168.0.1 192.168.0.2 192.168.0.253 client1 client2 sever Forward zone

Zone is a storage database which contains all zone Records Forward Lookup Zone Used for Resolving Host Names to IP-Address It maintains Host to IP Address Mapping Information Reverse Lookup Zone Used for Resolving IP-Address to Host Names It maintains IP Address to Host Mapping Information
Linux Linux Client Client 192.168.0.1 192.168.0.1

zoom.com

client2 sever

DNS DNS Server Server Reverse 0.168.192.in192.168.0.253 192.168.0.253


r fo m ss .co e dr om a d . zo is P nt2 I e ss re 8.0.2 li c d ad 16 IP 92. 1
zone addr.arpa

192.168.0.1 192.168.0.2 192.168.0.253

server server

N 19 am 2.1 e 68 for cli N .0. en am 1 t1 e . zo i om s ZOOM.COM ZOOM.COM .co m

Linux Linux Client Client client1 client1 192.168.0.2 192.168.0.2 client2 client2

Types of Records

Requirements PACKAGES bind-chroot-9.2.4-2.i386.rpm bind-devel-9.2.4-2.i386.rpm bind-libs-9.2.4-2.i386.rpm bind-utils-9.2.4-2.i386.rpm bind-9.2.4-2.i386.rpm PORT NUMBERS 53 DNS Configuration File /var/named/chroot/etc/named.conf SERVICE named DAEMON named

SOA Record The first record in any zone file NS Record Identifies the DNS server for each zone A Record Resolves a host name to an IP address CNAME Record Resolves an alias name to a host name PTR Record Resolves an IP address to a host name MX Record Used by the mail server

DNS Configuration

Configuring DNS Server

DNS DNS Server Server 192.168.0.253 192.168.0.253 server server

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp~]#rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/bind* [root@comp~]#rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/bind*

ZOOM.COM ZOOM.COM Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1
Open configuration for editing Open configuration for editing [root@comp1~]# vim /var/named/chroot/etc/named.conf [root@comp1~]# vim /var/named/chroot/etc/named.conf

Linux Linux Client Client 192.168.0.2 192.168.0.2 client2 client2

/var/named/chroot/etc/named.conf

Configuring Forward Lookup

To change the options To change the options options { options { directory /var/named; directory /var/named; }; }; zone "zoom.com" IN { zone "zoom.com" IN { type master; type master; file zoom.for"; file zoom.for"; }; }; zone "0.168.192.in-addr.arpa" IN { zone "0.168.192.in-addr.arpa" IN { type master; type master; file zoom.rev"; file zoom.rev"; }; }; Open configuration for editing Open configuration for editing [root@comp1 ]#cd /var/named/chroot/var/named/ [root@comp1 ]#cd /var/named/chroot/var/named/ [root@comp1 named]# vim zoom.for [root@comp1 named]# vim zoom.for Copying Forward lookup zone file Copying Forward lookup zone file cp /usr/share/doc/bind-9.3.3/sample/var/named/ cp /usr/share/doc/bind-9.3.3/sample/var/named/ localhost.zone localhost.zone /var/named/chroot/var/named/zoom.for /var/named/chroot/var/named/zoom.for

/var/named/chroot/var/named/zoom.for

Configuring Reverse Lookup

To add the options To add the options $TTL 86400 $TTL 86400 @ IN @ IN SOA SOA server.zoom.com. root.zoom.com. (( server.zoom.com. root.zoom.com. 42 ;;serial (d. adams) 42 serial (d. adams) 3H 3H 15M 15M 1W 1W 1D )) 1D server server client1 client1 client2 client2 www www IN IN IN IN IN IN IN IN IN IN NS NS A A A A A A ;;refresh refresh ;;retry retry ;;expiry expiry ;;minimum minimum

Copying Forward lookup zone file Copying Forward lookup zone file cp /usr/share/doc/bind-9.3.3/sample/var/named/named.local cp /usr/share/doc/bind-9.3.3/sample/var/named/named.local /var/named/chroot/var/named/zoom.rev /var/named/chroot/var/named/zoom.rev

server.zoom.com. server.zoom.com. 192.168.0.253 192.168.0.253 192.168.0.1 192.168.0.1 192.168.0.2 192.168.0.2

Open configuration for editing Open configuration for editing [root@comp1 ]# cd /var/named/chroot/var/named/ [root@comp1 ]# cd /var/named/chroot/var/named/ [root@comp1 named]# vim zoom.rev [root@comp1 named]# vim zoom.rev

CNAME server CNAME server

/var/named/chroot/var/named/zoom.rev

Configuring DNS Server IP address

To add the options To add the options $TTL $TTL @ @ 86400 86400 IN IN SOA SOA server.zoom.com. root.zoom.com. (( server.zoom.com. root.zoom.com. 1997022700 ;;Serial 1997022700 Serial 28800 28800 14400 14400 3600000 3600000 86400 )) 86400 253 253 1 1 2 2 IN IN IN IN IN IN IN IN NS NS PTR PTR PTR PTR PTR PTR server.zoom.com. server.zoom.com. server. server. client1. client1. client2. client2. ;;Refresh Refresh ;;Retry Retry ;;Expire Expire ;;Minimum Minimum

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

DNS Server

Checking from DNS Server

To restart the DNS services To restart the DNS services [root@comp1 ~]# service named restart [root@comp1 ~]# service named restart

Checking Forward Lookup Checking Forward Lookup [root@comp1 ~]# dig server.zoom.com [root@comp1 ~]# dig server.zoom.com [root@comp1 ~]# dig client1.zoom.com [root@comp1 ~]# dig client1.zoom.com

Checking Reverse Lookup Checking Reverse Lookup [root@comp1 ~]# dig x 192.168.0.253 [root@comp1 ~]# dig x 192.168.0.253 [root@comp1 ~]# dig x 192.168.0.1 [root@comp1 ~]# dig x 192.168.0.1

Checking Name resolution Checking Name resolution [root@comp1 ~]# ping server.zoom.com [root@comp1 ~]# ping server.zoom.com [root@comp1 ~]# ping client2.zoom.com [root@comp1 ~]# ping client2.zoom.com

Debug DNS File

Configuring DNS Client

To check main configuration file syntax To check main configuration file syntax [root@comp1 ~]# named-checkconf /etc/named.conf [root@comp1 ~]# named-checkconf /etc/named.conf

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

To check forward zone file syntax To check forward zone file syntax [root@comp1 ~]# named-checkzone zoom.com /var/named [root@comp1 ~]# named-checkzone zoom.com /var/named /chroot/var/named/zoom.for /chroot/var/named/zoom.for

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

To check reverse zone file syntax To check reverse zone file syntax [root@comp1 ~]# named-checkzone zoom.com /var/named [root@comp1 ~]# named-checkzone zoom.com /var/named /chroot/var/named/zoom.rev /chroot/var/named/zoom.rev

Checking from DNS Client


[root@localhost ~]# ping 192.168.0.2 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.2: icmp_seq=0 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 time=0.047 time=0.047 time=0.047 time=0.047 ms ms ms ms

Dig another PC via FQDN Dig another PC via FQDN [root@comp1 ~]# dig server.zoom.com [root@comp1 ~]# dig server.zoom.com [root@comp1 ~]# dig client2.zoom.com [root@comp1 ~]# dig client2.zoom.com

--- 192.168.0.2 ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 min/avg/max/mdev [root@localhost ~]# ping 192.168.0.253

Dig DNS server IP Dig DNS server IP [root@comp1 ~]# dig x 192.168.0.253 [root@comp1 ~]# dig x 192.168.0.253

64 64 64 64

bytes bytes bytes bytes

from from from from

192.168.0.253: 192.168.0.253: 192.168.0.253: 192.168.0.253:

icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0

ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64

time=0.047 time=0.047 time=0.047 time=0.047

ms ms ms ms

Ping another PC via FQDN Ping another PC via FQDN [root@comp1 ~]# ping server.zoom.com [root@comp1 ~]# ping server.zoom.com [root@comp1 ~]# ping client2.zoom.com [root@comp1 ~]# ping client2.zoom.com

--- 192.168.0.253 ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms min/avg/max/mdev rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 [root@localhost ~]#

[root@localhost ~]# ping client2.zoom.com ping: unknown host client2.zoom.com [root@localhost ~]# ping server.zoom.com ping: unknown host server.zoom.com [root@localhost ~]#

[root@localhost ~]# ping 192.168.0.1 icmp_seq=0 64 bytes from 192.168.0.1: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.1: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.1: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.1: icmp_seq=0

ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64

time=0.047 time=0.047 time=0.047 time=0.047

ms ms ms ms

--- 192.168.0.1 ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms min/avg/max/mdev rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 [root@localhost ~]# ping 192.168.0.253 64 64 64 64 bytes bytes bytes bytes from from from from 192.168.0.253: 192.168.0.253: 192.168.0.253: 192.168.0.253: icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 time=0.047 time=0.047 time=0.047 time=0.047 ms ms ms ms

--- 192.168.0.253 ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms min/avg/max/mdev rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 [root@localhost ~]#

[root@localhost ~]# ping client1.zoom.com ping: unknown host client1.zoom.com [root@localhost ~]# ping server.zoom.com ping: unknown host server.zoom.com [root@localhost ~]#

[root@localhost ~]# ping 192.168.0.1 icmp_seq=0 64 bytes from 192.168.0.1: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.1: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.1: icmp_seq=0 icmp_seq=0 64 bytes from 192.168.0.1: icmp_seq=0

ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64

time=0.047 time=0.047 time=0.047 time=0.047

ms ms ms ms

--- 192.168.0.1 ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 min/avg/max/mdev [root@localhost ~]# ping 192.168.0.2 64 64 64 64 bytes bytes bytes bytes from from from from 192.168.0.2: 192.168.0.2: 192.168.0.2: 192.168.0.2: icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 icmp_seq=0 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 ttl=64 time=0.047 time=0.047 time=0.047 time=0.047 ms ms ms ms

--- 192.168.0.2 ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms min/avg/max/mdev rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 [root@localhost ~]#

[root@localhost ~]# ping client1.zoom.com ping: unknown host client1.zoom.com [root@localhost ~]# ping client2.zoom.com ping: unknown host client2.zoom.com [root@localhost ~]#

[root@localhost ~]# ping client1.zoom.com PING station13.example.com (192.168.0.1) 56(84) bytes of data. icmp_seq=0 ttl=64 64 bytes from client1.zoom.com (192.168.0.1): icmp_seq=0 ttl=64 time=0.053 ms icmp_seq=1 ttl=64 64 bytes from client1.zoom.com (192.168.0.1): icmp_seq=1 ttl=64 time=0.050 ms icmp_seq=2 ttl=64 64 bytes from client1.zoom.com (192.168.0.1): icmp_seq=2 ttl=64 time=0.050 ms icmp_seq=3 ttl=64 64 bytes from client1.zoom.com (192.168.0.1): icmp_seq=3 ttl=64 time=0.049 ms --- client1.zoom.com ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms min/avg/max/mdev rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 [root@localhost ~]# ping client2.zoom.com PING station13.example.com (192.168.0.2) 56(84) bytes of data. icmp_seq=0 ttl=64 64 bytes from client2.zoom.com (192.168.0.2): icmp_seq=0 ttl=64 time=0.053 ms icmp_seq=1 ttl=64 64 bytes from client2.zoom.com (192.168.0.2): icmp_seq=1 ttl=64 time=0.050 ms icmp_seq=2 ttl=64 64 bytes from client2.zoom.com (192.168.0.2): icmp_seq=2 ttl=64 time=0.050 ms icmp_seq=3 ttl=64 64 bytes from client2.zoom.com (192.168.0.2): icmp_seq=3 ttl=64 time=0.049 ms --- client2.zoom.com ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms min/avg/max/mdev rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 [root@localhost ~]#

[root@localhost ~]# ping client2.zoom.com PING station13.example.com (192.168.0.2) 56(84) bytes of data. icmp_seq=0 ttl=64 64 bytes from client2.zoom.com (192.168.0.2): icmp_seq=0 ttl=64 time=0.053 ms icmp_seq=1 ttl=64 64 bytes from client2.zoom.com (192.168.0.2): icmp_seq=1 ttl=64 time=0.050 ms icmp_seq=2 ttl=64 64 bytes from client2.zoom.com (192.168.0.2): icmp_seq=2 ttl=64 time=0.050 ms icmp_seq=3 ttl=64 64 bytes from client2.zoom.com (192.168.0.2): icmp_seq=3 ttl=64 time=0.049 ms --- client2.zoom.com ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 min/avg/max/mdev [root@localhost ~]# ping server.zoom.com PING station13.example.com (192.168.0.253) 56(84) bytes of data. icmp_seq=0 ttl=64 64 bytes from server.zoom.com (192.168.0.253): icmp_seq=0 ttl=64 icmp_seq=1 ttl=64 64 bytes from server.zoom.com (192.168.0.253): icmp_seq=1 ttl=64 icmp_seq=2 ttl=64 64 bytes from server.zoom.com (192.168.0.253): icmp_seq=2 ttl=64 icmp_seq=3 ttl=64 64 bytes from server.zoom.com (192.168.0.253): icmp_seq=3 ttl=64 --- server.zoom.com ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, min/avg/max/mdev rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 [root@localhost ~]#

[root@localhost ~]# ping client1.zoom.com PING station13.example.com (192.168.0.1) 56(84) bytes of data. icmp_seq=0 ttl=64 64 bytes from client1.zoom.com (192.168.0.1): icmp_seq=0 ttl=64 time=0.053 ms icmp_seq=1 ttl=64 64 bytes from client1.zoom.com (192.168.0.1): icmp_seq=1 ttl=64 time=0.050 ms icmp_seq=2 ttl=64 64 bytes from client1.zoom.com (192.168.0.1): icmp_seq=2 ttl=64 time=0.050 ms icmp_seq=3 ttl=64 64 bytes from client1.zoom.com (192.168.0.1): icmp_seq=3 ttl=64 time=0.049 ms --- client1.zoom.com ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 min/avg/max/mdev [root@localhost ~]# ping server.zoom.com PING station13.example.com (192.168.0.253) 56(84) bytes of data. icmp_seq=0 ttl=64 64 bytes from server.zoom.com (192.168.0.253): icmp_seq=0 ttl=64 icmp_seq=1 ttl=64 64 bytes from server.zoom.com (192.168.0.253): icmp_seq=1 ttl=64 icmp_seq=2 ttl=64 64 bytes from server.zoom.com (192.168.0.253): icmp_seq=2 ttl=64 icmp_seq=3 ttl=64 64 bytes from server.zoom.com (192.168.0.253): icmp_seq=3 ttl=64 --- server.zoom.com ping statistics --4 packets transmitted, 4 received, 0 duplicates, 0% packet loss, min/avg/max/mdev rtt min/avg/max/mdev = 0.039/0.583/1.390/0.404 ms, pipe 2 [root@localhost ~]#

time=0.053 time=0.050 time=0.050 time=0.049

m m m m

time=0.053 time=0.050 time=0.050 time=0.049

m m m m

time 1001ms

time 1001ms

/etc/hosts

Add the hostname entry Add the hostname entry # Do not remove the following line, or various programs # Do not remove the following line, or various programs # that require network functionality will fail. # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost 127.0.0.1 localhost.localdomain localhost 192.168.0.253 server.zoom.com server 192.168.0.253 server.zoom.com server 192.168.0.1 192.168.0.1 192.168.0.2 192.168.0.2 client1.zoom.com client1.zoom.com client2.zoom.com client2.zoom.com client1 client1 client2 client2

Types of DNS Server

Master DNS Server It is the Master Copy of all the Zone Information. It is Read/Write copy. Slave DNS Server It is Slave Backup of Master zone. It is Read Only

How DNS works ?


client1 Forward zone zoom.com client2 sever 192.168.0.1 192.168.0.2 192.168.0.253

How DNS works ?

DNS DNS Server Server 192.168.0.253 192.168.0.253


r fo m ss .co e dr om n ad 2.zo io ut IP ent ol i s cl re NO

DNS Server DNS Server Fails Fails

DNS DNS Server Server


client1 192.168.0.1 192.168.0.2 192.168.0.253

server server
I cli P a e n dd t1 res . zo s om fo IP ad .co r 19 d m 2.1 re ss 68 .0. is 1

192.168.0.253 192.168.0.253

server server Forward zoom.com zone Slave Slave DNS Server DNS Server

client2 sever

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

Linux Linux Client Client 192.168.0.2 192.168.0.2 client2 client2

Linux Linux Client Client 192.168.0.1 192.168.0.1

or s f m o res add oom.c IP t2.z n is clie ess ddr 8.0.2 IP a 2.16 19

192.168.0.254 192.168.0.254

server2 server2

Linux Linux Client Client 192.168.0.2 192.168.0.2 client2 client2

client1 client1 ZOOM.COM ZOOM.COM

How Zone Transfer works ?

How SOA works ?

Master Master SOA [42] DNS Server DNS Server Server


Client1 Client2 192.168.0.253 192.168.0.253

Master - Forward Zone ZOOM.COM 192.168.0.253 192.68.0.253 192.68.0.1 192.68.0.2

Master Master SOA [42] DNS Server DNS Server Server server server
ZOOM.COM Slave Slave DNS Server[42] 192.168.0.253 DNS Server SOA Server Slave - Forward Zone Client1 Client2 192.168.0.253 192.168.0.253

Master - Forward Zone ZOOM.COM

y S u er 192.168.0.253 y OA 192.68.0.253 =4 SOSOA is same 2 AQ 192.68.0.1 SOA is same 192.68.0.2 My Zone Transfer No uery

SO

AQ

NoSZone eTransfer OA R ply =4 2 Slave - Forward Zone

server server server2 server2

ZOOM.COM Slave Slave 180 90 60 30 00 DNS Server[42] 192.168.0.253 DNS Server SOA Server 192.68.0.253 192.68.0.1 192.68.0.2

Client1 192.168.0.254 192.168.0.254 Client2

192.68.0.253 192.68.0.1 192.68.0.2

Client1 192.168.0.254 192.168.0.254 Client2

server2 server2

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

Linux Linux Client Client 192.168.0.2 192.168.0.2 client2 client2

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

Linux Linux Client Client 192.168.0.2 192.168.0.2 client2 client2

How SOA works ?

How SOA works ?

Master Master [45] SOA [42] DNS Server DNS Server Server
Client1 Client2 192.168.0.253 192.168.0.253 Server2

Master - Forward Zone ZOOM.COM

SO My A Qu 192.168.0.253 SO ery A= 192.68.0.253 SO 42 SOA is not same AQ 192.68.0.1 SOA is not same ue r My Zone Transfer 192.68.0.2 Do SZone Transfer Do O y Rep 192.168.0.254 A= l 45 y Slave - Forward Zone

Master Master DNS Server DNS Server 192.168.0.253 192.168.0.253 server server

Req ues ted rec for Up ord dat Re p s Zone Transfer ed ly w Zone Transfer ith U rCompleted eCompleted cor pdate ds d
ZOOM.COM Slave Slave DNS Server[45] 192.168.0.253 DNS Server SOA Server Client1 192.168.0.254 192.168.0.254 Client2 Server2 192.68.0.253 192.68.0.1 192.68.0.2 192.168.0.254 Slave - Forward Zone

server server

ZOOM.COM Slave Slave 180 90 60 30 00 DNS Server[42] 192.168.0.253 DNS Server SOA Server 192.68.0.253 192.68.0.1 192.68.0.2

Client1 192.168.0.254 192.168.0.254 Client2

server2 server2

server2 server2

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

Linux Linux Client Client 192.168.0.2 192.168.0.2 client2 client2

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

Linux Linux Client Client 192.168.0.2 192.168.0.2 client2 client2

Master / Slave Configuration

Types of DNS Server

Master Master DNS Server DNS Server 192.168.0.253 192.168.0.253 server server Slave Slave DNS Server DNS Server 192.168.0.254 192.168.0.254 server2 server2

Forwarder Forwards requests to a specific list of DNS servers for name resolution. If none of the specified DNS servers can perform the resolution, the resolution fails.

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

Linux Linux Client Client 192.168.0.2 192.168.0.2 client2 client2

How Forwarders works ?

How Forwarders works ?

client1 DNS DNS Forward client2 ServerNo Resolution ServerNo Resolution zoom.com zone

192.168.0.1 192.168.0.2 192.168.0.253

192.168.0.253 192.168.0.253
r fo m g in o.co ok lo aho m w.y I w w

sever

192.168.0.253 192.168.0.253 ISP DNS ISP DNS 61.0.0.5 61.0.0.5

Linux Linux Client Client 192.168.0.1 192.168.0.1

I cli P ad en d t1 res . zo s om fo IP ad .co r 19 d m 2.1 res 68 s .0. is 1

Linux Linux Client Client 192.168.0.2 192.168.0.2 210.10.152.15 210.10.152.15

Linux Linux Client Client yahoo.com yahoo.com 192.168.0.1 192.168.0.1

Heres address of www.yahoo.com address 210.10.152.15 I r cli P ad fo m en d g in .co t1 res f . zo s ok o s o m IP lo aho om fo es co y r . ad m w. .co r d I w ad hoo 2.15 192 dre m w .16 ss s ya 15 re . . 8.0 is He ww 0.10 .1 w 21 61.0.0.5 61.0.0.5

DNS Add Forwarder DNS Add Forwarder Server IP address Server IP address

Im looking for www.yahoo.com

ISP DNS ISP DNS 61.0.0.5 61.0.0.5

Linux Linux Client Client 192.168.0.2 192.168.0.2 210.10.152.15 210.10.152.15

yahoo.com yahoo.com

Forwarder Configuration

Configuring DNS Server

DNS DNS Server Server 192.168.0.253 192.168.0.253 ISP DNS ISP DNS 61.0.0.5 61.0.0.5

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/bind* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/bind*

Linux Linux Client Client 192.168.0.1 192.168.0.1

Linux Linux Client Client 192.168.0.2 192.168.0.2 210.10.152.15 210.10.152.15

Open configuration for editing Open configuration for editing [root@comp1~]# vim /var/named/chroot/etc/named.conf [root@comp1~]# vim /var/named/chroot/etc/named.conf

yahoo.com yahoo.com

/var/named/chroot/etc/named.conf

Configuring Forward Lookup

To change the options To change the options options { options { directory /var/named; directory /var/named; }; }; zone "zoom.com" IN { zone "zoom.com" IN { type master; type master; file zoom.for"; file zoom.for"; }; }; zone "0.168.192.in-addr.arpa" IN { zone "0.168.192.in-addr.arpa" IN { type master; type master; file zoom.rev"; file zoom.rev"; }; };

Copying Forward lookup zone file Copying Forward lookup zone file cp /usr/share/doc/bind-9.3.3/sample/var/named/ cp /usr/share/doc/bind-9.3.3/sample/var/named/ localhost.zone localhost.zone /var/named/chroot/var/named/zoom.for /var/named/chroot/var/named/zoom.for

Open configuration for editing Open configuration for editing [root@comp1 named]# vim zoom.for [root@comp1 named]# vim zoom.for

/var/named/chroot/var/named/zoom.for

Configuring Reverse Lookup

To add the options To add the options $TTL 86400 $TTL 86400 @ IN @ IN SOA SOA server.zoom.com. root.zoom.com. (( server.zoom.com. root.zoom.com. 42 ;;serial (d. adams) 42 serial (d. adams) 3H 3H 15M 15M 1W 1W 1D )) 1D server server client1 client1 client2 client2 www www IN IN IN IN IN IN IN IN IN IN NS NS A A A A A A ;;refresh refresh ;;retry retry ;;expiry expiry ;;minimum minimum

Copying Forward lookup zone file Copying Forward lookup zone file
cp /usr/share/doc/bind-9.3.3/sample/var/named/ cp /usr/share/doc/bind-9.3.3/sample/var/named/ named.local named.local /var/named/chroot/var/named/zoom.rev /var/named/chroot/var/named/zoom.rev

server.zoom.com. server.zoom.com. 192.168.0.253 192.168.0.253 192.168.0.1 192.168.0.1 192.168.0.2 192.168.0.2

Open configuration for editing Open configuration for editing [root@comp1 ]#cd /var/named/chroot/var/named/ [root@comp1 ]#cd /var/named/chroot/var/named/ [root@comp1 named]# vim zoom.rev [root@comp1 named]# vim zoom.rev

CNAME server CNAME server

/var/named/chroot/var/named/zoom.rev

Configuring DNS Server IP address

To add the options To add the options $TTL $TTL @ @ 86400 86400 IN IN SOA SOA server.zoom.com. root.zoom.com. (( server.zoom.com. root.zoom.com. 1997022700 ;;Serial 1997022700 Serial 28800 28800 14400 14400 3600000 3600000 86400 )) 86400 253 253 1 1 2 2 IN IN IN IN IN IN IN IN NS NS PTR PTR PTR PTR PTR PTR server.zoom.com. server.zoom.com. server. server. client1. client1. client2. client2. ;;Refresh Refresh ;;Retry Retry ;;Expire Expire ;;Minimum Minimum

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

DNS Server

Checking from DNS Server

To restart the DNS services To restart the DNS services [root@comp1 ~]# service named restart [root@comp1 ~]# service named restart

Checking Forward Lookup Checking Forward Lookup [root@comp1 ~]# dig server.zoom.com [root@comp1 ~]# dig server.zoom.com [root@comp1 ~]# dig client1.zoom.com [root@comp1 ~]# dig client1.zoom.com

Checking Reverse Lookup Checking Reverse Lookup [root@comp1 ~]# dig x 192.168.0.253 [root@comp1 ~]# dig x 192.168.0.253 [root@comp1 ~]# dig x 192.168.0.1 [root@comp1 ~]# dig x 192.168.0.1

Checking Name resolution Checking Name resolution [root@comp1 ~]# ping server.zoom.com [root@comp1 ~]# ping server.zoom.com [root@comp1 ~]# ping client2.zoom.com [root@comp1 ~]# ping client2.zoom.com

Debug DNS File

Configuring DNS Client

To check main configuration file syntax To check main configuration file syntax [root~]#named-checkconf /var/named/chroot/etc/named.conf [root~]#named-checkconf /var/named/chroot/etc/named.conf

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

To check forward zone file syntax To check forward zone file syntax [root@comp1 ~]# named-checkzone zoom.com /var/named [root@comp1 ~]# named-checkzone zoom.com /var/named /chroot/var/named/zoom.for /chroot/var/named/zoom.for

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253 nameserver 192.168.0.254 nameserver 192.168.0.254

To check reverse zone file syntax To check reverse zone file syntax [root@comp1 ~]# named-checkzone zoom.com /var/named [root@comp1 ~]# named-checkzone zoom.com /var/named /chroot/var/named/zoom.rev /chroot/var/named/zoom.rev

Checking from DNS Client

Configuring Forwarder

Dig another PC via FQDN Dig another PC via FQDN [root@comp1 ~]# dig server.zoom.com [root@comp1 ~]# dig server.zoom.com [root@comp1 ~]# dig client2.zoom.com [root@comp1 ~]# dig client2.zoom.com

Open configuration for editing Open configuration for editing [root@comp1~]# vim /var/named/chroot/etc/named.conf [root@comp1~]# vim /var/named/chroot/etc/named.conf

Dig DNS server IP Dig DNS server IP [root@comp1 ~]# dig x 192.168.0.253 [root@comp1 ~]# dig x 192.168.0.253

Add the below line in /var/named/chroot/etc/named.conf Add the below line in /var/named/chroot/etc/named.conf zone example.com IN { zone example.com IN { type forward; type forward; forwarders { 61.0.0.5; }; forwarders { 61.0.0.5; };

Ping another PC via FQDN Ping another PC via FQDN [root@comp1 ~]# ping server.zoom.com [root@comp1 ~]# ping server.zoom.com [root@comp1 ~]# ping client2.zoom.com [root@comp1 ~]# ping client2.zoom.com

}; };

DNS Server

Configuring DNS Client

To restart the DNS services To restart the DNS services [root@comp1 ~]# service named restart [root@comp1 ~]# service named restart

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

Checking from DNS Client

Configuring DNS Server

Check by dig command Check by dig command [root@comp1 ~]# dig www.yahoo.com [root@comp1 ~]# dig www.yahoo.com

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@co]#rpm ivh --force --aid ftp://192.168.0.250:/pub/Server/bind* [root@co]#rpm ivh --force --aid ftp://192.168.0.250:/pub/Server/bind*

Check by ping command Check by ping command [root@comp1 ~]# ping www.yahoo.com [root@comp1 ~]# ping www.yahoo.com
Open configuration for editing Open configuration for editing [root@comp1~]# vim /var/named/chroot/etc/named.conf [root@comp1~]# vim /var/named/chroot/etc/named.conf

/var/named/chroot/etc/named.conf
To change the options To change the options options { options { directory /var/named; directory /var/named; }; }; zone "zoom.com" IN { zone "zoom.com" IN { type slave; type slave; file "slaves/zoom.for"; file "slaves/zoom.for"; masters { 192.168.0.253; }; masters { 192.168.0.253; }; }; }; zone "0.168.192.in-addr.arpa" IN { zone "0.168.192.in-addr.arpa" IN { type slave; type slave; file "slaves/zoom.rev"; file "slaves/zoom.rev"; masters { 192.168.0.253; }; masters { 192.168.0.253; }; }; };

Configuring DNS Server IP address

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.254 nameserver 192.168.0.254

DNS Server

To restart the DNS services To restart the DNS services [root@comp1 ~]# service named restart [root@comp1 ~]# service named restart

WEB Server for Linux/Unix

Tux Kernel based only text support, Very fast Stronghold from RedHat Linux Sun one Also known as iPlanet from Sun Microsystems AOL server American online free web server Apache Open source NETSCAPE

What is Apache ?

How HTTP Server works ?

Apache is a freeware & is the Most Popular & widely used Web Server which consumes 60% of web market that can be configured in both windows and LINUX. DNS DNS Server Server 192.168.0.253 192.168.0.253 server server Web Web Server Server 192.168.0.254 192.168.0.254
www.zoom.com www.zoom.com

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

Windows Windows Client Client 192.168.0.2 192.168.0.2 client2 client2

Requirements

HTTP Server Configuration

Packages httpd-2.0.52-9.ent.i386.rpm httpd-devel-2.0.52-9.ent.i386.rpm httpd-manual-2.0.52-9.ent.i386.rpm httpd-suexec-2.0.52-9.ent.i386.rpm Port Numbers 80 Http Configuration File /etc/httpd/conf/httpd.conf Service httpd Daemon httpd
ZOOM.COM ZOOM.COM Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 Windows Windows Client Client 192.168.0.2 192.168.0.2 client2 client2 DNS DNS Server Server 192.168.0.253 192.168.0.253 server server Web Web Server Server 192.168.0.254 192.168.0.254
www.zoom.com www.zoom.com

/etc/httpd/conf/httpd.conf

Add the below lines for Authentication Add the below lines for Authentication <Directory /var/www/html> <Directory /var/www/html> AuthUserFile /etc/httpd/conf/htpasswd AuthUserFile /etc/httpd/conf/htpasswd AuthName "WebAuthentication" AuthName "WebAuthentication" AuthType Basic AuthType Basic Require valid-user Require valid-user </Directory> </Directory>

Creating user and assigning password Creating user and assigning password [root@comp1~]# htpasswd -c /etc/httpd/conf/htpasswd user1 [root@comp1~]# htpasswd -c /etc/httpd/conf/htpasswd user1 New password: **** New password: **** Re-type new password: ****** Re-type new password: ******

Configuring HTTP Server

/etc/httpd/conf/httpd.conf

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@ ~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/http* [root@ ~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/http*

Change the below options Change the below options ServerAdmin [email protected] ServerAdmin [email protected] ServerName www.zoom.com:80 ServerName www.zoom.com:80 DocumentRoot "/var/www/html" DocumentRoot "/var/www/html" DirectoryIndex zoom.html DirectoryIndex zoom.html

Open configuration for editing Open configuration for editing [root@comp1~]# vi etc/httpd/conf/httpd.conf [root@comp1~]# vi etc/httpd/conf/httpd.conf

HTTP Server

Configuring DNS on Client

To restart the HTTP services To restart the HTTP services [root@comp1 ~]# service httpd restart [root@comp1 ~]# service httpd restart

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

HTTP Client Linux

HTTP Client Windows

Accessing Webserver Accessing Webserver Open Mozilla or Fire Fox browser. Open Mozilla or Fire Fox browser. In the address box type http://www.zoom.com or In the address box type http://www.zoom.com or http://192.168.0.254 http://192.168.0.254

Accessing Webserver Accessing Webserver Open Internet Explorer or Netscape Navigator browser. Open Internet Explorer or Netscape Navigator browser. In the address box type http://www.zoom.com or In the address box type http://www.zoom.com or http://192.168.0.254 http://192.168.0.254

How Web Server works ?


http://www.zoom.com

server2 Forward zone zoom.com www server

192.168.0.254 192.168.0.254 192.168.0.253

DNS DNS Server Server 192.168.0.253 192.168.0.253


r fo m g in .co of ok m lo zoo ss re .com m w. d I w for ad m 54 w uest s oo .2 re w.z 68.0Web Req .0.254 He w 2.1 168 w 9 192. 1 from eply eb R 8.0.254 W 6 192.1

server server Web Web Server Server 192.168.0.254 192.168.0.254


www.zoom.com www.zoom.com

Linux Linux Client Client 192.168.0.1 192.168.0.1

Windows Windows Client Client client2 client2

client1 client1 ZOOM.COM ZOOM.COM

192.168.0.2 192.168.0.2

Configuring DNS Server


http://www.zoom.com

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/bind* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/bind*

Open configuration for editing Open configuration for editing [root@comp1~]# vim /var/named/chroot/etc/named.conf [root@comp1~]# vim /var/named/chroot/etc/named.conf

/var/named/chroot/etc/named.conf

Configuring Forward Lookup

To change the options To change the options zone "zoom.com" IN { zone "zoom.com" IN { type master; type master; file zoom.for"; file zoom.for"; }; };

Copying Forward lookup zone file Copying Forward lookup zone file

cp /usr/share/doc/bind-9.3.3/sample/var/named/ cp /usr/share/doc/bind-9.3.3/sample/var/named/ localhost.zone /var/named/chroot/var/named/zoom.for localhost.zone /var/named/chroot/var/named/zoom.for

Open configuration for editing Open configuration for editing

[root@comp1 ]#cd /var/named/chroot/var/named/ [root@comp1 ]#cd /var/named/chroot/var/named/


[root@comp1 named]# vim zoom.for [root@comp1 named]# vim zoom.for

/var/named/chroot/var/named/zoom.for

Configuring DNS Server IP address

To add the options To add the options $TTL 86400 $TTL 86400 IN @ @ IN SOA SOA server.zoom.com. root.zoom.com. (( server.zoom.com. root.zoom.com. 42 ;;serial (d. adams) 42 serial (d. adams) 3H 3H 15M 15M 1W 1W 1D )) 1D server server server2 server2 www www IN IN IN IN IN IN IN IN NS NS A A ;;refresh refresh ;;retry retry ;;expiry expiry ;;minimum minimum

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

server.zoom.com. server.zoom.com. 192.168.0.253 192.168.0.253

A 192.168.0.254 A 192.168.0.254 CNAME server2 CNAME server2

DNS Server

Checking from DNS Server

To restart the DNS services To restart the DNS services [root@comp1 ~]# service named restart [root@comp1 ~]# service named restart

Checking Forward Lookup Checking Forward Lookup [root@comp1 ~]# dig www.zoom.com [root@comp1 ~]# dig www.zoom.com

Checking Name resolution Checking Name resolution [root@comp1 ~]# ping www.zoom.com [root@comp1 ~]# ping www.zoom.com

Types of Virtual Hosting

Name based IP based Port based

Virtual Hosting Name based

Virtual Hosting IP based

DNS DNS Server Server 192.168.0.253 192.168.0.253 server server Web Web Server Server 192.168.0.254 192.168.0.254
www.zoom.com www.zoom.com

DNS DNS Server Server 192.168.0.253 192.168.0.253 server server Web Web Server Server 192.168.0.254 192.168.0.254 192.168.0.252 192.168.0.252
www.zoom.com www.zoom.com

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

www.ibm.com www.ibm.com

Windows Windows Client Client 192.168.0.2 192.168.0.2 client2 client2

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

www.google.com www.google.com

Windows Windows Client Client 192.168.0.2 192.168.0.2 client2 client2

Virtual Hosting Port based

Requirements

Packages
DNS DNS Server Server 192.168.0.253 192.168.0.253 server server Web Web Server Server 192.168.0.254 192.168.0.254
www.zoom.com www.zoom.com

httpd-2.0.52-9.ent.i386.rpm httpd-devel-2.0.52-9.ent.i386.rpm httpd-manual-2.0.52-9.ent.i386.rpm httpd-suexec-2.0.52-9.ent.i386.rpm Port Numbers 80 Http Configuration File

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

Windows Windows Client Client 192.168.0.2 192.168.0.2

www.redhat.com www.redhat.com 5000 5000

/etc/httpd/conf/httpd.conf Service httpd Daemon httpd

client2 client2

Virtual Hosting Name Based Configuration

Virtual Hosting IP based Configuration

DNS DNS Server Server 192.168.0.253 192.168.0.253 server server Web Web Server Server 192.168.0.254 192.168.0.254
www.zoom.com www.zoom.com

DNS DNS Server Server 192.168.0.253 192.168.0.253 server server Web Web Server Server 192.168.0.254 192.168.0.254 192.168.0.252 192.168.0.252
www.zoom.com www.zoom.com

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

www.ibm.com www.ibm.com

Windows Windows Client Client 192.168.0.2 192.168.0.2 client2 client2

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

www.google.com www.google.com

Windows Windows Client Client 192.168.0.2 192.168.0.2 client2 client2

Virtual Hosting Port based Configuration

Configuring HTTP Server

DNS DNS Server Server 192.168.0.253 192.168.0.253 server server Web Web Server Server 192.168.0.254 192.168.0.254

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1 ~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/http* [root@comp1 ~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/http*

www.zoom.com www.zoom.com

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

Windows Windows Client Client 192.168.0.2 192.168.0.2

www.redhat.com www.redhat.com 5000 5000

Open configuration for editing Open configuration for editing [root@comp1~]# vi etc/httpd/conf/httpd.conf [root@comp1~]# vi etc/httpd/conf/httpd.conf

client2 client2

/etc/httpd/conf/httpd.conf

HTTP Server

Add the below lines Add the below lines NameVirtualHost *:80 NameVirtualHost *:80 <VirtualHost *:80> <VirtualHost *:80> ServerAdmin [email protected] ServerAdmin [email protected] DocumentRoot /var/www/html DocumentRoot /var/www/html ServerName www.zoom.com ServerName www.zoom.com DirectoryIndex zoom.html DirectoryIndex zoom.html </VirtualHost> </VirtualHost> <VirtualHost *:80> <VirtualHost *:80> ServerAdmin [email protected] ServerAdmin [email protected] DocumentRoot /var/www/html DocumentRoot /var/www/html ServerName www.ibm.com ServerName www.ibm.com DirectoryIndex ibm.html DirectoryIndex ibm.html </VirtualHost> </VirtualHost>

To restart the HTTP services To restart the HTTP services [root@comp1 ~]# service httpd restart [root@comp1 ~]# service httpd restart

Configuring DNS on Client

HTTP Client Linux

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

Accessing Webserver Accessing Webserver Open Mozilla or Fire Fox browser. Open Mozilla or Fire Fox browser. In the address box type http://www.zoom.com and In the address box type http://www.zoom.com and http://www.ibm.com http://www.ibm.com

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

HTTP Client Windows

Configuring HTTP Server

Accessing Webserver Accessing Webserver Open Internet Explorer or Netscape Navigator browser. Open Internet Explorer or Netscape Navigator browser. In the address box type http://www.zoom.com and In the address box type http://www.zoom.com and http://www.ibm.com http://www.ibm.com

Assinging Virtual IP address Assinging Virtual IP address [root@comp1 ~]# netconfig --device eth0:1 [root@comp1 ~]# netconfig --device eth0:1 [root@comp1 ~]# service network restart [root@comp1 ~]# service network restart

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi etc/httpd/conf/httpd.conf [root@comp1 ~]# vi etc/httpd/conf/httpd.conf

/etc/httpd/conf/httpd.conf

HTTP Server

Add the below lines Add the below lines <VirtualHost 192.168.0.252:80> <VirtualHost 192.168.0.252:80> ServerAdmin [email protected] ServerAdmin [email protected] DocumentRoot /var/www/html DocumentRoot /var/www/html ServerName www.google.com ServerName www.google.com DirectoryIndex google.html DirectoryIndex google.html </VirtualHost> </VirtualHost>

To restart the HTTP services To restart the HTTP services [root@comp1 ~]# service httpd restart [root@comp1 ~]# service httpd restart

Configuring DNS on Client

HTTP Client Linux

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

Accessing Webserver Accessing Webserver Open Mozilla or Fire Fox browser. Open Mozilla or Fire Fox browser. In the address box type http://www.google.com or In the address box type http://www.google.com or http://192.168.0.252 http://192.168.0.252

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

HTTP Client Windows

Configuring HTTP Server

Accessing Webserver Accessing Webserver Open Internet Explorer or Netscape Navigator browser. Open Internet Explorer or Netscape Navigator browser. In the address box type http://www.google.com or In the address box type http://www.google.com or http://192.168.0.252 http://192.168.0.252

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/httpd/conf/httpd.conf [root@comp1 ~]# vi /etc/httpd/conf/httpd.conf

/etc/httpd/conf/httpd.conf

HTTP Server

Add the below lines Add the below lines LISTEN 5000 LISTEN 5000 <VirtualHost 192.168.0.253:5000> <VirtualHost 192.168.0.253:5000> ServerAdmin [email protected] ServerAdmin [email protected] DocumentRoot /var/www/html DocumentRoot /var/www/html ServerName www.redhat.com ServerName www.redhat.com DirectoryIndex redhat.html DirectoryIndex redhat.html </VirtualHost> </VirtualHost>

To restart the HTTP services To restart the HTTP services [root@comp1 ~]# service httpd restart [root@comp1 ~]# service httpd restart

Configuring DNS on Client

HTTP Client Linux

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

Accessing Webserver Accessing Webserver Open Mozilla or Fire Fox browser. Open Mozilla or Fire Fox browser. In the address box type http://www.redhat.com:5000 or In the address box type http://www.redhat.com:5000 or http://192.168.0.254:5000 http://192.168.0.254:5000

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

HTTP Client Windows


http://www.zoom.com

Accessing Webserver Accessing Webserver Open Internet Explorer or Netscape Navigator browser. Open Internet Explorer or Netscape Navigator browser. In the address box type http://www.redhat.com:5000 or In the address box type http://www.redhat.com:5000 or http://192.168.0.254:5000 http://192.168.0.254:5000

How Web Server works ?


server2 Forward zone zoom.com www server 192.168.0.254 192.168.0.254 192.168.0.253 192.168.0.254 192.168.0.254
http://www.zoom.com

Forward zone

DNS DNS Server Server


ibm.com

server2 www server

192.168.0.253 192.168.0.253

server server

192.168.0.253

Linux Linux Client Client 192.168.0.1 192.168.0.1

r fo m Server Server g in .co of ok om s m lo zo s 192.168.0.254 192.168.0.254 . re o Im ww dd m.c 54 or w est f s a zoo .0.2 qu re . 8 b Re .com He ww 2.16 We w.zoom w 9 w w 1 m y fro Windows Windows Re p l m Web zoom.co Client Client . ww w

Web Web

www.zoom.com www.zoom.com

www.ibm.com www.ibm.com

client1 client1 ZOOM.COM ZOOM.COM

192.168.0.2 192.168.0.2

client2 client2

How Web Server works ?


http://www.ibm.com

Server2 Forward zone zoom.com www server

192.168.0.254 192.168.0.254 192.168.0.253 192.168.0.254 192.168.0.254

Forward zone

DNS DNS Server Server


ibm.com

server2 www server

192.168.0.253 192.168.0.253

server server

192.168.0.253

Linux Linux Client Client 192.168.0.1 192.168.0.1

r fo g in .com of ok lo .ibm ss re om m ww d I for w ad .c 54 uest s bm .2 re w.i 68.0Web Req .com He ww 2.1 .ibm www 19 from eply eb R m.com W . ib www

Web Web Server Server 192.168.0.254 192.168.0.254

www.zoom.com www.zoom.com

www.ibm.com www.ibm.com

Windows Windows Client Client client2 client2

client1 client1 ZOOM.COM ZOOM.COM

192.168.0.2 192.168.0.2

http://www.ibm.com

http://www.google.com

How Web Server works ?


Server2 Forward zone zoom.com www server 192.168.0.254 192.168.0.254 192.168.0.253 192.168.0.252 192.168.0.252
http://www.google.com

Forward zone

DNS DNS Server Server


google.com

server2 www server

192.168.0.253 192.168.0.253

server server

192.168.0.253

Linux Linux Client Client 192.168.0.1 192.168.0.1

r fo Server Server g om in le.c f ok so m lo oog 192.168.0.254 192.168.0.254 es o g dr .c Im w. r w ad ogle .252 st fo w ue s 192.168.0.252 192.168.0.252 re .go 8.0 b Req .com He ww 2.16 We w.google w 19 ww from Windows Windows eply eb R ogle.com W Client Client w.go ww

Web Web

www.zoom.com www.zoom.com

www.ibm.com www.ibm.com

client1 client1 ZOOM.COM ZOOM.COM

192.168.0.2 192.168.0.2

client2 client2

How Web Server works ?


http://www.redhat.com:5000

Server2 Forward zone zoom.com www server

192.168.0.254 192.168.0.254 192.168.0.253 192.168.0.254 192.168.0.254

Forward zone

DNS DNS Server Server


redhat.com

server2 www server

192.168.0.253 192.168.0.253

server server

192.168.0.253

Linux Linux Client Client 192.168.0.1 192.168.0.1

r fo m g in t.co f ok a so lo edh es com r dr . Im ww. or ad hat .254 w est f es .red 8.0 eb Requ om:5000 er w 16 W at.c H w 2. .redh w 19 www m y fro 000 Re p l :5 Web hat.com .red www

Web Web Server Server 192.168.0.254 192.168.0.254

www.zoom.com www.zoom.com

Web Web Client Client

www.redhat.com www.redhat.com 5000 5000

client1 client1 ZOOM.COM ZOOM.COM

192.168.0.2 192.168.0.2

client2 client2

Configuring DNS Server


http://www.redhat.com:5000

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/bind* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/bind*

Open configuration for editing Open configuration for editing [root@comp1~]# vim /var/named/chroot/etc/named.conf [root@comp1~]# vim /var/named/chroot/etc/named.conf

/var/named/chroot/etc/named.conf

Configuring Forward Lookup

To change the options To change the options zone "zoom.com" IN { zone "zoom.com" IN { type master; type master; file zoom.for"; file zoom.for"; }; }; zone ibm.com" IN { zone ibm.com" IN { type master; type master; file ibm.for"; file ibm.for"; }; };

Copying Forward lookup zone file Copying Forward lookup zone file

cp /usr/share/doc/bind-9.3.3/sample/var/named/ cp /usr/share/doc/bind-9.3.3/sample/var/named/ localhost.zone localhost.zone /var/named/chroot/var/named/zoom.for /var/named/chroot/var/named/zoom.for

Open configuration for editing Open configuration for editing

[root@comp1 ]#cd /var/named/chroot/var/named/ [root@comp1 ]#cd /var/named/chroot/var/named/


[root@comp1 named]# vim zoom.for [root@comp1 named]# vim zoom.for

/var/named/chroot/var/named/zoom.for

Configuring Forward Lookup

Copying Forward lookup zone file Copying Forward lookup zone file
To add the options To add the options $TTL 86400 $TTL 86400 @ IN @ IN SOA SOA server.zoom.com. root.zoom.com. (( server.zoom.com. root.zoom.com. ;;serial (d. adams) 42 42 serial (d. adams) 3H 3H 15M 15M 1W 1W 1D )) 1D server server server2 server2 www www IN IN IN IN IN IN IN IN NS NS A A A A CNAME CNAME ;;refresh refresh ;;retry retry ;;expiry expiry ;;minimum minimum

cp /usr/share/doc/bind-9.3.3/sample/var/named/ cp /usr/share/doc/bind-9.3.3/sample/var/named/ localhost.zone localhost.zone /var/named/chroot/var/named/ibm.for /var/named/chroot/var/named/ibm.for

Open configuration for editing Open configuration for editing

[root@comp1 ]#cd /var/named/chroot/var/named/ [root@comp1 ]#cd /var/named/chroot/var/named/


[root@comp1 named]# vim ibm.for [root@comp1 named]# vim ibm.for

server.zoom.com. server.zoom.com. 192.168.0.253 192.168.0.253 192.168.0.254 192.168.0.254 server2 server2

/var/named/chroot/var/named/ibm.for

Configuring DNS Server IP address

To add the options To add the options $TTL 86400 $TTL 86400 @ @ IN IN SOA SOA

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf
;;serial (d. adams) serial (d. adams) ;;refresh refresh ;;retry retry ;;expiry expiry

server.ibm.com. root.ibm.com. (( server.ibm.com. root.ibm.com.


42 42 3H 3H 15M 15M 1W 1W

server server server2 server2 www www

IN IN IN IN IN IN IN IN

NS NS A A

1D )) ;;minimum 1D minimum server.ibm.com. server.ibm.com. 192.168.0.253 192.168.0.253 192.168.0.254 192.168.0.254

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

A A CNAME server2 CNAME server2

DNS Server

Checking from DNS Server

To restart the DNS services To restart the DNS services [root@comp1 ~]# service named restart [root@comp1 ~]# service named restart

Checking Forward Lookup Checking Forward Lookup [root@comp1 ~]# dig www.zoom.com [root@comp1 ~]# dig www.zoom.com [root@comp1 ~]# dig www.ibm.com [root@comp1 ~]# dig www.ibm.com

Checking Name resolution Checking Name resolution [root@comp1 ~]# ping www.zoom.com [root@comp1 ~]# ping www.zoom.com [root@comp1 ~]# ping www.ibm.com [root@comp1 ~]# ping www.ibm.com

Configuring DNS Server

/var/named/chroot/etc/named.conf

Open configuration for editing Open configuration for editing [root@comp1~]# vi /etc/named.conf [root@comp1~]# vi /etc/named.conf

To add the below lines To add the below lines zone google.com" IN { zone google.com" IN { type master; type master; file google.for"; file google.for"; }; };

Configuring Forward Lookup

/var/named/chroot/var/named/google.for

Copying Forward lookup zone file Copying Forward lookup zone file

To add the options To add the options $TTL 86400 $TTL 86400 @ IN @ IN SOA SOA
server.google.com. root.google.com. ( server.google.com. root.google.com. (

cp /usr/share/doc/bind-9.3.3/sample/var/named/ cp /usr/share/doc/bind-9.3.3/sample/var/named/ localhost.zone localhost.zone /var/named/chroot/var/named/google.for /var/named/chroot/var/named/google.for

42 42 3H 3H

;;serial (d. adams) serial (d. adams) ;;refresh refresh ;;retry retry ;;expiry expiry ;;minimum minimum

Open configuration for editing Open configuration for editing [root@comp1 ]#cd /var/named/chroot/var/named/ [root@comp1 ]#cd /var/named/chroot/var/named/ [root@comp1 named]# vim google.for [root@comp1 named]# vim google.for
server server server2 server2 www www IN IN IN IN IN IN IN IN NS NS A A

15M 15M 1W 1W

1D )) 1D server.google.com. server.google.com. 192.168.0.253 192.168.0.253 192.168.0.252 192.168.0.252

A A CNAME server2 CNAME server2

Configuring DNS Server IP address

DNS Server

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

To restart the DNS services To restart the DNS services [root@comp1 ~]# service named restart [root@comp1 ~]# service named restart

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

Checking from DNS Server

Configuring DNS Server

Checking Forward Lookup Checking Forward Lookup [root@comp1 ~]# dig www.google.com [root@comp1 ~]# dig www.google.com

Open configuration for editing Open configuration for editing [root@comp1~]# vi /etc/named.conf [root@comp1~]# vi /etc/named.conf

Checking Name resolution Checking Name resolution [root@comp1 ~]# ping www.google.com [root@comp1 ~]# ping www.google.com

/var/named/chroot/etc/named.conf

Configuring Forward Lookup

To add the below lines To add the below lines zone redhat.com" IN { zone redhat.com" IN { type master; type master; file redhat.for"; file redhat.for"; }; };

Copying Forward lookup zone file Copying Forward lookup zone file

cp /usr/share/doc/bind-9.3.3/sample/var/named/ cp /usr/share/doc/bind-9.3.3/sample/var/named/ localhost.zone localhost.zone /var/named/chroot/var/named/redhat.for /var/named/chroot/var/named/redhat.for

Open configuration for editing Open configuration for editing

[root@comp1 ]#cd /var/named/chroot/var/named/ [root@comp1 ]#cd /var/named/chroot/var/named/


[root@comp1 named]# vim redhat.for [root@comp1 named]# vim redhat.for

/var/named/chroot/var/named/redhat.for

Configuring DNS Server IP address

To add the options To add the options $TTL 86400 $TTL 86400 @ @ (( 42 42 3H 3H 15M 15M 1W 1W IN IN IN IN IN IN IN IN NS NS A A ;;serial (d. adams) serial (d. adams) ;;refresh refresh ;;retry retry ;;expiry expiry ;;minimum minimum IN IN SOA SOA

server.redhat.com. root.redhat.com. server.redhat.com. root.redhat.com.

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

1D )) 1D server.redhat.com. server.redhat.com. 192.168.0.253 192.168.0.253 192.168.0.254 192.168.0.254

server server server2 server2 www www

A A CNAME server2 CNAME server2

DNS Server

Checking from DNS Server

To restart the DNS services To restart the DNS services [root@comp1 ~]# service named restart [root@comp1 ~]# service named restart

Checking Forward Lookup Checking Forward Lookup [root@comp1 ~]# dig www.redhat.com [root@comp1 ~]# dig www.redhat.com

Checking Name resolution Checking Name resolution [root@comp1 ~]# ping www.redhat.com [root@comp1 ~]# ping www.redhat.com

What is Proxy Server ?

Proxy Server controls client computers access to the Internet. It blocks the users from accessing undesirable websites and hides the internal identity of the network. It improves performance by storing webpages locally. It is generally used to share internet from one machine to several clients. Squid Proxy is widely used as Proxy because it provides many features & is an open source.

Squid Proxy Server

How Proxy Server works ?

Squid proxy can be configured as : A Simple Proxy (ie to share server) A Caching Web Server A Firewall
www.yahoo.com www.yahoo.com

Proxy Proxy Server Server 192.168.0.253 192.168.0.253

210.10.152.15 210.10.152.15 Linux Linux Client Client 192.168.0.1 192.168.0.1

Windows Windows Client Client 192.168.0.2 192.168.0.2

Requirements

Proxy Server Configuration

Packages squid-2.5.STABLE6-3.i386.rpm Port Numbers 3128 (default) Configuration File /etc/squid/squid.conf Service squid Daemon squid
Linux Linux Client Client 192.168.0.1 192.168.0.1 Windows Windows Client Client 192.168.0.2 192.168.0.2 210.10.152.15 210.10.152.15 Proxy Proxy Server Server 192.168.0.253 192.168.0.253
www.yahoo.com www.yahoo.com

Configuring Proxy Server

/etc/squid/squid.conf

To change the options To change the options


Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/squid* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/squid*

http_port 3128 http_port 3128 cache_dir ufs /var/spool/squid 100 16 256 cache_dir ufs /var/spool/squid 100 16 256 visible_hostname linux-squid visible_hostname linux-squid acl our_networks src 192.168.0.0/24 acl our_networks src 192.168.0.0/24 acl business_hours time S M T W H F A 09:00-17:30 acl business_hours time S M T W H F A 09:00-17:30 acl test url_regex www.yahoo.com acl test url_regex www.yahoo.com http_access allow our_networks business_hours test http_access allow our_networks business_hours test

Open configuration for editing Open configuration for editing [root@comp1~]# vi /etc/squid/squid.conf [root@comp1~]# vi /etc/squid/squid.conf

Proxy Server

Configuring Proxy Client - Linux

To restart the Proxy services To restart the Proxy services [root@comp1 ~]# service squid restart [root@comp1 ~]# service squid restart

Configuring Proxy Client Text Mode Configuring Proxy Client Text Mode [root@comp1 ~]# elinks [root@comp1 ~]# elinks

In Elinks window In Elinks window Go to Setup menu and Select Options Manager .. Go to Setup menu and Select Options Manager In the Protocols, select on Http. In the Protocols, select on Http. Select the Proxy Configuration option. Select the Proxy Configuration option. In Host and port number, select Edit. In Host and port number, select Edit. Type Proxy IP address and Proxy Port No. Type Proxy IP address and Proxy Port No. Then select Save and OK. Then select Save and OK. Close Close

Configuring Proxy Client - Linux


http://www.yahoo.com

Configuring Proxy Client --Graphically Configuring Proxy Client Graphically Open Mozilla / Firefox. Open Mozilla / Firefox. Go to Edit menu and Select Preferences .. Go to Edit menu and Select Preferences In the General, click on Connection Settings. In the General, click on Connection Settings. Select the Manual Proxy Configuration option. Select the Manual Proxy Configuration option. In the Http Proxy box, type Proxy IP address In the Http Proxy box, type Proxy IP address In the Http proxy Port box, type Proxy Port No. In the Http proxy Port box, type Proxy Port No.

How Proxy Server works ?


http://www.yahoo.com

Proxy Proxy www.yahoo.com www.yahoo.com Server Web Pages Server Web Pages 192.168.0.253 192.168.0.253
Cached Cached
or tf m es .co 0.1 qu o . re ho 168 253 eb .ya 92. 8.0. m W ww :1 16 ro m w om 92. y f o 53 pl oo.c .0.2 r :1 F Re h 68 0.1 To eb ya .1 8. W ww. 192 .16 w m : 192 o : Windows Fr To Windows

Web Request for www.yahoo.com From : 192.168.0.253 To : 210.10.152.15 Web Reply from www.yahoo.com From : 210.10.152.15 To : 192.168.0.253

www.yahoo.com www.yahoo.com

210.10.152.15 210.10.152.15

Linux Linux Client Client 192.168.0.1 192.168.0.1

Client Client 192.168.0.2 192.168.0.2

How Proxy Server works ?


http://www.yahoo.com

Proxy Proxy www.yahoo.com www.yahoo.com Server Cached Server Cached 192.168.0.253 192.168.0.253
Web Page Web Page
r fo st m ue .co .2 eq oo .0 b r ah .168 .253 0 We w.y 2 19 8. ww : .16 om 2 Fr : 19 m fro om 3 To ply .c .25 Re hoo 8.0 1 eb a 16 0. W w.y 92. 168. ww m : 1 92. o :1 Fr To

www.yahoo.com www.yahoo.com

210.10.152.15 210.10.152.15

Linux Linux Client Client 192.168.0.1 192.168.0.1

Windows Windows Client Client 192.168.0.2 192.168.0.2

http://www.yahoo.com

MAIL Server for Linux/Unix Sendmail Postfix Qmail The Qmail MTA is another alternative to sendmail. It is used by an impressive list of Internet sites. Smail It is reportedly easier to configure than sendmail. It also includes support for blocking messages. Exim The Exim MTA was developed at Cambridge (U.K.) and is licensed under the GPL. While based on an older MTA known as Smail,

How Mail Server works ?

Requirements Packages sendmail-8.13.1-2.i386.rpm sendmail-cf-8.13.1-2.i386.rpm sendmail-devel-8.13.1-2.i386.rpm sendmail-doc-8.13.1-2.i386.rpm m4-1.4.1-16.i386.rpm Port Numbers Simple Mail Transfer Protocol 25 Post Office Protocol 110 143 Interim Mail Access Protocol Configuration File /etc/mail/sendmail.mc /etc/mail/sendmail.cf Service sendmail Daemon sendmail

DNS DNS Server Server 192.168.0.253 192.168.0.253 server server Mail Mail Server Server 192.168.0.254 192.168.0.254
mail.zoom.com mail.zoom.com

user1 user1 user2 user2 Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM Windows Windows Client Client 192.168.0.2 192.168.0.2 client2 client2

Mail Server Configuration

Configuring Mail Server

DNS DNS Server Server 192.168.0.253 192.168.0.253 server server Mail Mail Server Server 192.168.0.254 192.168.0.254
mail.zoom.com mail.zoom.com

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/sendmail* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/sendmail* [root@comp1 ~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/m4* [root@comp1 ~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/m4*

user1 user1 user2 user2 Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM Windows Windows Client Client 192.168.0.2 192.168.0.2 client2 client2

Open configuration for editing Open configuration for editing [root@comp1~]# vi /etc/mail/sendmail.mc [root@comp1~]# vi /etc/mail/sendmail.mc

/etc/mail/sendmail.mc

Mail Server

To change the options To change the options dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl Name=MTA')dnl LOCAL_DOMAIN(`mail.zoom.com')dnl LOCAL_DOMAIN(`mail.zoom.com')dnl

To compile the file To compile the file [root@comp1 ~]# m4 /etc/mail/sendmail.mc > [root@comp1 ~]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf /etc/mail/sendmail.cf

To restart the mail services To restart the mail services [root@comp1 ~]# service sendmail restart [root@comp1 ~]# service sendmail restart

Mail Server

Testing Mail Server

To create users To create users [root@comp1 ~]#useradd user1 [root@comp1 ~]#useradd user1 [root@comp1 ~]#useradd user2 [root@comp1 ~]#useradd user2

To send mail from one user to another To send mail from one user to another [root@comp1 ~]#mail user1 [root@comp1 ~]#mail user1 Subject: Test Message Subject: Test Message Hi Hi this is to test the mail this is to test the mail .. Cc: Cc: [root@comp1 ~]# [root@comp1 ~]#

To check mail as a user To check mail as a user [root@comp1 ~]#su --user1 [root@comp1 ~]#su user1 [user1@comp1 ~]$mail [user1@comp1 ~]$mail

Configuring DNS Server

/var/named/chroot/etc/named.conf

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/bind* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/bind*

To change the options To change the options zone "zoom.com" IN { zone "zoom.com" IN { type master; type master; file zoom.for"; file zoom.for"; }; };

Open configuration for editing Open configuration for editing [root@comp1~]# vim /var/named/chroot/etc/named.conf [root@comp1~]# vim /var/named/chroot/etc/named.conf

Configuring Forward Lookup

/var/named/chroot/var/named/zoom.for

Copying Forward lookup zone file Copying Forward lookup zone file [root@comp1 ~]# cp /usr/share/doc/bind-9.3.3/sample/var/named/ [root@comp1 ~]# cp /usr/share/doc/bind-9.3.3/sample/var/named/

To add the options To add the options $TTL 86400 $TTL 86400 @ IN @ IN SOA SOA server.zoom.com. root.zoom.com. (( server.zoom.com. root.zoom.com. 42 ;;serial (d. adams) 42 serial (d. adams) 3H 3H 15M 15M ;;refresh refresh ;;retry retry ;;expiry expiry ;;minimum minimum

localhost.zone localhost.zone

/var/named/chroot/var/named/zoom.for /var/named/chroot/var/named/zoom.for

Open configuration for editing Open configuration for editing

[root@comp1 ]#cd /var/named/chroot/var/named/ [root@comp1 ]#cd /var/named/chroot/var/named/


[root@comp1 named]# vim zoom.for [root@comp1 named]# vim zoom.for
server server server2 server2 mail mail

1W 1W 1D )) 1D IN IN IN IN IN IN IN IN IN IN NS NS A A

server.zoom.com. server.zoom.com. 192.168.0.253 192.168.0.253

A 192.168.0.254 A 192.168.0.254 CNAME server CNAME server MX 5 mail MX 5 mail

Configuring DNS Server IP address

DNS Server

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

To restart the DNS services To restart the DNS services [root@comp1 ~]# service named restart [root@comp1 ~]# service named restart

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

Checking from DNS Server

Checking Forward Lookup Checking Forward Lookup [root@comp1 ~]# dig mail.zoom.com [root@comp1 ~]# dig mail.zoom.com

Checking Name resolution Checking Name resolution [root@comp1 ~]# ping mail.zoom.com [root@comp1 ~]# ping mail.zoom.com

Requirements Packages squirrelmail-1.4.3a-7.EL4.noarch.rpm dovecot-0.99.11-2.EL4.1.i386.rpm curl* php* perl* cyrus* httpd*

Squirrel Mail Configuration

DNS DNS Server Server 192.168.0.253 192.168.0.253 server server Mail Mail Server Server 192.168.0.254 192.168.0.254
mail.zoom.com mail.zoom.com

Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM

Windows Windows Client Client 192.168.0.2 192.168.0.2 client2 client2

Configuring Squirrel Mail

Squirrel Mail

Install the package by using one of the installation methods Install the package by using one of the installation methods

[root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/squirrel* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/squirrel* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/php* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/php* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/perl* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/perl* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/curl* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/curl* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/dovecot* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/dovecot* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/httpd* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/httpd* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/cyrus* [root@comp1~]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/cyrus*

To restart services To restart services [root@comp1 ~]# service httpd restart [root@comp1 ~]# service httpd restart [root@comp1 ~]# service dovecot restart [root@comp1 ~]# service dovecot restart [root@comp1 ~]# service cyrus-imapd restart [root@comp1 ~]# service cyrus-imapd restart [root@comp1 ~]# service saslauthd restart [root@comp1 ~]# service saslauthd restart

Configuring DNS on Client

HTTP Client Linux

Open configuration for editing Open configuration for editing [root@comp1 ~]# vi /etc/resolv.conf [root@comp1 ~]# vi /etc/resolv.conf

Accessing Webmail Accessing Webmail Open Mozilla or Fire Fox browser. Open Mozilla or Fire Fox browser. In the address box type http://mail.zoom.com/webmail or In the address box type http://mail.zoom.com/webmail or http://192.168.0.254/webmail http://192.168.0.254/webmail

Add the DNS server IP address in file /etc/resolv.conf Add the DNS server IP address in file /etc/resolv.conf nameserver 192.168.0.253 nameserver 192.168.0.253

How Mail Server works ?


http://mail.zoom.com/webmail

Server2 Forward zone zoom.com mail Server

192.168.0.254 192.168.0.254 192.168.0.253

DNS DNS Server Server 192.168.0.253 192.168.0.253


r fo g m in .co f ok so lo oom es om z dr c Im ail. or ad om. .254 m est f es l.zo 8.0 eb Requ .com er ai 16 W m H m 2. .zoo mail 19 m y fro Re p l m Web zoom.co . mail

server server Mail Mail Server Server 192.168.0.254 192.168.0.254


mail.zoom.com mail.zoom.com

user1 user1 user2 user2 Windows Windows Client Client client2 client2

Linux Linux Client Client 192.168.0.1 192.168.0.1

client1 client1 ZOOM.COM ZOOM.COM

192.168.0.2 192.168.0.2

http://mail.zoom.com/webmail

http://mail.zoom.com/webmail/src/webmail.php

user1 ****

http://mail.zoom.com/webmail/src/webmail.php

http://mail.zoom.com/webmail/src/webmail.php

[email protected]

Test Mail

Hello, This is the test mail

Regards User1

http://mail.zoom.com/webmail/src/webmail.php

http://mail.zoom.com/webmail

user2 ****

http://mail.zoom.com/webmail/src/webmail.php

http://mail.zoom.com/webmail/src/webmail.php

Test Mail user1 <[email protected]> Thu, March 8, 2007 2:45 pm


user1 2.45 pm Test Mail

[email protected] Normal
View Full Header Hello, This is the test mail Printable Version

Regards User1

http://mail.zoom.com/webmail/src/webmail.php

What is DHCP?

It gives IP Addresses Automatically to the Clients who is requesting for an IP Address Centralized IP Address Management DHCP prevents IP address Conflicts and helps conserve the use of client IP Address on the Network DHCP reduces the complexity and amount of

administrative work by assigning TCP/IP configuration Client IP configuration is updated automatically

Why DHCP ?

How DHCP Server works ?

Static IP Assigning
IP addresses are entered manually IP address could be entered incorrectly Communication and network issues can result Frequent computer moves increase administrative effort

Dynamic IP Assigning
IP addresses are supplied automatically Correct configuration information is ensure Client configuration is updated automatically A common source of network problems is eliminated
5e7c-3a2c-1d9b 5e7c-3a2c-1d9b

DHCP DHCP Server1 Server1 192.168.0.253 192.168.0.253


5e7c-3a2c-1d9a 5e7c-3a2c-1d9a

DHCP DHCP Server2 Server2 192.168.0.254 192.168.0.254


5e7c-3a2c-1d9d 5e7c-3a2c-1d9d

Linux Linux Client Client

Windows Windows Client Client 192.168.0.2 192.168.0.2


5e7c-3a2c-1d9c 5e7c-3a2c-1d9c

How DHCP Server works ?


DHCP Client broadcasts DHCP Client broadcasts a DHCPDISCOVER packet a DHCPDISCOVER packet DHCP DHCP Server1 Server1 192.168.0.253 192.168.0.253
5e7c-3a2c-1d9a 5e7c-3a2c-1d9a

How DHCP Server works ?


DHCP Server broadcast DHCP Server broadcast IP address Pool a DHCPOFFER packet a DHCPOFFER packet DHCP DHCP Server1 Server1 192.168.0.253 192.168.0.253 DHCP DHCP Server2 Server2 192.168.0.254 192.168.0.254
192.168.0.1 192.168.0.2 192.168.0.3

5e7c-3a2c-1d9a 192.168.0.100 5e7c-3a2c-1d9a


F Fr ro D Toomm : DHHC To : 5 C P OOffe : 5 5e: 5e e7 P O ffe r e 7 7c c- O ff r I IP 7c c-3 -3 3a ffe er P : - 3 a 2 a2 2c r : 1 19 a2 c c- -1 92 2.1 c-1-1d 1dd9 .16 68 d9 9b 9a a 8.0.0. b .1 1

DHCP DHCP Server2 Server2 192.168.0.254 192.168.0.254


5e7c-3a2c-1d9d 5e7c-3a2c-1d9d

Linux Linux Client Client

r oveer 9b i i c ov - -d 9b DDssca2cc11d P 2 HC P 7c-3 a fff DDHC5ee7c--3ffff-ff-ffff f m : : 5: ffffffff-ff rr FFoomToo : T

5e7c-3a2c-1d9d 5e7c-3a2c-1d9d

Windows Windows Client Client 192.168.0.2 192.168.0.2

Linux Linux Client Client

Windows Windows Client Client 192.168.0.2 192.168.0.2

5e7c-3a2c-1d9b 5e7c-3a2c-1d9b

5e7c-3a2c-1d9c 5e7c-3a2c-1d9c

5e7c-3a2c-1d9b 5e7c-3a2c-1d9b

5e7c-3a2c-1d9c 5e7c-3a2c-1d9c

How DHCP Server works ?

How DHCP Server works ?


DHCP Client broadcasts DHCP Client broadcasts a DHCPREQUEST packet a DHCPREQUEST packet

DHCP DHCP Server1 Server1 192.168.0.253 192.168.0.253


5e7c-3a2c-1d9a 5e7c-3a2c-1d9a

DHCP Server broadcast DHCP Server broadcast a DHCPOFFER packet a DHCPOFFER packet
IP address Pool 192.168.0.101 192.168.0.102

DHCP DHCP Server1 Server1 192.168.0.253 192.168.0.253


5e7c-3a2c-1d9a 5e7c-3a2c-1d9a

DHCP DHCP Server2 Server2

DHCP DHCP Server2 Server2 192.168.0.254 192.168.0.254


5e7c-3a2c-1d9d 5e7c-3a2c-1d9d

192.168.0.254 192.168.0.103 192.168.0.254


er 5e7c-3a2c-1d9d 5e7c-3a2c-1d9d DHCPP Offffer 9d O DHC -3a2c-1d 9d 192.168.0.254 7c -3a2c-1d rom 5e FFrom: :5e 7c c-1d9b a2 c-1d9b o 5e7c-3 TTo: :5e7c-3 a2 8.0.101 2.16 0.101 er IP 19 OfffferIP : :19 2.168. Windows O Windows

Linux Linux Client Client

Client Client 192.168.0.2 192.168.0.2

Linux Linux Client Client

t esst 9b equue - -d 9b RReqa2cc11d9a P a 2 HC P 7c-3 a c- -d 9 f DDHC5ee7c-3a22c11d oof e : : 5 c-33a easse r r m e7 - r a . . FFoom: 55e7tcfoorLLe8.0011 o 6 TTo :uesst f 2.1168. eq e 9 . RReqIu : :1192 PP I

Windows Windows Client Client 192.168.0.2 192.168.0.2

5e7c-3a2c-1d9b 5e7c-3a2c-1d9b

5e7c-3a2c-1d9c 5e7c-3a2c-1d9c

5e7c-3a2c-1d9b 5e7c-3a2c-1d9b

5e7c-3a2c-1d9c 5e7c-3a2c-1d9c

How DHCP Server works ?


DHCP Server broadcasts DHCP Server broadcasts IP address Pool a DHCPACK packet a DHCPACK packet DHCP DHCP Server1 Server1 192.168.0.253 192.168.0.253
192.168.0.1 192.168.0.1 6 Hrs 192.168.0.2 192.168.0.3

How DHCP Lease Renewal works ?


DHCP Client sends DHCP Client sends a DHCPREQUEST packet a DHCPREQUEST packet DHCP DHCP Server1 Server1 192.168.0.253 192.168.0.253 DHCP DHCP Server2 Server2 192.168.0.254 192.168.0.254
5e7c-3a2c-1d9d 5e7c-3a2c-1d9d 5e7c-3a2c-1d9a 5e7c-3a2c-1d9a

5e7c-3a2c-1d9a 192.168.0.100 5e7c-3a2c-1d9a


T ro m D RRep Too m : HHCP e p l y : : 5e C P ly w : 5 5e 5e 7c OO wi ith e7 7c 7c -3 ffffe a IPIP :th 6 6 Hc-3-3a -3a2 2cer r : 1 19 Ho ou a2 2c- c- -1 2.1 u rs c-1 1d 1dd9 92 .16 68 rs L d9 9b 9a a e 8.0.0. Lea as b .1 1 se e f fo or r

DHCP DHCP Server2 Server2 192.168.0.254 192.168.0.254


5e7c-3a2c-1d9d 5e7c-3a2c-1d9d

FFro

Linux Linux Client Client 192.168.0.1 192.168.0.1


5e7c-3a2c-1d9b 5e7c-3a2c-1d9b

Windows Windows Client Client 192.168.0.2 192.168.0.2


5e7c-3a2c-1d9c 5e7c-3a2c-1d9c

Linux Linux Client Client 192.168.0.1 192.168.0.1


5e7c-3a2c-1d9b 5e7c-3a2c-1d9b

Request to Extend Lease of Request to Extend Lease of IP : :192.168.0.1 IP 192.168.0.1

DHCP Request DHCP Request From : :5e7c-3a2c-1d9b From 5e7c-3a2c-1d9b To : :5e7c-3a2c-1d9a To 5e7c-3a2c-1d9a

Windows Windows Client Client


50%

192.168.0.2 192.168.0.2
5e7c-3a2c-1d9c 5e7c-3a2c-1d9c

How DHCP Lease Renewal works ?


DHCP Server sends DHCP Server sends IP address Pool a DHCPACK packet a DHCPACK packet DHCP DHCP Server1 Server1 192.168.0.253 192.168.0.253
3 192.168.0.1 9 Hrs 192.168.0.2 192.168.0.3

Why DHCP Reservation?

Assigning IP address dynamically has some problems that every time a client system boots it is not sure that it will get the same IP so it will
DHCP DHCP Server2 Server2

5e7c-3a2c-1d9a 192.168.0.100 5e7c-3a2c-1d9a DHCP Offer DHCP Offer From : :5e7c-3a2c-1d9a From 5e7c-3a2c-1d9a To : :5e7c-3a2c-1d9b To 5e7c-3a2c-1d9b

be uneasy task for other systems to find the particular system. To solve the above problem we can do mac-address binding of the IPs. Just give its entry in the fixed-

192.168.0.254 192.168.0.254
5e7c-3a2c-1d9d 5e7c-3a2c-1d9d

Extend Lease by 66Hours for Extend Lease by Hours for IP : :192.168.0.1 IP 192.168.0.1

Linux Linux Client Client 192.168.0.1 192.168.0.1


5e7c-3a2c-1d9b 5e7c-3a2c-1d9b 150% 50%

Windows Windows Client Client 192.168.0.2 192.168.0.2


5e7c-3a2c-1d9c 5e7c-3a2c-1d9c

address portion.

Requirements

DHCP Server Configuration

Packages dhcp* Port Numbers 67 68 Bootp DHCP


DHCP DHCP Server Server 192.168.0.253 192.168.0.253
5e7c-3a2c-1d9a 5e7c-3a2c-1d9a

Web Web Server Server 192.168.0.254 192.168.0.254


5e7c-3a2c-1d9d 5e7c-3a2c-1d9d

Configuration File /etc/dhcpd.conf Service dhcpd Daemon dhcpd


Linux Linux Client Client
5e7c-3a2c-1d9b 5e7c-3a2c-1d9b

Windows Windows Client Client


5e7c-3a2c-1d9c 5e7c-3a2c-1d9c

Configuring DHCP Server

/etc/dhcpd.conf

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/dhcp* [root@comp1]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/dhcp*

To change the range and other options To change the range and other options default-lease-time 21600; default-lease-time 21600; subnet 192.168.0.0 netmask 255.255.255.0 { subnet 192.168.0.0 netmask 255.255.255.0 { option routers 192.168.0.254; option routers 192.168.0.254; option subnet-mask 255.255.255.0; option subnet-mask 255.255.255.0; option domain-name zoom.com"; option domain-name zoom.com"; option domain-name-servers 192.168.0.253; option domain-name-servers 192.168.0.253;

Sample configuration file location Sample configuration file location /usr/share/doc/dhcp3.0.1/dhcpd.conf.sample /usr/share/doc/dhcp3.0.1/dhcpd.conf.sample Copying Sample file for Configuration Copying Sample file for Configuration [root@comp1 ~]# cp /usr/share/doc/dhcp3.0.1/dhcpd.conf.sample [root@comp1 ~]# cp /usr/share/doc/dhcp3.0.1/dhcpd.conf.sample /etc/dhcpd.conf /etc/dhcpd.conf

range 192.168.0.1 192.168.0.100; } range 192.168.0.1 192.168.0.100; } To bind mac-address to IP address To bind mac-address to IP address host server2 { host server2 { option host-name server2.zoom.com"; option host-name server2.zoom.com"; hardware ethernet 5E:7C:3A:2C:1D:9D; hardware ethernet 5E:7C:3A:2C:1D:9D; fixed-address 192.168.0.254; } fixed-address 192.168.0.254; }

DHCP Server

DHCP Client Linux

To restart the DHCP services To restart the DHCP services [root@comp1 ~]# service dhcpd restart [root@comp1 ~]# service dhcpd restart

Install the package by using one of the installation methods Install the package by using one of the installation methods

[root@comp1]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/dhclient* [root@comp1]# rpm -ivh --force --aid ftp://192.168.0.250/pub/Server/dhclient*

To get IP address from DHCP server To get IP address from DHCP server [root@comp1~]# dhclient [root@comp1~]# dhclient or or [root@comp1 ~]# netconfig [root@comp1 ~]# netconfig Check the box use dynamic IP configuration Check the box use dynamic IP configuration

DHCP Client Windows

Configuring DHCP Client Configuring DHCP Client Select My Network Places. Select My Network Places. Right click Properties. Right click Properties. Select Local Area Connection Select Local Area Connection Right click Properties. Right click Properties. Double Click Internet Protocol (TCP/IP) Double Click Internet Protocol (TCP/IP) Select Option Obtain an IP Address automatically Select Option Obtain an IP Address automatically

NIS SERVER

The two common authentication services are the Network Information Service (NIS) and the Lightweight directory Access Protocol (LDAP). Both NIS and LDAP allows to manage all users & computer centrally

How Local Authentication works ?

Solution for Local Authentication

Linux Linux Client Client user1 user1

Linux Linux Client Client user2 user2

Linux Linux Client Client user1 user1 user2 user2

Linux Linux Client Client user2 user2 user1 user1

How NIS works ?

Requirements Packages ypserv-2.13.5.i386.rpm ypbind-1.17.2-3.i386.rpm yp-tools-2.8-7.i386.rpm Port Numbers NIS uses random port numbers [root@comp1 ~]# rpcinfo -p Configuration File /var/yp/Makefile Service ypserv yppasswdd Daemons ypserv yppasswdd

NIS NIS Server Server 192.168.0.253 192.168.0.253

user1 user1 user2 user2

Linux Linux Client Client

Linux Linux Client Client

NIS Configuration

Configuring NIS Server

NIS + NFS NIS + NFS Server Server 192.168.0.253 192.168.0.253

user1 user1 user2 user2


Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp~]#rpm ivh force aid ftp://192.168.0.250/pub/Server/yp* [root@comp~]#rpm ivh force aid ftp://192.168.0.250/pub/Server/yp*

/home /home

Assigning an NIS domain Assigning an NIS domain [root@comp1~]# nisdomainname zoom.com [root@comp1~]# nisdomainname zoom.com

Linux Linux Client Client

Linux Linux Client Client


Assigning an NIS domain --Permenant Assigning an NIS domain Permenant [root@comp1~]# vi /etc/sysconfig/network [root@comp1~]# vi /etc/sysconfig/network

ZOOM.COM ZOOM.COM

/etc/sysconfig/network

NIS Server

Add below line Add below line NISDOMAIN=zoom.com NISDOMAIN=zoom.com

To restart the NIS services To restart the NIS services [root@comp1 ~]# service portmap restart [root@comp1 ~]# service portmap restart [root@comp1 ~]# service yppasswdd restart [root@comp1 ~]# service yppasswdd restart

Configuring NIS Server

/var/yp/Makefile

Open configuration for editing Open configuration for editing [root@comp1~]# vi /var/yp/Makefile [root@comp1~]# vi /var/yp/Makefile

To change the below option To change the below option NOPUSH=true NOPUSH=true all ::passwd group hosts \ all passwd group hosts \

NIS Server

NIS Server

To restart the NIS services To restart the NIS services [root@comp1 ~]# service ypserv restart [root@comp1 ~]# service ypserv restart

To build database of users & groups To build database of users & groups [root@comp1 ~]# /usr/lib/yp/ypinit -m [root@comp1 ~]# /usr/lib/yp/ypinit -m

To create users To create users [root@comp1 ~]#useradd user1 [root@comp1 ~]#useradd user1 [root@comp1 ~]#useradd user2 [root@comp1 ~]#useradd user2 To update database with new users To update database with new users [root@comp1 ~]# useradd user3 [root@comp1 ~]# useradd user3 [root@comp1 ~]# useradd user4 [root@comp1 ~]# useradd user4 [root@comp1 ~]# cd /var/yp [root@comp1 ~]# cd /var/yp [root@comp1 ~]# make [root@comp1 ~]# make

Requirements Packages portmap-4.0-63.i386.rpm nfs-utils-1.0.6-46.i386.rpm Port Numbers 2049 Nfsd 111 Portmap Configuration File /etc/exports Service portmap nfs Daemons nfsd mountd statd lockd

Configuring NFS Server

/etc/exports

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1~]# rpm ivh force aid ftp://192.168.0.250/pub/Server/yp* [root@comp1~]# rpm ivh force aid ftp://192.168.0.250/pub/Server/yp*

/home /home

To add the below To add the below 192.168.0.0/255.255.255.0(rw,sync) 192.168.0.0/255.255.255.0(rw,sync)

Open configuration for editing Open configuration for editing [root@comp1~]# vi /etc/exports [root@comp1~]# vi /etc/exports

NFS Server

Configuring Client

To restart the NFS services To restart the NFS services [root@comp1 ~]# service nfs restart [root@comp1 ~]# service nfs restart

Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1~]# rpm ivh force aid ftp://192.168.0.250/pub/Server/yp* [root@comp1~]# rpm ivh force aid ftp://192.168.0.250/pub/Server/yp*

Assigning an NIS domain Assigning an NIS domain [root@comp1~]# nisdomainname zoom.com [root@comp1~]# nisdomainname zoom.com

Assigning an NIS domain --Permenant Assigning an NIS domain Permenant [root@comp1~]# vi /etc/sysconfig/network [root@comp1~]# vi /etc/sysconfig/network

/etc/sysconfig/network

Configuring Client

Add below line Add below line NISDOMAIN=zoom.com NISDOMAIN=zoom.com

Connecting to server for authentication Connecting to server for authentication [root@comp1 ~]# authconfig-tui [root@comp1 ~]# authconfig-tui

Mounting home directories of the users Mounting home directories of the users [root@comp1 ~]# mount 192.168.0.253:/home /home [root@comp1 ~]# mount 192.168.0.253:/home /home

Checking for connectivity Checking for connectivity [root@comp1 ~]# ypwhich [root@comp1 ~]# ypwhich

How Local Authentication works ?

NIS NIS Server Server 192.168.0.253 192.168.0.253


user1

Linux Linux Client Client

Linux Linux Client Client

User1

How Local Authentication works ?

NIS NIS Server Server 192.168.0.253 192.168.0.253

****
user1 found user1 found Authentication Authentication Successful Successful Access --Granted Access Granted

Linux Linux LOCAL Client Client USER DATABASE


user1 ****

Linux Linux Client Client

User1

How Local Authentication works ?

NIS NIS Server Server 192.168.0.253 192.168.0.253

Linux Linux Client Client

Linux Linux Client Client

User2

user2

****

How Local Authentication works ?

NIS NIS Server Server 192.168.0.253 192.168.0.253

Linux Linux LOCAL Client Client USER DATABASE


user1 ****

user2 not found user2 not found Authentication Authentication Fail Fail Access --Denied Access Denied

Linux Linux Client Client

User2

How Local Authentication works ?

NIS NIS Server Server 192.168.0.253 192.168.0.253 user2

Linux Linux Client Client

Linux Linux Client Client

User2

How Local Authentication works ?

NIS NIS Server Server 192.168.0.253 192.168.0.253

Linux Linux Client Client

user2 found user2 found Authentication Authentication Successful Successful Access --Granted Access Granted

Linux Linux LOCAL USER DATABASE Client Client


user2 ****

User2

How Local Authentication works ?

NIS NIS Server Server 192.168.0.253 192.168.0.253

Linux Linux Client Client

Linux Linux Client Client

User1

user1

****

How Local Authentication works ?

NIS NIS Server Server 192.168.0.253 192.168.0.253

Linux Linux Client Client

user1 not found user1 not found Authentication Authentication Failed Failed Access --Denied Access Denied

Linux Linux LOCAL USER DATABASE Client Client


user2 ****

User1

How NIS Authentication works ?

NIS NIS Server Server 192.168.0.253 192.168.0.253


user1

Linux Linux Client Client

Linux Linux Client Client

User1

How NIS Authentication works ?

user1 found user1 found Authentication Authentication Successful Successful Access --Granted Access Granted

NIS NIS USER DATABASE NIS Server user1 **** Server


user2 192.168.0.253 192.168.0.253 ****

****

S f NI n o to atio st ic ue nt 1 eq the ser S R u u NI g rA om atin fo fr ly tic ep hen ser1 R ut u A

Linux Linux Client Client

Linux Linux Client Client

User1

How NIS Authentication works ?

NIS NIS Server Server 192.168.0.253 192.168.0.253

Linux Linux Client Client

Linux Linux Client Client

User2

user2

****

How NIS Authentication works ?

user2 found user2 found Authentication Authentication Successful Successful Access --Granted Access Granted

NIS NIS USER DATABASE NIS Server user1 **** Server


user2 192.168.0.253 192.168.0.253 ****

S f NI n o to io t icat es t qu en r2 S Re uth use NI m ing rA fo fro icat y pl nt r2 Re uthe use A

Linux Linux Client Client

Linux Linux Client Client

User2

How NIS Authentication works ?

NIS NIS Server Server 192.168.0.253 192.168.0.253


user1

Linux Linux Client Client

Linux Linux Client Client

User1

How NIS Authentication works ?

user1 found user1 found Authentication Authentication Successful Successful Access --Granted Access Granted

NIS NIS USER DATABASE NIS Server user1 **** Server


user2 192.168.0.253 192.168.0.253 ****

****

fo Re r A qu ut e s he t t us ntic o N Re er at IS Au ply 1 ion th fr of e n om us tica N IS er tin 1 g

Linux Linux Client Client

Linux Linux Client Client

User1

How NIS Authentication works ?

NIS NIS Server Server 192.168.0.253 192.168.0.253

Linux Linux Client Client

Linux Linux Client Client

User2

user2

****

How NIS Authentication works ?

user2 found user2 found Authentication Authentication Successful Successful Access --Granted Access Granted

NIS NIS USER DATABASE NIS Server user1 **** Server


user2 192.168.0.253 192.168.0.253 ****

fo Re r A qu ut e s he t t us ntic o N Re er at IS Au ply 1 ion th fr of e n om us tica N er tin IS 1 g

Linux Linux Client Client

Linux Linux Client Client

User2

Configuring Routing

Configuring Routing --Temporary Configuring Routing Temporary [root@comp1 ~]# echo 1 > /proc/sys/net/ipv4/ip_forward [root@comp1 ~]# echo 1 > /proc/sys/net/ipv4/ip_forward

Configuring Routing --Permanent Configuring Routing Permanent [root@comp1 ~]# vi /etc/sysctl.conf [root@comp1 ~]# vi /etc/sysctl.conf

Load in sysctl setting at runtime Load in sysctl setting at runtime [root@comp1 ~]# sysctl p [root@comp1 ~]# sysctl p

Network Monitoring Tools

Network Monitoring Tools

To view network connections with port nos To view network connections with port nos [root@comp1~]# netstat ant () [root@comp1~]# netstat ant ()

Displays dynamic realtime view of running system Displays dynamic realtime view of running system [root@comp1~]# top [root@comp1~]# top

To view remote network connections port nos To view remote network connections port nos [root@comp1~]# nmap <ip address> [root@comp1~]# nmap <ip address>

To view current processes To view current processes [root@comp1~]# ps ef [root@comp1~]# ps ef

To view how long system is been running To view how long system is been running [root@comp1~]# uptime [root@comp1~]# uptime

To view the time of last reboot To view the time of last reboot [root@comp1~]# last reboot [root@comp1~]# last reboot

Network Monitoring Tools

Network Monitoring Tools

To view and setup different network configurations To view and setup different network configurations [root@comp1~]# neat [root@comp1~]# neat

To view To view [root@comp1~]# rpcinfo p [root@comp1~]# rpcinfo p

To view To view [root@comp1~]# traceroute [root@comp1~]# traceroute

To view To view [root@comp1~]# iptraf [root@comp1~]# iptraf

Network Monitoring Tools

To view To view [root@comp1~]# tcpdump eth0 [root@comp1~]# tcpdump eth0

To view To view [root@comp1~]# ethtool [root@comp1~]# ethtool

To view To view [root@comp1~]# gnome-system-moniter [root@comp1~]# gnome-system-moniter

Partitioning

Pre-Installation tool Disk Druid Post-Installation tools fdisk parted cfdisk sfdisk

Naming Conventions

Commands

Controller

Master / Slave Primary Master

Linux /dev/hda /dev/hdb /dev/hdc /dev/hdd

Solaris c0d0 c0d1 c1d0 c1d1

To view list of partitions To view list of partitions [root@comp1 ~]#fdisk -l <device name> [root@comp1 ~]#fdisk -l <device name>

IDE-0 Primary Slave Secondary Master IDE-1 Secondary Slave

Creation of Partition

Creation of Partition
Creating a new partition Creating a new partition [root@comp1 ~]#fdisk /dev/hda [root@comp1 ~]# The number of cylinders for this disk is set to 4865. The number of cylinders for this disk is set to 4865. There is nothing wrong with that, but this is larger than 1024, There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): m Command (m for help): Command action Command action a toggle a bootable flag a toggle a bootable flag b edit bsd disklabel b edit bsd disklabel cc toggle the dos compatibility flag toggle the dos compatibility flag d delete a partition d delete a partition ll list known partition types list known partition types m print this menu m print this menu n add a new partition n add a new partition o create a new empty DOS partition table o create a new empty DOS partition table p print the partition table p print the partition table q quit without saving changes q quit without saving changes ss create a new empty Sun disklabel create a new empty Sun disklabel tt change a partition's system id change a partition's system id u change display/entry units u change display/entry units vv verify the partition table verify the partition table w write table to disk and exit w write table to disk and exit x extra functionality (experts only) x extra functionality (experts only) Command (m for help): Command (m for help):

Creating a new partition Creating a new partition [root@comp1 ~]#fdisk <device name> [root@comp1 ~]#fdisk <device name>

Commands

Ext2 vs Ext3

Updates the partition table to kernel without restarting Updates the partition table to kernel without restarting [root@comp1 ~]#partprobe [root@comp1 ~]#partprobe

Ext2 No journaling support Less speed Less secure

Ext3 Journaling supported More speed More secure

Formatting of partition

Mounting Filesystem

To format partition using ext3 filesystem To format partition using ext3 filesystem [root@comp1 ~]#mkfs.ext3 <partition> [root@comp1 ~]#mkfs.ext3 <partition>

Created a directory for mounting the partition Created a directory for mounting the partition [root@comp1 ~]#mkdir <directory name> [root@comp1 ~]#mkdir <directory name>

To format partition using ext2 filesystem To format partition using ext2 filesystem [root@comp1 ~]#mkfs.ext2 <partition> [root@comp1 ~]#mkfs.ext2 <partition>

To mount the filesystem on the created directory To mount the filesystem on the created directory [root@comp1 ~]#mount <partition> <directory name> [root@comp1 ~]#mount <partition> <directory name>

To format partition using vfat filesystem To format partition using vfat filesystem [root@comp1 ~]#mkfs.vfat <partition> [root@comp1 ~]#mkfs.vfat <partition>

To unmount the filesystem To unmount the filesystem [root@comp1 ~]#umount <directory name> [root@comp1 ~]#umount <directory name>

Mounting Filesystem - Permanently

/etc/fstab

To mount filesystem permanently To mount filesystem permanently [root@comp1 ~]#vi /etc/fstab [root@comp1 ~]#vi /etc/fstab

To add the entry To add the entry # This file is edited by fstab-sync --see 'man fstab-sync' for details # This file is edited by fstab-sync see 'man fstab-sync' for details LABEL=/1 / ext3 defaults 00 LABEL=/1 / ext3 defaults 00 /dev/hda1 /dev/hda1 None None None None LABEL=/home1 LABEL=/home1 none none none none /boot /boot /dev/pts /dev/pts /dev/shm /dev/shm /home /home /proc /proc /sys /sys ext3 ext3 defaults defaults 12 12

devpts gid=5,mode=620 0 0 devpts gid=5,mode=620 0 0 tmpfs tmpfs ext3 ext3 proc proc sysfs sysfs defaults defaults defaults defaults defaults defaults defaults defaults 00 00 00 00 00 00 00 00

/dev/hda2 /usr ext3 /dev/hda2 /usr ext3 LABEL=/var1 /var ext3 LABEL=/var1 /var ext3 LABEL=SWAP-hda7 swap swap LABEL=SWAP-hda7 swap swap /dev/hdd /media/cdrom auto /dev/hdd /media/cdrom auto /dev/hda10 /mnt ext3 /dev/hda10 /mnt ext3

defaults 00 defaults 00 defaults 12 defaults 12 defaults 00 defaults 00 pamconsole,exec,noauto,managed 0 0 pamconsole,exec,noauto,managed 0 0 defaults 00 defaults 00

Converting from Ext2 to Ext3

Converting from Ext3 to Ext2

Unmount the partition Unmount the partition [root@comp1 ~]#umount <partition> [root@comp1 ~]#umount <partition>

Unmount the partition Unmount the partition [root@comp1 ~]#umount <partition> [root@comp1 ~]#umount <partition>

Converting from Ext2 to Ext3 filesystem Converting from Ext2 to Ext3 filesystem [root@comp1 ~]#tune2fs j <partition> [root@comp1 ~]#tune2fs j <partition>

Converting from Ext3 to Ext2 filesystem Converting from Ext3 to Ext2 filesystem [root@comp1 ~]#tune2fs O ^has_ journal <partition> [root@comp1 ~]#tune2fs O ^has_ journal <partition>

Mount the partition to use it Mount the partition to use it [root@comp1 ~]#mount <partition> <directory name> [root@comp1 ~]#mount <partition> <directory name> [root@comp1 ~]#mount [root@comp1 ~]#mount

Mount the partition to use it Mount the partition to use it [root@comp1 ~]#mount <partition> <directory name> [root@comp1 ~]#mount <partition> <directory name> [root@comp1 ~]#mount [root@comp1 ~]#mount

Label

How swap works ?

To assign label To assign label [root@comp1 ~]#e2label <partition> <label_name> [root@comp1 ~]#e2label <partition> <label_name>

New New Process Process

Process D

RAM

To view existing label To view existing label [root@comp1 ~]#e2label <partition> [root@comp1 ~]#e2label <partition>
Idle Idle

Process C Process B Process A Operating System

HDD Swap Partition hda3 hda2 hda1

To see mounted partition with Label To see mounted partition with Label [root@comp1 ~]#mount -l [root@comp1 ~]#mount -l

RAM RAM FULL FULL

Creation of Swap partition

Swap Partition

Creating a new partition Creating a new partition [root@comp1 ~]#fdisk <options> <partition> [root@comp1 ~]#fdisk <options> <partition>

To enable swap on the swap partition To enable swap on the swap partition [root@comp1 ~]#swapon <partition> [root@comp1 ~]#swapon <partition>

To make a partition swap partition To make a partition swap partition [root@comp1 ~]#mkswap <partition> [root@comp1 ~]#mkswap <partition>

To check the status of swap used To check the status of swap used [root@comp1 ~]#swapon -s <partition> [root@comp1 ~]#swapon -s <partition>

To disable the swap partition To disable the swap partition [root@comp1 ~]#swapoff <partition> [root@comp1 ~]#swapoff <partition>

Mounting Removable Devices

Mounting Removable Devices

To mount Floppy Drive To mount Floppy Drive [root@comp1 ~]#mount /dev/fd0 /mnt [root@comp1 ~]#mount /dev/fd0 /mnt

To mount Tape Drive (SCSI) To mount Tape Drive (SCSI) [root@comp1 ~]#mount /dev/st0 /mnt [root@comp1 ~]#mount /dev/st0 /mnt

To mount Cdrom To mount Cdrom [root@comp1 ~]#mount /dev/cdrom /mnt [root@comp1 ~]#mount /dev/cdrom /mnt

To mount Tape Drive (IDE) To mount Tape Drive (IDE) [root@comp1 ~]#mount /dev/ht0 /mnt [root@comp1 ~]#mount /dev/ht0 /mnt

To mount Pen Drive To mount Pen Drive [root@comp1 ~]#mount /dev/sda1 /mnt [root@comp1 ~]#mount /dev/sda1 /mnt

Disk Management

To view total free space of a disk To view total free space of a disk [root@comp1 ~]#hwbrowser & [root@comp1 ~]#hwbrowser &

To view free space of partition To view free space of partition [root@comp1 ~]#df -h [root@comp1 ~]#df -h

To view used space of a partition To view used space of a partition [root@comp1 ~]#du -sh [root@comp1 ~]#du -sh

To know blocksize of a partition To know blocksize of a partition [root@comp1 ~]#blockdev --getbsz <partition> [root@comp1 ~]#blockdev --getbsz <partition>

You might also like