booting and shutting down

97
Booting and Shutting Down What is Booting? It is the initial set of operations that a computer system automatically performs when power is switched on.

Upload: rehan-halai

Post on 01-Nov-2014

37 views

Category:

Documents


5 download

DESCRIPTION

Linux

TRANSCRIPT

Page 1: Booting and Shutting Down

Booting and Shutting Down

What is Booting?It is the initial set of operations that a computer system automatically performs when power is switched on.

Page 2: Booting and Shutting Down

Operating System

• Just installing Linux operating system on the hard disk would not be able to do much.

• What makes Linux powerful and useful ? The services known as Daemons. These daemons typically run without user intervention providing everything from printing to file services to Web pages and beyond.Because they are not part of the operating system, they are normally loaded separately from the kernel.Many of these services could be made part of the Kernel, they are mostly separate programs.

Page 3: Booting and Shutting Down

Loading of Kernel

• After the loading of kernel the First function is to start th init process.

• The init process starts all of the daemons at the appropriate time.

• A mechanism is provided to stop the daemons automatically.

Page 4: Booting and Shutting Down

POST

• POST – Power –on Self-test.• The task of POST is to locating and initializing

peripheral devices, then finding, loading and starting up an OS.

Page 5: Booting and Shutting Down

BOOT STRAP

• Boot Strap- means to pull oneself up by one’s bootstrap.

• A computer cannot run without first loading software but some software must execute before any software can be loaded.

• The discovery of IC (ROM) allowed the computers to shipped with a start up program that could not be erased.

Page 6: Booting and Shutting Down

BOOT STRAP PROCESS

• Power on• BIOS gets control• BIOS initializes some hardware• BIOS loads bootloader• Bootloader loads operating system kernel• Kernel probes hardware• Kernel_nds and moounts root_lesystem• Kernel runs init• Init gets userspace up and running

Page 7: Booting and Shutting Down

BIOS(Basic Input Output System)

• This is the early stage of the boot process.• It is the BIOS that provides the necessary

instructions to processor and helps to initialize the computer surroundings.

Page 8: Booting and Shutting Down

The main task or Function of BIOS

• It does the POST on all hardware components attached to the computer during booting.

• Ex- The LED on keyboard flashing during booting. And any failure reported on the screen.

• It provides set of low level subroutines for the hardware to interface and interact with the OS. The subroutines act like device drivers for screen,keyboard,ports etc.

• It controls the settings of hard disk, first boot device, system time and more.

Page 9: Booting and Shutting Down

Kernel Initialization

• Linux implements a two stage boot process.• First Stage- BIOS loads the boot program called as

Initial Program from the hard disk to the RAM.• Second Stage – The boot program loads the OS

kernel vmlinuz into RAM.

Page 10: Booting and Shutting Down

Naming convention of Linux Kernel

• The Kernel name is vmlinuz,”vm” stands for Virtual Memory and “z” denotes Compressed image

• When Kernel loads into memory, it does a memory test.

• A part of the memory is setaside for kernel use only.

• This part of the memory cannot be used by any other processes or programs.

Page 11: Booting and Shutting Down

System processes

• Once the hardware initialization is complete the kernel will create number of spontaneous processes or programs in the user space.

• The various processes are: Init Keventd Kswapd Kupdated bdflushThen init is in the user space and only processes in the user space can be controlled by us, not others.

Page 12: Booting and Shutting Down

Startup Scripts

• The startup scripts are establised in /etc/rc.d/init.d folder of Linux machine.

• The importa nt tasks performed by startup scripts are1. Set the name of the computer2. Set the time zone3. Check the hard disk with fsck4. Mount system disk5. Remove old files from/tmp partition6. Configure network interfaces with correct IP address• Startup deamons and other network services.

Page 13: Booting and Shutting Down

Init and Runlevels

Linux machine can be booted to different runlevels.Runlevel is a software defined configuration of specific Linux system, where the system performance will vary in different runlevels. Linux can have 10 different runlevels, only 7 of them are used.

Page 14: Booting and Shutting Down

• Runlevels Description • 0 Shutdown• 1 or s Single user mode• 2 Multiuser mode without nfs 3 full multiuser mode 4 not used 5 X windows 6 reboot

Page 15: Booting and Shutting Down

• For each runlevel there is a corresponding folder in the /etc folder.

• In linux everything is a file.• The name of the symbolic links starts with the

