Linux 25 Days
Linux 25 Days
Linux 25 Days
DEFINITION Operating System is a collection of programs that coordinates the operation of computer hardware & software.
Linux Architecture
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.
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
SYS III - SYS V SunOS - Solaris AIX IRIX SCO Unix Free BSD Linux HPUX
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
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
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
/ /
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.
/home
/boot
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
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)
/dev
/etc
This
Directory
contains
devices
nodes
through
which the operating system can access hardware and software devices on the system.
/proc
/tmp
This
Directory
is
mount currently
point
for
virtual system
information processes.
about
running
/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
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 ../..
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>
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
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
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
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
/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
Shell Shell
GID GID
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
/etc/group
User Creation
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
-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>
Group Deletion
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
Type Type
Links Links
Group Group
Owner Owner
Access Permission
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 execute a file.
To execute to a directory.
Permissions Permissions
= = = = = = = =
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
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
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
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
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
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
Comp2 192.168.0.2
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 ~]#
Comp2 192.168.0.2
Comp3 192.168.0.3
Comp4 192.168.0.4
Example
[user@localhost ~]$ ping 192.168.0.2
Example
Comp2 192.168.0.2
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 ~]$
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
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
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
Comp2 192.168.0.2
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 ~]$
Comp2 192.168.0.2
Comp3 192.168.0.3
Comp4 192.168.0.4
Example
SGID
SGID
is
used
for
group
inheritance,
when
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
To view list of partitions To view list of partitions [root@comp1 ~]#fdisk -l <device name> [root@comp1 ~]#fdisk -l <device name>
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
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>
/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
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
To assign label To assign label [root@comp1 ~]#e2label <partition> <label_name> [root@comp1 ~]#e2label <partition> <label_name>
Process D
RAM
To view existing label To view existing label [root@comp1 ~]#e2label <partition> [root@comp1 ~]#e2label <partition>
Idle Idle
To see mounted partition with Label To see mounted partition with Label [root@comp1 ~]#mount -l [root@comp1 ~]#mount -l
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>
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
Quotation
/aclmount
/aclmount
root
usr1
Example
Example
Applying Permission Applying Permission User ::usr1 ::_ _ _ User usr1 _ _ _ Group ::sales ::rw _ Group sales rw _
Hello Hello
How r U
Quotation
Quotation
/aclmount
/aclmount
Sales
root
Example
Example
Hello
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.
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
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
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
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
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
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.
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>
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>
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>
Remote Backup
Automation Jobs
As a system administrator some task are repetitive like backup, monitoring log files, etc To automate them: at batch cron
RAID 0 (striping without parity) RAID 1 (disk mirroring) RAID 4 (parity) RAID 5 (disk striping with parity)
RAID 0
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
root
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
root
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
root
123456 1 3 5 2 4 6
Disk 1
root
RAID 5
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
root
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 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
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.
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.
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 ------
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
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
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
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
/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
/nfs /nfs
/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*
/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.
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
User1
User2
Requirements
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
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*
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
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
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
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
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
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
SMB
CIFS NetBios
A B
/var/zoom /var/zoom
CIFS SMB
Z: Z:
User2
User1
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
Share Share
User2
Z: Z:
Share Share
/etc/samba/smb.conf
[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
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 ::**** ****
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
ZOOM.COM ZOOM.COM Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1
Host File
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
What is DNS?
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
.
.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.
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
.com .com
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
210.10.152.15 210.10.152.15
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
server server
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
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
/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 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
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
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
/var/named/chroot/var/named/zoom.rev
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
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
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
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
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
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
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 ~]#
m m m m
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
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
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
192.168.0.254 192.168.0.254
server2 server2
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
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
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
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.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM
Master Master [45] SOA [42] DNS Server DNS Server Server
Client1 Client2 192.168.0.253 192.168.0.253 Server2
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
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.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM
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
client1 DNS DNS Forward client2 ServerNo Resolution ServerNo Resolution zoom.com zone
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
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
yahoo.com yahoo.com
Forwarder Configuration
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*
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
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
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
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
/var/named/chroot/var/named/zoom.rev
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
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
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
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
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
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; }; }; };
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
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 ?
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
Requirements
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: ******
/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
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
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
192.168.0.2 192.168.0.2
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
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
/var/named/chroot/var/named/zoom.for
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
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
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
Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM
www.google.com www.google.com
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
Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM
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
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
Linux Linux Client Client 192.168.0.1 192.168.0.1 client1 client1 ZOOM.COM ZOOM.COM
www.google.com www.google.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
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
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
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
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
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
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
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
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
Forward zone
192.168.0.253 192.168.0.253
server server
192.168.0.253
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
192.168.0.2 192.168.0.2
client2 client2
Forward zone
192.168.0.253 192.168.0.253
server server
192.168.0.253
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
www.zoom.com www.zoom.com
www.ibm.com www.ibm.com
192.168.0.2 192.168.0.2
http://www.ibm.com
http://www.google.com
Forward zone
192.168.0.253 192.168.0.253
server server
192.168.0.253
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
192.168.0.2 192.168.0.2
client2 client2
Forward zone
192.168.0.253 192.168.0.253
server server
192.168.0.253
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
www.zoom.com www.zoom.com
192.168.0.2 192.168.0.2
client2 client2
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
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
/var/named/chroot/var/named/zoom.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.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
/var/named/chroot/var/named/ibm.for
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
IN IN IN IN IN IN IN IN
NS NS A A
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
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
/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"; }; };
/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. (
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
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 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
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
/var/named/chroot/var/named/redhat.for
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
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
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
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 can be configured as : A Simple Proxy (ie to share server) A Caching Web Server A Firewall
www.yahoo.com www.yahoo.com
Requirements
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
/etc/squid/squid.conf
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
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 --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.
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
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
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,
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
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
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
/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
/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
1W 1W 1D )) 1D IN IN IN IN IN IN IN IN IN IN NS NS A A
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 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
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
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
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
user1 user1 user2 user2 Windows Windows Client Client client2 client2
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
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
[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
Why DHCP ?
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
5e7c-3a2c-1d9d 5e7c-3a2c-1d9d
5e7c-3a2c-1d9b 5e7c-3a2c-1d9b
5e7c-3a2c-1d9c 5e7c-3a2c-1d9c
5e7c-3a2c-1d9b 5e7c-3a2c-1d9b
5e7c-3a2c-1d9c 5e7c-3a2c-1d9c
DHCP Server broadcast DHCP Server broadcast a DHCPOFFER packet a DHCPOFFER packet
IP address Pool 192.168.0.101 192.168.0.102
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
5e7c-3a2c-1d9b 5e7c-3a2c-1d9b
5e7c-3a2c-1d9c 5e7c-3a2c-1d9c
5e7c-3a2c-1d9b 5e7c-3a2c-1d9b
5e7c-3a2c-1d9c 5e7c-3a2c-1d9c
FFro
DHCP Request DHCP Request From : :5e7c-3a2c-1d9b From 5e7c-3a2c-1d9b To : :5e7c-3a2c-1d9a To 5e7c-3a2c-1d9a
192.168.0.2 192.168.0.2
5e7c-3a2c-1d9c 5e7c-3a2c-1d9c
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
address portion.
Requirements
/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
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
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
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 Configuration
/home /home
Assigning an NIS domain Assigning an NIS domain [root@comp1~]# nisdomainname zoom.com [root@comp1~]# nisdomainname zoom.com
ZOOM.COM ZOOM.COM
/etc/sysconfig/network
NIS Server
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
/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
/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
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
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
User1
****
user1 found user1 found Authentication Authentication Successful Successful Access --Granted Access Granted
User1
User2
user2
****
user2 not found user2 not found Authentication Authentication Fail Fail Access --Denied Access Denied
User2
User2
user2 found user2 found Authentication Authentication Successful Successful Access --Granted Access Granted
User2
User1
user1
****
user1 not found user1 not found Authentication Authentication Failed Failed Access --Denied Access Denied
User1
User1
user1 found user1 found Authentication Authentication Successful Successful Access --Granted Access Granted
****
User1
User2
user2
****
user2 found user2 found Authentication Authentication Successful Successful Access --Granted Access Granted
User2
User1
user1 found user1 found Authentication Authentication Successful Successful Access --Granted Access Granted
****
User1
User2
user2
****
user2 found user2 found Authentication Authentication Successful Successful Access --Granted Access Granted
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
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 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
To view and setup different network configurations To view and setup different network configurations [root@comp1~]# neat [root@comp1~]# neat
Partitioning
Pre-Installation tool Disk Druid Post-Installation tools fdisk parted cfdisk sfdisk
Naming Conventions
Commands
Controller
To view list of partitions To view list of partitions [root@comp1 ~]#fdisk -l <device name> [root@comp1 ~]#fdisk -l <device name>
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
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>
/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
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
To assign label To assign label [root@comp1 ~]#e2label <partition> <label_name> [root@comp1 ~]#e2label <partition> <label_name>
Process D
RAM
To view existing label To view existing label [root@comp1 ~]#e2label <partition> [root@comp1 ~]#e2label <partition>
Idle Idle
To see mounted partition with Label To see mounted partition with Label [root@comp1 ~]#mount -l [root@comp1 ~]#mount -l
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>
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>