letters “s” or “K” followed by number and the name of the startup script/service to which it is linked.

• Example : the files in runlevel 2 and 3 are• /etc/rc2.d/K20nfs ->../init.d/nfs• /etc/rc2.d/S55named -> ../init.d/named

Page 16: Booting and Shutting Down

Init and single user mode

• It used by the system admin to perform routine maintenance.

• It is mostly used for checking errors in the file system with command ‘fsck’

• Only the root file system will be mounted in this runlevel and the system administrator is provided with a shell.

Page 17: Booting and Shutting Down

Multiuser Operation

• Though the system has been booted to a specific runlevel, none of the users can login to the system until init spawns getty processes on terminals.

• If the system is booted to runlevel 5 init requires to spawn the graphical login system ‘gdm’.

Page 18: Booting and Shutting Down

Rebooting and Shutting Down

• The commands /sbin/shutdown• /usr/bin/halt or /usr/bin/reboot to halt or

reboot the computer.• Second- stage boot loader – Like

GRUB,BOOTMGR,Syslinux these are are not os themselves , but they are intelligent to load the os properly and transfer execution to it.

Page 19: Booting and Shutting Down

Boot Loader• It is a computer program that loads the main os or runtime environment for

the computer after the completion of self-tests in to RAM.• When computer is powered on there is no os in ROM and RAM.• The computer executes a small program stored in ROM from which the os and

data may be loaded into RAM.• The small program that begins this sequence is known as bootstrap loader or

boot loader.• Second-Stage Boot Loader – Like GRUB,BOOTMGR,Syslinux are not os

themselves, but are intelligent to load the os properly and transfer execution to it.

• Network booting – Computers are able of booting over a computer network a) os is saved on the disk of a server. b) some part of OS is transferred to client using simple protocol like TFTP(Trivial File Transfer Protocol). Once the parts are moved the os takes over the control of booting process.

Page 20: Booting and Shutting Down

GRUB LOADER

• GRUB(Grand Unified Bootloader)• It is a boot loader component of loading a

variety of free and proprietary os.• GRUB works well with Linux,windows etc.

Most mordern linux distributions use GRUB as the defauly boot loader during installation.

• GRUB is dynamically configurable.• GRUB chains Logical block address mode.

Page 21: Booting and Shutting Down

Working of GRUB

After computer boots, the BIOS transfers the control to the first boot device ie hard disk, CD-ROM or any other BIOS-identified device.First sector on hard is called Master Boot Record(MBR).This sector is 512 bytes and contains a small piece of programs (446 bytes) called primary boot loader.

Page 22: Booting and Shutting Down

• The MBR code looks for the active partition on the hard disk and one established it loads its boot sector into memory and passes control to it.

Page 23: Booting and Shutting Down

STAGES IN GRUB

• Stage 1- The image used in this stage is essential and is used for booting up GRUB in the first place.It is usually embedded in the MBR of a disk or in the boot sector of the partition. The file used in this stage is named as stage 1. A stage 1 image can next either load stage 1.5 or load stage 2 directly.

Page 24: Booting and Shutting Down

File System• File system – Also known as information management module.• The main function of Information management module is to control each

and every activity regarding information storage on secondary memory.• File – The information stored on secondary memory is called as file.• The information is stored in the secondary memory in the form of files so

it is called as File System.• File contains its own title called Filename.• File name is the sequence of Characters.• Filename contains its extension i.e. it specifies the file type.• In Unix System, the files have more than one file name extension.

Example- emample.tar.z . The file is first achieved using the tar command and then compressed using compress command.

Page 25: Booting and Shutting Down

Functions of file management system

• 1) Keeps track of each information stored on secondary memory using special data structure file allocation table or directory or link list, tables etc.

• 2)Right or permission of the file i.e. information to be allocated to requested process or not.

• 3)If the decision is ok then it allocates information to process and updates the data structure.

• De-allocation of information from process once the job or process is finished.

Page 26: Booting and Shutting Down

Types of Files

Types of Files

Text

Executable

Source Musical library Batch

fileObject

FileMultim

edia Picture

Page 27: Booting and Shutting Down

• Text files- Stores text i.e. set of characters.• Executable files- Stores machine language program so that

they are directly executable.• Source file- These are text files use to store high level

language programs.• Library files- store library functions.• Batch files – Store commands of OS.• Object files – Store machine language program. Not directly

executable as it is not linked with internal and external object.

• Musical files – Stores musical data.• Multimedia files – stores files related multimedia.• Picture files – Stores pictures.

Page 28: Booting and Shutting Down

File Attributes• Name-It is the logical name of the file and is represented through

symbols.• Identifier- It is unique number that identifies the files in the file system.• Location- The address of the file on a disk• Type- It tells the type of file ie text file or executable file etc.• Size – It mentions the current size of the file• Protection – It specifies whether the file is read write protected to control

access, hidden etc.• Usage count – File is opened by how many users.• Time and date – It contains time and date at the time of creation and

modification.• User information – It stores the information like the file is created by

which user and how it is accessible to other users.

Page 29: Booting and Shutting Down

Operations of files

• File pointers – It denotes the location of file which is currently accessible for read or write operation.

• File open count – It counts the total files opened.• File modes- The various modes through which file

can be opened are Input mode,Output mode and Input Output mode etc.

• Reading,writing and other operations- When file is created the following operations are performed on it like writing a file,reading a file, deleting a file etc.

Page 30: Booting and Shutting Down

Directories and Subdirectories

• What is a Directory?• It is a file of files, and is used to store

information such as name, location, size and type for all the files on the device. Or

• It is a container which contains files or group of files.

• It acts as a index of the book.• It is also known as VTOC i.e. Volume Table of

Content or FAT File Allocation Table.

Page 31: Booting and Shutting Down

• The directories may also contain the Sub-directories for more categorization.

• The UNIX file system is called hierarchical file system or tree structure file system which is upside-down.

• Pathname – It is a sequence of component names separated by slash characters, a component is a sequence of characters that designated a file name that is uniquely in the component.

Page 32: Booting and Shutting Down

Data Structure in Unix File System

• The internal representation of a file system in Unix is given by i-node, which contains description of the disk layout of the file data and other informations

File owner Access Permission Access time etc.i-node- File information is stored in a structure called as i-node.“I” stands for index and the i-node exist in a static form on the disk.Every file has its i-node.i-node is similar to the file attribute.

Page 33: Booting and Shutting Down

The concept of i-nodei-node is the fundamental building block of Linux/Unix file system.The control information in the i-node includes file’s owner,permissions,size,time of last access,creation time, group ID etc.The one information which the i-node doesn’t provide is the file name.

Page 34: Booting and Shutting Down

i-node structure of a file• Each directory gets an i-node• i-node points to data blocks containing

information about the files in the directory.• In the fig the i-nodes are used to provide

direction so that more data blocks can be pointed.

Page 35: Booting and Shutting Down

Linux supported file system

• Linux can read and write to several different file system originating with other os due to its VFS layer i.e Virtual File system.

• VFS layer is that layer between the kernel and the programs in userspace that issue file system commands.

• Note –programs that run inside the Kernel are in Kernelspace. Programs that don’t run inside the Kernel are in userspace.

Page 36: Booting and Shutting Down

Superblocks

• Th size first piece of information read from a disk is its superblock.

• This data structure reveals several key pieces of information like disk geometry,amount of available space, the location of the first i-node.

• Without a superblock on-disk file system is useless.

Page 37: Booting and Shutting Down

Popular Linux file system

• Ext3 and ReiserFS are two popular Linux file systems used by major Linux distributions.

• The ext3 file system is an enhanced extension of the ext2 file system.

• Both these files offer significant improvements in performance and stability.

• Ext3

Page 38: Booting and Shutting Down

Unit IIChapter-5

System Configuration Files

• What is system conf files?• The Kernel which is a program wants to know the

list of users and groups in a system and the different file permissions. The files are read by the functions provided by the system library and used by the kernel. Kernel is a program so the program does not read the files itself rather it takes the help of function.

Page 39: Booting and Shutting Down

• Ex- If a program needs to encrypt a password the user should not open the etc/passwd file rather it should call the system library function getpw().

• This type of function is known as system call.• File system- The kernel provides an interface to

display some of its data structure so that it can be useful for determinig the system parameters like interrupts used, devices initialised, memory statistics etc.

• Conf files- Most of the conf files in Red Hat Linux are in etc/directory .

Page 40: Booting and Shutting Down

• Most of the Red Hat config files fall within a few different functions like system duties such logging and automatically running the programs with corn.

• Classification of Config files-• /etc/host.conf – Describes the network

domain server how to look up hostnames i.e /etc/hosts,then server name.

• /etc/hosts – it contains a list of known hosts in local network.Can be used if IP of the system is not generated.

Page 41: Booting and Shutting Down

• /etc/issue & /etc/issue.net – These files are read to print a “Welcome “ string to the user connecting from a terminal. They also contain few lines like Red Hat realease number,name, and Kernel ID.

• /etc/fstab – fstab contains important information about your files system like what file system type the partitions are, where are they located on the hard drive and what mount point is used to access them.

• /etc/grub.conf- Grub stands for Grand Unified Bootloader.It offers a graphical interface giving a basic choice b/w which installed os kernels you want to run.The/etc/grub.conf file is a symbolic link to the actual file that is located in /boot/grub/grub.conf.

Page 42: Booting and Shutting Down

• Etc/corn- Corn is a daemon that executes commands according to a preset schedule that a user defines. It wakes up every minute and checks all cron filesto see what jobs need to be run at that time.

Page 43: Booting and Shutting Down

Unit-IIChap-5TCP/IP

• TCP/IP layer• The network address layer and Media access

control MAC address• Network Classes – Class A,Class B,Class C,Class

D and E.• NIC – Network Interface Card – it is a

hardware device which a computer uses to send data around the rest of the network.

Page 44: Booting and Shutting Down

To Set up NIC

• Before configuring the NIC we have to ensure that the loopback device with IP address 127.0.0.1 is working.

• With the ifconfig command line we can see the current network interface configuration.

• This command will show a device called lo with the address 127.0.0.1(this will be displayed only when the loopback is configured).

Page 45: Booting and Shutting Down

• If loopback is not configured we can add it through the following command:

• Ifconfig lo 127.0.0.1• The system can also be provided with more

information about the device by route command like:

• Route add –net 127.0.0.0• To configure the NIC we use ifconfig command

and “eth0” for Ethernet device.We also require the router,IP address, the net mask, DNS and broadband address.

Page 46: Booting and Shutting Down

• The command line for configuring the NIC is :• ifconfig eth0 <>netmask<>broadcast <>• A file ifconfig-eth0 is created in /etc/sysconfig/network-

scripts. This file shows the information along with the details by us earlier.

• After configuring the NIC on each computer in the network we have to modify the following files present in /etc directory:

• /etc/nsswitch.conf – it contains all the configuration information for the name resolver.

host: files dns• /etc/hosts – This file contains all the computers on the

network ie local or outside network.• /etc/resolv.conf – This file provides information regarding the

name servers used to resolve hostnaes.

Page 47: Booting and Shutting Down

• The /etc/resolv.conf file contains the following lines:

• NETWORKING=Yes• HOSTNAME= (host and domain name of your

system)

Page 48: Booting and Shutting Down

Subnetting

• Subnetting – The practice of dividing the network into two or more network.

• This define the network connection with the outside world.

• This includes configuring a router, obtaining an IP address and making the connection.

Page 49: Booting and Shutting Down

• /etc/sysconfig/networkHow IP addresses work with the subnetting1) IP numbers are assigned to network

interfaces on hosts.2) Many computers can have a single network

interface and a single IP number.3) We Use ifconfig and route commands to

assign more than one IP address to a single NIC.

Example : ifconfig eth0:1 192.168.1.4Route and –host 192.168.1.4 dev eth0

Page 50: Booting and Shutting Down

• The command provides the IP address to the virtual interfaace eth0:1

• The second command adds a route for the address to the actual device eth0.

• An IP address ia a unique address used to identify a device on an IP network.

• The address is made up of 4 bytes .They are broken into four octets. Each octet is of 8 bits and is converted to decimal format and separated by dots.

Page 51: Booting and Shutting Down

Unit-IIChapter-7

The Network File System

• NFS- It is a Network File System.• Networking services provides sharing of files via

a network file system. (NFS)• In Linux NFS is supported by the Kernel.• NFS was developed by Sun Mircosystems in

1980. • NFS acts as a protocol that allows

communication between different computing environment.

Page 52: Booting and Shutting Down

• It stores the files on a network allows users to treat the remotely accessed files as if they were local.

• NFS allows to access files and directories that are located on another system using standard linux commands.

• In this system the administrator provides a central server.

• The files accessed on a central server is completely transparent to the client which provides file locking and management to prevent the files from getting corrupted by other users.

• NFS is based onClient-Server Relationship.• In NFS the act of making file system available is called

exporting.

Page 53: Booting and Shutting Down

• The NFS client mounts the exported files system locally the same way as local files are mounted. This is known as NFS mount.

Page 54: Booting and Shutting Down

Versions of NFS

• NFS version 2 – NFSv2 is older and is widely supported. It is operated over user datagram protocal.

• NFS version 3- NFSv3 has more features,including 64bit file handling, it handles files larger than 2 gigabytes(GB)

• NFS version 4 – NFSv4 works through firewalls and on the internet.

• Implementation of NFS version 2 and 3 are similar whereas version 4 is slightly different.

Page 55: Booting and Shutting Down

• NFSv2 and NFSv3 are stateless ie the server does not retain any information of the client transaction.

• NFSv4 is stateful as it retains the information of the client transaction.

NFS Advantages1) It provides centralised management.2) NFS allows user to log into any server and have access to

their files tranparently via IP addresses,groups,users etc.3) It saves disk space and prevents dulication of resources.4) Users protect their vital information by storing it into NFS

mounted file system which is regularly backed up.

Page 56: Booting and Shutting Down

Disadvantages of NFS

1) The main disadvantage of NFS is security issue.

2) NFS slows down the performance during heavy network traffic.

3) Its architecture is one of its disadvantage.

Page 57: Booting and Shutting Down

Designing NFS Installation

While desinging the NFS installation the decisions are made regarding:1) Which appropriate file system to export.2) Which users are allowed to mount the exported file

system3) Which naming convention should be used to

maintain network transperancy.4) Along with the configuration files, daemons,

commands and initialization scripts forms a major part in NFS server.

Page 58: Booting and Shutting Down

Configuring an NFS Server1) While configuring the NFS server both server and client should be set

up.2) In linux NFS server can be configured manually by editing its

configuration file through /usr/sbin/exportfs command.3) There are three main configuration files which need to be edited t

configure NFS server: i) /etc/exports- This file controls what directories the NFS server exports

to remote hosts and sepecifies options.ii)/etc/hosts.allow - iii) /etc/hosts.deny -4) In linux system the /etc/exports file is the main NFS configuration file.5) The /etc/exports file controls which file systems are exported to remote hosts and specifies options for each export.

Page 59: Booting and Shutting Down

Daemons and NFS Server Scripts and Commands

• The daemons are part of the NFS pakage.• The daemons may be either in the /sbin directory or the /usr/sbin

directory.• NFS requires six daemons such as i) /sbin/portmapii) /usr/sbin/rpc.mountdiii) Usr/sbin/rpc.nfsdiv) /urs/sbin/rpc.statd,v) /urs/sbin/rpc.lockdvi) /urs/sbin/rpc.rquotad (if necessary)In recent linux distribution these daemons are started in the boot scripts.

Page 60: Booting and Shutting Down

Configuring NFS Client

• Configuring NFS client is simpler as to the server.

• For configuring NFS client system we require i) Portmapperii) NFS file lockinf daemonsiii) Add entries to the client’s/etc/fstab for NFS

export and mounting the export using mount command.

Page 61: Booting and Shutting Down

Unit –IIChapter 8

Introduction to Microsoft Networks and Network Services

• Networking is about communication of computers.

• We can connect the linux system with the Microsoft system by Samba program.

• Samba is a program that gives the linux system the ability of file sharing and printer services between computers through Server Message Block(SMB).

Page 62: Booting and Shutting Down

• SMB is the standard protocol used by the Microsoft Windows network file system.

• Samba is beneficial if we have a network of both Windows and Linux .

Page 63: Booting and Shutting Down

Installation and Configuring Samba Server

• The Fedura distribution of Linux include four Samba packages:

1) Samba2) Samba-client3) Samba-common4) Samba-swat

Page 64: Booting and Shutting Down

• Check Samba InstallationTo check the samba installation on the system type the following command in the terminal window:rmp –q samba• If Samba is not installed on the system, the

command displays an output showing Samba is not installed.

• If Samba is installed , the rmp query returns the version number of the samba program installed on your system:

Page 65: Booting and Shutting Down

• Samba-3.4.7-0.50.fcll.i586• Samba can be downloaded from the samba’s web

site: www.samba,install it by typing the following command in the terminal window:

Yum –y install samba samba-client samba-swat system-config-samba • Before making samba connection with windows

PC it needs to be configured.• The samba configuration file is smb.conf which is

located in the /etc/samba directory.• SWAT is the Samba’s web based configuration tool

that enables to configure smb.conf file graphically.

Page 66: Booting and Shutting Down

Before editing the smb.conf file the following commands needs to be run to configure Samba:1) Using chkconfig command we can configure Samba

and SWAT to start at boot time. The commands to start Samba and Swat are: chkconfigsmb on chkconfig swat on• We can start/stop/restart Samba after boot time

using the following command:Servicesmb start/stop/restart Before using SWAT, the xinetd program which controls the SWAT must be activated .

Page 67: Booting and Shutting Down

• We can start/stop/restart xinetd after boot time using the following commands:

servicexinetd start/stop/restart• Samba does not need to be restarted after making

changes to configuration file.• After running the following commands we need to

configure smb.conf file.• This file contains the runtime configuration information for

the smba programs.• The file consists of different sections , beginning with the

name of section in the square brackets and continues until the next section begins.

• There are three special sections: [global],[home] and [printers]

Page 68: Booting and Shutting Down

Global Section

• It is the first section of the smb.conf file.• Contains general samba cofiguration

parameters that apply to the entire server .Home SectionIn this section the treatment of user logins are defined.It provides fast and simple services to a large number of clients to access their home directories with minimal efforts.

Page 69: Booting and Shutting Down

• It provides options like browseable and writable by which we can restrict the access of home directories to specific guests.

[Printers]It is the section which provides configuration to printers.It allows clients to set print options to the specified directory.Options available under this section:[printers]

Comment=All printersPath=/var/spool/sambaBrowseable=yesPrintable = yes

Page 70: Booting and Shutting Down

Creating Samba Users• User-style samba security means – assingning

a Linux user account to each prerson using the the Linux file system and printers from windows.

• We need to provide a SMB password for each user.

• To add or create a new Samba user , the following command needs to be performed:

useradd –m bob

Page 71: Booting and Shutting Down

• This command will add a user with name “bob”.

• We can add a linux password for the new user as follows:

Passwd bobThe terminal will prompt you to change password for the user bob:Changing password for user bobNew password: ******Retype new password: ******

Page 72: Booting and Shutting Down

• This command can be repeated to add user accounts for all users form Windows workstation to give access to the Linux system.

• The following command can be typed to create Samba password file (smbpasswd) on Fedora Linux system:

Cat/etc/passwd | mksmbpasswd.sh >/etc/samba/smbpasswdThis command creates only the user’s account, not their password. We need to create password for users by using the smbpasswd command as follows:

Page 73: Booting and Shutting Down

Smbpasswd bobNew SMB password: ******Retype new SMB password: ******

Page 74: Booting and Shutting Down

Connecting Windows PC to the Samba Server

• Any system can be connected to any computer that is running the SMB protocol.

• The connection can be made through the command line by two methods:

The smbclient utility provides the following command: Smbclient//computer name/share nameHere the computer name can be replaced with the hostname or IP address of the Samba server which you want to connect and share name with the name of the directory you want to browse.Exit is typed to exit the command.

Page 75: Booting and Shutting Down

• To query the network for Samba server findsmb command is usedThe smbmount utility provides the following command:Smbmount//computer name/directory/mysystem/mount/pointThe success of the mount can be checked by the Ls command on the directory.To test the connection on the Windows PC the following steps are performed:1) On windows computer double clink the network places window.2) A list appears including the icon of the Linux system.3) Double click icon to see all the shares.4) A window appears prompting for username and password to

enter the directories.5) Files can be shared between Linux and Windows computer for

providing login credentials.

Page 76: Booting and Shutting Down

Additional Network Services• One of the common service is the timeserver.• A time server is a deamon that runs on one machine and to which all

other systems synchronize their system clocks.• Its main aim is to keep the system time consistent throught the LAN

to facilitate the time-sensitive operations. • The protocol used for distributing and synchronizing time is Network

Time Protocol(NTP).• NTP is a protocol used to synchronize the Linux system’s clock with

an accurate time source.• NTP daemon is dual purpose as it acts as a server for listening time

synchronization requests and providing the time in response and as a client, it adjust the local system time by communicating with other timeservers.

Page 77: Booting and Shutting Down

Some utility programs of NTP

Ntpq: Standard NTP query programNtpdc: Special NTP query programNtpdate: Set the date and time via NTPSntp: Simple Network Time Protocol (SNTP) clientNtptrace: Trace a chain of NTP servers back to the primary source.Tickadj: Set time-related kernel variablesNtptime: Read and set Kernel time variablesNtp-keygen: Generate public and private keysNtpdsim: Network Time Protocol

Page 78: Booting and Shutting Down

NTP Installation• Linux system is preinstalled with NTP pacakage, if not then the following

task has to be performed:i) Install the NTP software.ii) Locate suitable timeservers to act as a reference clock.iii) Configure your local timeserveriv) Start the NTP daemon on the local timeserver.v) Check whether NTP daemon is responding to requests.Installing NTP is simple process. To check that NTP package is installed in the system the following command is used:$ rpmqueryntpThe following command returns an output showing the version number of NPT installed in the system:Ntp-4.2.4p7-2.fc11.i586

Page 79: Booting and Shutting Down

Reference Clocks

• Timeservers serves accurate time after synchronizing its time with one or more reference clocks or master clocks.

• NTP works on distributed platform ie the servers and clients are spread worldwide, any given client can request a time check from any given server.

• NTP uses hierarchical system of levels of clock sources known as Stratum to reduce the load on any server set of servers.

Page 80: Booting and Shutting Down

• To start Date/Time properties tool in Fedora Select:i) System Administration Date & Time.ii) Date/Time properties windows opens.iii) Click the Network Time Protocol to configure NTP.iv) Select the Enable Network Time Protocol option to

configure NTP.This enables to make changes in the NTP servers options.• We can also open this window through the Terminal window

by typing system-config-date.• If NTP is already running on your system , the date & time tab

is displayed disabled.

Configuring an NTP Client

Page 81: Booting and Shutting Down

Providing a Caching Proxy Server

• Caching Proxy Server is a software that facilitates the storage of frequently requested Internet objects.

• The main aim of Caching Proxy Server is:i) To provide faster web browsing by reducing access time

for frequently requested objects.ii) To minimize the bandwidth consumption by caching

popular data locally.Squid provides the basic caching and proxy functions such as DNS lookups, speed up subsequent DNS queries ad implements negative caching.

Page 82: Booting and Shutting Down

UNIT –IVDomain Name system and Mail Services

• DNS – Domain Name System provides a lookup mechanism that translate domain names into IP addresses.

• The Internet works on the bases of IP addresses.• Whenever the DNS is used the DNS service translates the name

into the corresponding IP address. Ex- the domain name www.demonstration.com might translate to 198.123.124.7.

• Ex- welfare.com , the first part of this domain name is the name of the institution, company or organization. The second part after the dot (.) is called the top-level domain (TLD).

• Examples of TLD are: - com – used for business,edu – used for educational institution, mil- used for military institutes,net- used for network affiliated organizations etc.

Page 83: Booting and Shutting Down

• When a host name is typed , the system uses its resources to resolve names into IP addresses.

• It basically looks in /etc/nsswitch.conf file for the host information.

Page 84: Booting and Shutting Down

Types of Domain Servers

• Top level domain server is referred as root name server as it provides information about the domains.

• Ex- to search www.muhlenberg.edu, it looks to the root name server for .edu for information. Then the root name server directs the search to a lower level domain name server until information is found.

• After finding the domain, information about that domain is provided by its local domain name servers. There are three types of local domain name servers:

• A) Master – It is listed as an authoritative server as it contains all the information about the domain and provides this information when needed.

Page 85: Booting and Shutting Down

B) Slave:- It maintains the backup of the master server. It is used when master server goes down or is not available.C) Caching:- it is used to provide information to other servers and workstations on the local network. Caching server speeds up searches as the domain information is already stored in memory.

Page 86: Booting and Shutting Down

Examining Server Configuration Files

• We need to configure some files before configuring the server to provide domain name information.

• These files depend on the BIND server install in the system.• The most common DNS server used in Linux is BIND (Berkeley

Internet Name Daemon).• BIND can be downloaded form www.isc.org.• To install BIND type the following command in the terminal

window:Yum –y install bind

Page 87: Booting and Shutting Down

• There are five files that are required to set up the DNS server:1) named.conf – this file is located in /etc directory and contains global

properties and sources of configuration file.2) Named.ca – this file is located in /var/named directory and contains the

name and addresses of the root servers.3) Named.local – this file is located in /var/named directory and provides

information for resolving the loopback address for the localhost.4) Zone – this file contains the names and addresses of servers and

workstation in the local domain and provide mapping of these names to IP addresses.

5) Reverse zone – this file provides information to map IP addresses to names.

note – the first three files are required irrespective of the configuration as a master, slave or caching, only the last two files are required for the master domain server.To start the BIND server, /etc/rc.d/init.d/named script is used

Page 88: Booting and Shutting Down

Named.conf

• The following configuration statements are used in the named.conf file

i) Options – it contains the default and the global configurations.

ii) Include – it includes the information from another files.iii) Acl – it specifies the IP addresses used in an access control

list.iv) Logging – it specifies log file locations and contents.v) Server – it specifies remote server properties.vi) Zone – it provides zones information.vii) Key – it specifies security keys used for authentication.

Page 89: Booting and Shutting Down

Configuring a Caching DNS server• Before configuring any server it is good to verify the existence of the three

files –Named.conf, named.ca,named.localWe start with verfying the zone information in /etc/named.conf. There are two zone lines:One indicating ‘.’, referencing to named.ca file and other referencing named.local.Check the configuration of the /var/named/named.local file. This file contains the domain information for the local host. This file is created when BIND is installed and therefore we do not need to make any changes to this file.Check the /etc/resolve.conf file to ensure the IP address of your local host is listed as a name server.Lastly we need to check /etc/host.conf contains the word bind.

Page 90: Booting and Shutting Down

Configuring a Secondary Master DNS server

• To configure this we need to modify the /etc/named.conf file and add two more files to complete the slave configuration.

• In the /etc/named.conf file add two zones, one for the forward lookup of your server and one for the reverse lookup.

• In the below example the master server is called main.tactechnology.com and the slave is called p200.tactechnology.com.

• Add the following for the forward lookup:Zone “tactechnology.com” {Notify no;Typeslave;File “tactech.com”;Masters {192.168.1.1;};};

Page 91: Booting and Shutting Down

Add the following for the reverse lookup:zone “1.168.192.in-addr.arpa” {Notify no;Typeslave;File “tac.rev”;Masters {192.168.1.1;};};After modifying the /etc/named.conf file the configuration of the slave server is complete.

Page 92: Booting and Shutting Down

Configuring a Primary Master Server

• The /etc/named.conf file on the master server needs to be modified.• The following lines are added to /etc/named.conf for forward lookup:Zone “tactechnology.com” {Notify no;Typemaster;File “tactech.com”;};The following lines are added for reverse lookup:Zone “1.168.192.in-addr.arpa” {Notify no;Type master;File “tac.rev”;};

Page 93: Booting and Shutting Down

Always use the same names for the files on the master server as the slave server, as these files are downloaded by the slave in a zone file transfer and stored on the slave in the files .After the following changes, restart the named daemon using the following command:Service named restartThe name server is ready to use after all the above steps.

Page 94: Booting and Shutting Down

Configuring Mail Services• Before configuring mail services let us see how email works between

sender and receiver.• To make the email work properly we need to configure the following

items:• Programs: i) A mail user agent for users to be able to read and write email. ii) A mail transfer agent to deliver email messages across a network. iii) A mail delivery agent to deliver messages to user’s mailbox files. iv) A mail-notification program to notify users about new mail.• The SMTP protocols for packaging email and transferring email messages

between MTA’S.• TCP/IP ports through which programs communicate.

Page 95: Booting and Shutting Down

Tracing the Email Delivery Process

In linux, email creation, transmission and delivery is handled by different programs designed for specifically for that task.The email delivery process involves three components ie a mail user agent, a mail transfer agent and a mail delivery agent. These three components perform discrete tasks and have one advantage that we can replace one program without affecting the functionality of the entire system.

Page 96: Booting and Shutting Down

• Mail User Agent(MUA) – it allows a user to read and compose email messages. It is widely referred to as mail client.It provides users an interface for reading and writing email messages. Two types of MUA’s available i) GUI and ii) CLI both provides same functions.

• Mail Transfer Agent (MTA) – it is a program that is responsible to send the message across the network. MTA’s work without intervention of the user, as most of the users are not aware of MTA.

• Mail Delivery Agent (MDA) – it receives the message form the MTA. It stores it into the new message in the recipient’s mailbox file kown as mail spool. In many cases MDA is actually a Local Delivery Agent (LDA).

NOTE – The default MTA installed in Fedora core is called the Sendmail and popular MDA installed in Fedora core is proc mail.

Page 97: Booting and Shutting Down