thirumalai engineering college kilambi, …thirumalai engineering college kilambi,...

52
THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Open Source Lab (CS2406) NAME : _________________________________ REG. NUMBER : _________________________________ SEMESTER : _________________________________ YEAR : ___________________________________

Upload: hanhi

Post on 13-Apr-2018

224 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

THIRUMALAI ENGINEERING COLLEGE

KILAMBI, KANCHIPURAM-631551

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Open Source Lab

(CS2406)

NAME : _________________________________

REG. NUMBER : _________________________________

SEMESTER : _________________________________

YEAR : ___________________________________

Page 2: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

THIRUMALAI ENGINEERING COLLEGE

KILAMBI, KANCHIPURAM-631551

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

BONAFIDE CERTIFICATE

This is to certify that this is a bonafide work done by

Mr./Miss.______________________________ Reg.No._____________________

For the CS2406 – Open Source Lab as a part of B.E., Computer Science and

Engineering course in Thirumalai Engineering College, Kanchipuram during the

year of 2011-2012. The Record is found to be completed and satisfactory.

Head of the Department Staff In-Charge

Submitted for the Practical Examination held on ________________

Internal Examiner External Examiner

Page 3: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Ex.No : 1

KERNEL COMPILATION AND INSTALLATION

Date :

Aim:

To configuration, compilation and install the latest kernel.

Description

Chmod

Change the access permissions of files and directories

chmod stands for change mode, which changes the file or directory mode bits. To put it simply, use chmod command to change the file or directory permissions.

Make

The purpose of the make utility is to determine automatically which pieces of a large program need to be

recompiled, and issue the commands to recompile them.

Bzimage

Compilation is the conversion the kernel's source code (i.e., the original form in which the kernel is written

by a human) into object code (which is understandable directly by a computer's processor). It is performed

by a specialized program called a compiler.

Vmlinuz

it was a natural progression for the Linux kernel to be called vmlinux. And because the Linux kernel

executable was made into a compressed file and compressed files typically have a z or gz extension on Unix-

like systems, the name of the compressed kernel executable became vmlinuz.

Mkinitrd

initrd images contains device driver which needed to load rest of the operating system later on. Not all

computer requires initrd, but it is safe to create one.

Grub

a boot loader is the first software program that runs when a computer starts. It is responsible for loading and

transferring control to an operating system kernel software (such as Linux or GNU Mach). The kernel, in

turn, initializes the rest of the operating system (e.g. a GNU system).

GNU GRUB is a very powerful boot loader, which can load a wide variety of free operating systems, as well

as proprietary operating systems with chain-loading1. GRUB is designed to address the complexity of

booting a personal computer; both the program and this manual are tightly bound to that computer platform,

although porting to other platforms may be addressed in the future.

Page 4: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Procedure:

Step 1:

The latest version of kernel has to be downloaded from the internet. For example, the latest 2.6.39.1 kernel for now is found at http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.37.1.tar.bz2

Step 2:

The kernel is normally kept as a tar.gz or tar.bz2 file. Unpack these kernel sources as root using the following command

$tar –xjvf linux-2.6.37.1.tar.bz2 –C /usr/src

Step 3:

Before we do anything with the sources, we should make sure the source tree does not contain any old object files or configuration information.

To do this, go into the source directory and run the command:

$make mrproper

$make clean

Kernel Configuration

Step 4:

Before we compile the kernel, we need to configure it. This includes telling it which drivers and features to compile and how to compile them (as modules

or inside the kernel's main file). So copy the existing configuration file (config-2.6.29.4-167.fc11.i686.PAE) from the /boot directory

to /usr/src/linux-2.6.37.1 directory and rename the copied configuration file to .config From the source directory run the following command

$make menuconfig

Make menuconfig which is used to add the external files,here add the new file system by enabling the NTFS by using the command file system -> DOS/FAT/NTS -> enable the NTFS.

In the menuconfig choose load an alternative configuration option, a popup appears just press enter.Next choose save an alternative configuration,a popup appears under the default name section specify .config and press enter.

Now exit from the menuconfig

Kernel Configuration

Step 5:

Once configured, Compiling the kernel is easy. First, make sure we start a fresh (takes a few seconds):

$make clean

Page 5: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Then, prepare the dependencies list (might take a minute):

$make depend

Then, compile the kernel's main part (might take 5-30 minutes):

$make bzImage

Then, compile the kernel modules (might take 5-30 minutes):

$make modules

Kernel Installation

Step 6:

Installing the kernel is split into two parts: 1. First, installing the kernel modules.

$make modules_install

2. Then, installing the kernel itself.

$make install

Step kernel in Front

To copy the boot files we have to use cp arch/x86/boot/bzimage/boot/vmlinux – 2.6.37.1-mykernel

Mkinitrd/boot/initramfs – 2.6.37.1 - mykernel

Finally edit the /boot/grub/grub.config file to change the title of the newly installed kernel.

RESULT:

Thus the kernel is successfully configured, compiled and installed.

Page 6: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Ex.No : 2

VIRTUALIZATION

Date :

Aim:

To learn how to install and run a guest OS in linux.

Virtualization Definition:

Virtualization, in computing, is the creation of a virtual (rather than actual) version of something,

such as a hardware platform, operating system, a storage device or network resources. Operating system

virtualization is the use of software to allow a piece of hardware to run multiple operating system images at

the same time.

QEMU

QEMU is a generic and open source machine emulator and virtualizer.

When used as a machine emulator, QEMU can run OSes and programs made for one machine on a different machine . By using dynamic translation, it achieves very good performance.

When used as a virtualizer, QEMU achieves near native performances by executing the guest code directly on the host CPU. QEMU supports virtualization when executing throw pillows under the Xen hypervisor or using the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86, server and embedded PowerPCs.

Procedure:

1. Go to System Tools-> Terminal. 2. Then download fdbased.iso from www.freedos.org. 3. Make a directory '$ mkdir virtual'. 4. Change the path to the newly created directory by using the '$ cd virtual' command. 5. Then move the file from the Downloads to virtual directory by using the command,

'$ mv /home/fosslab/Downloads/fdbased.iso .'.

6. Then create a virtualdisk with a memory size by using the command,

[fosslab@fosslab ~]$ qemu-img create virtualdisk.img 100M

Formatting 'virtualdisk.img', fmt=raw size=104857600

7. [fosslab@fosslab ~]$ qemu -hda virtualdisk.img -cdrom fdbasecd.iso -boot d

8. Setup the following screen and get the freedos

Page 7: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

step 1: continue to boot FREE Dos from CD-ROM.

Step 2:select install to hard disk using FreeDOS SETUP (default)

Step 3: select option in English

Page 8: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Step 4: select option Run FreeDOS from CD-ROM

Step 5 : Enter the FDISK in Screen.

Page 9: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Step 6: select FAT32 option enter “Y”

Step 7: Select the FDISK options and create primary particitions.

Page 10: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Step 8: previous command executed in one more time

[fosslab@fosslab ~]$ qemu -hda virtualdisk.img -cdrom fdbasecd.iso -boot d

Execute the command display the same window select same option for first three screen.

Display the screen select format option.

Page 11: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Format was completed and install Free DOS

Page 12: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Step 9: select option for Freedos installation

Page 13: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT
Page 14: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Our FreeDOS to be installing

Step 10 : Then enter the command in our terminal “qemu –hda virtualdisk.img –boot c”

Page 15: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

To get the Windows command prompt in Linux.

RESULT:

Thus we have learned how to install and run a guest OS in linux.

Page 16: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Ex.No : 3

PACKET MANAGEMENT SYSTEM

Date :

Aim:

To give a set of RPM or DEB, how to build and maintain, serve packages over http or ftp.

And also how do you configure client systems to access the package repository.

Procedure:

Open the browser and type the URL ” http://fosslabserver/pub/tools/intemet/qmail/ “.

Select qmail-packages.zip and download it. Then extract it in the download directory.

Open terminal from “Applications->System Tools->Terminal”.

Then check the current path using “$ pwd” command. Use “$ cd Downloads/” to change the

directory.

List the files and folders in the directory by using the “$ ls -l” command and move the

qmailpackages

To qmail by “$ mv qmail-packages qmail” command.

Move to the qmail package by “$ cd qmail” , that has 25 rmp packages. List out them using “$ ls

*.rmp |wc” command.

Then change to the previous directory “$ cd..” command and run the “$ createrepo qmail/”

command to create the report as “repodata”.

Change directory to the repodata and list the files in it, which has the reported files and come to

previous directory.

Check whether the apache web server is running, so login to the root directory by using the “$

su ” command and type the password.

To check the status type “ # service httpd status” command, if it is stopped then start it by using

the “# service httpd start” command. Now once again check the status.

Now we want to check that all the apache web server are working properly, so open the

browser type http://localhost/ if Fedora Test Page is displayed then it is working properly.

Now, we have to move qmail packages from /home/fosslab/Downloads/ directory to

/var/www/html/ directory which can be served by apache web server for requesting clients by

using mv command and change the directory to that.

List the files in it. Take the Fedora Test Page and type http://localhost/qmail/ and open the

reportdata folder to check the files.

Now, we have to create the repository configuration file, so open the root directory.

Page 17: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Then type “# cd /etc/yum.repos.d/” and list the files in it.

Then open the file “# vi qmail.repo” and type

“name=Q-Mail packages

baseurl=http://localhost/qmail

enabled=1

gpgcheck=0”

and save & exit .

Now, we have to rebuild the YUM cache by “# yum clean all” and type“# yum clean all” and “#

yum makecache”.

To load use “# yum search qmail” and install by using “# yum install qmailtoaster-plus ” and

“yum install libsrs2-toaster”

Change the directory to /etc/yum.repos.d, then edit fedora.repo file . Type “#yum clean all” and

“ yum makecache”

List by using “#yum grouplist” and “# yum groupinstall “XFCE” ”

Type the command “rmp –ivh http://fosslabserver/f14repo/rpmfusion/i386/free/rpmfusionfree-

release-14.0.4.noarch.rpm” to prepare it and change it to /etc/yum.repos.d

Use “# rpmfusion-free.repo” to alter the base url , then save and exit.

Then update by using the “# vi rpmfusion-free-updates.repo”.Similarly update the rmp-fusion

nonfree file.

Then make cache by using “ yum makecache” and type “# yum search vlc ” and “yum install”

ScreenShots

Page 18: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT
Page 19: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

RESULT:

Thus the client system was configured and maintains to access the package repository.

Page 20: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Ex.No : 4(A)

UNIX PRINTING SYSTEM

Date :

Aim:

To install the printer in the client system and share the printer in the network using cups.

Procudure:

[fosslab@fosslab ~]$ rpm -qa|grep cups

cups-pk-helper-0.0.4-13.fc14.i686

libgnomecups-0.2.3-7.fc12.i686

cups-libs-1.4.4-10.fc14.i686

cups-pdf-2.5.0-4.fc14.i686

cups-lpd-1.4.4-10.fc14.i686

apcupsd-3.14.8-2.fc14.i686

cups-devel-1.4.4-10.fc14.i686

gutenprint-cups-5.2.6-1.fc14.i686

cups-bjnp-0.5.4-4.fc12.i686

cups-1.4.4-10.fc14.i686

cups-php-1.4.4-10.fc14.i686

apcupsd-gui-3.14.8-2.fc14.i686

ghostscript-cups-8.71-16.fc14.i686

bluez-cups-4.71-5.fc14.i686

[fosslab@fosslab ~]$ su

Password:

[root@fosslab fosslab]# service cups status

cupsd (pid 2884) is running...

next enter the “http://local host:631” in our Internet Explorer.

Following the figure to setup the command.

a. Printer to add any network and access the client system.

b. Use the printer.

Page 21: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT
Page 22: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Enter the UserName : root

Password : admin123

Select HP Printer

Page 23: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Enter the address in text box http://localhost:631/ipp/

select the printer option.

Page 24: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

select the jobs.

Page 25: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

RESULT:

Thus using CUPS, printer is shared from the network to print a page.

Page 26: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Ex.No : 4(B)

SAMBA

Date :

Aim:

To install samba and share files to windows.

Description:

SMB:

The SMB (Server Message Block (SMB) protocol provides file space and printer services using the

SMB or CIFS protocol. It can run across the Lan Manager protocol and can also service LanManager clients

In other words, "Windows" Clients.

NMB:

nmbd can also be used as a WINS (Windows Internet Name Server) server. What this basically

means is that it will act as a WINS database server, creating a database from name registration requests that

it receives and replying to queries from clients for these names.

Procedure:

LINUX

[fosslab@fosslab ~]$ rpm -qa|grep samba

samba4-devel-4.0.0-24.alpha11.fc14.i686

samba-swat-3.5.5-68.fc14.1.i686

samba4-pidl-4.0.0-24.alpha11.fc14.i686

samba-common-3.5.5-68.fc14.1.i686

samba-doc-3.5.5-68.fc14.1.i686

samba-winbind-krb5-locator-3.5.5-68.fc14.1.i686

samba4-4.0.0-24.alpha11.fc14.i686

samba-3.5.5-68.fc14.1.i686

samba-client-3.5.5-68.fc14.1.i686

system-config-samba-1.2.90-1.fc14.noarch

Page 27: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

samba-winbind-devel-3.5.5-68.fc14.1.i686

samba-domainjoin-gui-3.5.5-68.fc14.1.i686

samba-winbind-clients-3.5.5-68.fc14.1.i686

samba4-libs-4.0.0-24.alpha11.fc14.i686

system-config-samba-docs-1.0.9-1.fc14.noarch

samba-winbind-3.5.5-68.fc14.1.i686

[fosslab@fosslab ~]$ su

Password:

[root@fosslab fosslab]# service smb status

smbd (pid 3596) is running...

[root@fosslab fosslab]# service smb start

Starting SMB services:

[root@fosslab fosslab]# service nmb status

nmbd (pid 3574) is running...

[root@fosslab fosslab]# service nmb status

nmbd (pid 3574) is running...

[root@fosslab fosslab]# service nmb starts

Usage: /etc/init.d/nmb {start|stop|restart|reload|status|condrestart}

[root@fosslab fosslab]# service nmb status

nmbd (pid 3574) is running...

[root@fosslab fosslab]# iptables -L

Chain INPUT (policy ACCEPT)

target prot opt source destination

Chain FORWARD (policy ACCEPT)

target prot opt source destination

Page 28: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Chain OUTPUT (policy ACCEPT)

target prot opt source destination

[root@fosslab fosslab]# service iptables stop

iptables: Flushing firewall rules: [ OK ]

iptables: Setting chains to policy ACCEPT: filter [ OK ]

iptables: Unloading modules:

[root@fosslab fosslab]# ip6tables -L

Chain INPUT (policy ACCEPT)

target prot opt source destination

Chain FORWARD (policy ACCEPT)

target prot opt source destination

Chain OUTPUT (policy ACCEPT)

target prot opt source destination

[root@fosslab fosslab]# service ip6tables stop

ip6tables: Flushing firewall rules: [ OK ]

ip6tables: Setting chains to policy ACCEPT: filter [ OK ]

ip6tables: Unloading modules: [ OK ]

[root@fosslab fosslab]# setenforce 0

setenforce: SELinux is disabled

[root@fosslab fosslab]# useradd winuser

useradd: user 'winuser' already exists

[root@fosslab fosslab]# smbpasswd -a winuser

New SMB password:

Retype new SMB password:

[root@fosslab fosslab]# service smb status

Page 29: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

smbd (pid 3596) is running...

[root@fosslab fosslab]# service nmb status

nmbd (pid 3574) is running...

It will start the nmb.

WINDOWS

Select Windows operating system.

Then go to windows and in the run command type the linux ip address.

Then create a new folder under win user(linux user)

In that create a new folder named folder created in windows

Then create a new bitmap image and some files under winuser.

LINUX

Select Linux operating system.

Select samba user in Linux operating system.

Then open win user account and select image file (already created in windows).

Access then file in linux environment.

Page 30: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT
Page 31: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

RESULT:

Thus samba is installed and the files are shared with the windows.

Page 32: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Ex.No : 5

FUSE

Date :

Aim:

To write userspace driver using fuse

FUSE Definition

Filesystem in Userspace (FUSE) is a loadable kernel module for Unix-like computer

operating systems that lets non-privileged users create their own file systems without editing kernel

code. This is achieved by running file system code in user space while the FUSE module provides

only a "bridge" to the actual kernel interfaces.

Procedure

Open the terminal.

Check weather fuse development packages has got installed by cmd “rpm –qa | grep fuse “

If installed then check the configuration by cmd ”rpm –qi fuse”.

Thus the fuse development software is checked

Then download fuse tutorial by open “fosslabserver/osslab/samples/fuse/” index and seve the link

called “fuse-tutorial.tgz” in same name.

Check current directory then change dir to “cd Downloads”.

List the files in that directory by “ls -l”.

Check current directory then change dir to “cd fuse-tutorial”.

List the files in that directory by “ls -l”.

Check current directory then change dir to “cd src”.

Then open bbfs.c file to edit by “vi bbfs.c”.

Then open log.c file to edit by “vi log.c”.

Then check file offset by “pkg - config fuse - - c flags”.

Then check pthread by “pkg - config fuse - - libs”.

Then make file.

Check current directory then change dir to “cd ../example”.

List dir of mountdir and rootdir using “ls -al”.

Then execute “touch myfile” and make directory like fusetest and fusefile using “mkdir”.

Then call fuse main by “../src/bbfs rootdir/ mountdir/”.

Type “mounts “and checks rights give to bbfs file.

Using fusermount –u mountdir and fuse all the files in mountdir.

Types “mount “and check rights.

Page 33: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Check directory like mountdir and rootdir then tail bbfs file by “tail –f bbfs.log”.

Thus the fuse example is completed.

RESULT

Thus the userspace driver was developed using fuse.

Page 34: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Ex.No : 6(A)

PHP & MYSQLCONNECTIVITY

Date :

Aim:

To write a program using PHP to connect with MYSQL database

Program Description

1. In this application we are using PHP to write server side script.

2. The Login form is designed using HTML & saved as form.html

3. The server side script for verifying the username and password is written using php and saved

as connect.php

4. This php script accept the post request from the client with username & password

5. File save in var/www/html location

Execution

1. Save file in gedit text editot

2. Open the mozilla firefox browser

3. In the address bar type the URL http://localhost/login/login.html to get the login page.

Program

form.html <html> <head> <title>LOGIN</title></head> <body> <form action="connect.php" method="post"> <p> "Enter course no"<input type="text" name="cid"></p> <p>"enter the coursename"<input type="text" name="cname"></p> <p>"click here to submit"<input type="submit" name="submit"></p> </form> </body> </head> </html>

connect.php <?php $cid=$_POST['cid']; $cname=$_POST['cname']; $con=@mysql_connect("localhost","root","")or die (mysql-error()); echo "connected to database"; $db=@mysql_select_db("student",$con)or die(mysql_error()); echo "selected database"; $str="insert into courses values($cid,'$cname')"; $res=@mysql_query($str) or die(mysql_error()); if($res>0)

Page 35: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

{ echo "Record created"; } ?>

OUTPUT

Page 36: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

now go to terminal

[linuxpert@localhost ~]$ mysql -u root -p\ > > Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 28 Server version: 5.1.45 Source distribution mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | student | | test | +--------------------+ 4 rows in set (0.11 sec) mysql> use student ; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> connect Connection id: 29 Current database: student mysql> show tables; +-------------------+ | Tables_in_student | +-------------------+ | course | | courses | | students | +-------------------+ 3 rows in set (0.00 sec) mysql> select * from courses; +------+-------+ | cid | cname | +------+-------+ | 1 | java | | 1 | java | +------+-------+ 2 rows in set (0.02 sec)

RESULT

Thus the program for connecting to MSQL database using PHP was written and executed

successfully.

Page 37: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Ex.No : 6(B)

SIMPLE LOGIN APPLICATION USING LAMP STACK

Date :

Aim:

To write a simple login web application after setting up a LAMP stack

What is Lamp Stack?

LAMP is an acronym for a solution stack of free, open source software, originally coined from the first

letters of Linux (operating system), Apache HTTP Server, MySQL (database software) and

Perl/PHP/Python, principal components to build a viable general purpose web application.

Program Description

1. In this application we are using PHP to write server side script.

2. The Login form is designed using HTML & saved as login.html

3. The server side script for verifying the username and password is written using php and saved

as submit.php

4. This php script accept the post request from the client with username & password

5. The client side authentication information is compared with server side database Username

and password.

Deployment Procedure

1. Create a directory called login.

2. Place both files login.html & submit.php inside the login directory.

3. Now move the login directory to /var/www/html directory.

4. Start the apache webserver using the command $service httpd start

Execution

4. Open the mozilla firefox browser

5. In the address bar type the URL http://localhost/login/login.html to get the login page.

Program

Login.html

<html> <head> <title>Simple HTML Form</title> </head> <body> <form action="submit.php" method="post"> User Name: <input type="text" name="uname"/><br> Password: <input type="text" name="pwd"/><br> <input type="submit" name="submit_button" value="Log In" /> </form>

Page 38: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

</body> </html>

Submit.php

<?php $dbhandle = mysql_connect('localhost','',''); if ($dbhandle == false) { die ("Unable to connect to MySQL Database<br>"); } $db = mysql_select_db('test'); if ($db == false) { die ("Unable to Select MySQL Database <br>"); } $uname = $_POST['uname']; $pwd = $_POST['pwd']; $dbquery = "SELECT * FROM users where uname='".$uname."'"; $dbresult = mysql_query ($dbquery, $dbhandle); if ($dbresult && mysql_num_rows($dbresult)) { $obj = mysql_fetch_object($dbresult); if($uname == $obj->uname && $pwd == $obj->pwd) { echo "Welcome, ".$uname."!"; }else { echo "Invalid User Try again"; } } mysql_close($dbhandle); ?>

RESULT: Thus the simple login web application is created successfully by establishing LAMP stack.

Page 39: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Ex.No : 7

PERL

Date :

Aim:

To write a simple program for using perl in linux

Procedure

1. Program type in gedit text editor.

2. Save any location in system.

3. Open terminal type “perl filename.pl”

4. Get the output in terminal windows.

Program

1. Scalar variables in PERL #!/usr/bin/perl my $animal="Camel"; # this variable is lexically scoped ie local my $ans=42_243; #this is similar to 42243 print "$animal\n"; print "$ans\n"; print "The square of &ans",$ans*$ans,"\n"; output: [linuxpert@localhost ~]$ perl scalar.pl Camel 42243

2.If loop in perl #!usr/bin/perl my $a=10; $condition=1; if($condition) { my $y=100; print "$a\n"; print "$y\n"; } print "$a\n"; print "$y\n"; output: [linuxpert@localhost ~]$ perl ifloop.pl 10 100 10

Page 40: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

3. String operation: #!usr/bin/perl $a="hello"; $b="world"; print $a.$b,"\n"; $str="-"; print $str x 80,"/n"; @a=(10..25); print "@a\n"; output [linuxpert@localhost ~]$ perl string.pl helloworld --------------------------------------------------------------------------------/n10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

4. Program to perform Sub-routine to check biggest number

Example 1: sub maximum { if ($_[0] > $_[1]) { print $_[0]; } else { print $_[1]; } } $biggest = &maximum(37, 24); Example 2: sub maximum { if ($_[0] > $_[1]) { $_[0]; } else { $_[1]; } } $biggest = &maximum(37, 24); $biggest2 =&maximum(100,123); print "\nThe biggest amomg 37 and 24 is $biggest"; print "\nthe biggest among 100 and 123 is $biggest2"; Example 3.Program to return the values sub get_list { return 5..10; } @list = &get_list; print "@list";

Page 41: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

5. Print out lines of other files with the use of arrays #!/usr/bin/perl print "content-type: text/html \n\n"; #The header $text = "sample.txt"; open (text) or die "Can't open the file!"; @fileinput = <text>; print $fileinput[0]; print $fileinput[1]; print $fileinput[2]; print $fileinput[3]; print $fileinput[4]; print $fileinput[5]; print $fileinput[6]; print $fileinput[7]; print $fileinput[8]; print $fileinput[9]; close (text);

6. Array in PERL #!usr/bin/perl my @animal=("cow","Buffalo","Camel"); print "@animal\n"; # list all elements in array print "$#animal\n"; # list last element position print "$animal[0]\n"; #list 0th position element $count=@animal; print "$count"; # count no of elements in array output: [linuxpert@localhost ~]$ perl array.pl cow Buffalo Camel 2 cow 3

7. Hash in PERL #!usr/bin/perl %color=('apple'=>"red",'banana'=>"yellow",'orange'=>"orange"); print "$color{'apple'}\n"; output: [linuxpert@localhost ~]$ perl hash.pl red

RESULT

Thus the perl program was successfully executed.

Page 42: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Ex.No : 8

PYTHON

Date :

Aim:

To write a simple program for using python in linux

procedure

1. Program type in gedit text editor.

2. Save any location in system.

3. Open terminal type “python filename.py”

4. Get the output in terminal windows.

Program

1. Set operations in Python

basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana'] fruit = set(basket) # create a set without duplicates

fruit set(['orange', 'pear', 'apple', 'banana']) 'orange' in fruit # fast membership testing True 'crabgrass' in fruit False a = set('abracadabra') b = set('alacazam') a # unique letters in a set(['a', 'r', 'b', 'c', 'd']) a - b # letters in a but not in b set(['r', 'd', 'b']) a | b # letters in either a or b set(['a', 'c', 'r', 'd', 'b', 'm', 'z', 'l']) a & b # letters in both a and b set(['a', 'c']) a ^ b # letters in a or b but not both set(['r', 'd', 'b', 'm', 'z', 'l'])

2. Modules And Error Handling In Python

import sys try: f = open('myfile.txt') s = f.readline() i = int(s.strip()) except IOError as (errno, strerror): print "I/O error({0}): {1}".format(errno, strerror) except ValueError:

Page 43: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

print "Could not convert data to an integer." except: print "Unexpected error:", sys.exc_info()[0] raise

3.Finally class in Python

def divide(x, y): try: result = x / y except ZeroDivisionError: print "division by zero!" else: print "result is", result finally: print "executing finally clause" divide(2, 1) result is 2

executing finally clause divide(2, 0) division by zero! executing finally clause divide("2", "1") executing finally clause Traceback (most recent call last): File "<stdin>", line 1, in ? File "<stdin>", line 3, in divide TypeError: unsupported operand type(s) for /: 'str' and 'str'

4. Prime Number using Python.

for n in range(2, 10): for x in range(2, n): if n % x == 0: print n, 'equals', x, '*', n/x break else: # loop fell through without finding a factor

print n, 'is a prime number' OUTPUT: 2 is a prime number 3 is a prime number 4 equals 2 * 2

5 is a prime number 6 equals 2 * 3

7 is a prime number 8 equals 2 * 4

9 equals 3 * 3

5. Fibonacci Series using Python

def fib(n): # write Fibonacci series up to n

Page 44: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

"""Print a Fibonacci series up to n.""" a, b = 0, 1

while b < n: print b, a, b = b, a+b fib(2000) 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597

6. Write a python program to perform functions in Dictionary.

#Python Dictionary tinydict = {'name': 'john','code':6734, 'dept': 'sales'} print ("Python Dictionary:" ); print ("complete dictionary",tinydict ); print ("Key :",tinydict.keys()); # Prints all the keys print ("values:",tinydict.values()); # Prints all the values

7. Write a python Program to select odd number from the lists

#!/usr/bin/python #program to select odd number from the list a=[11,12,13,14,15,16,17,18,19,20,21,31,44,45,10]; print("List is:",a); n=len(a); print("length:",n); i=0; print("Odd number"); for i in range(len(a)): if(a[i]%2==1): print(a[i]);

8. Write a sample program in python programming

#Sample python program x=5; y=5; print ("x:",x); print("y:",y); z=x+y; print("z:",z);

RESULT

Thus the python program was executed successfully.

Page 45: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Ex.No : 9

VERSION CONTROL SYSTEM SETUP AND USAGE USING RCS, CVS,

SVN

Date :

Aim:

To setup version control system using RCS, CVS, SVN.

Procedure

Open terminal from Applications->System tools->Terminal.

Type the command rpm –qa | grep subversion

Type the command rpm –qa | grep java

Confir that ja a-1.6.0-openjdk-1.6.0-44. . . f 4. 6_64 is i the list.

Download the Collabnet subversion Edge Software from the FOSS server.

Go to downloads and extract the downloaded file and rename the extracted

folder into csvn.

Acquire root level permission.

Run the Command visudo to edit the sudoers.tmp file

I that file, u der the li e root ALL= ALL ALL ,t pe fossla

ALL= ALL ALL

Save the file and return to the terminal.

E e ute the o a d e port JAVA_HOME=/usr/ a d the

$JAVA_ho e/ i /java - ersio

Go to Downloads\csvn.

E e ute the o a d sudo –E i / s i stall

The e e ute the o a d i / s start

After the csvn console is ready, open the url address generated by the csvn

console using any browser.

Login with admin username and password.

Select the administration tab.

Give a port address and admin name.

Go to status page and click start.

Download the file from webattry-1.2-6.fc14.src.rpm from fosslab server.

Go to the download folder.

Install the webattery source RPM package using rpm –ivh webattery-1.2-6.fc

Page 46: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

14.src.rpm

Go to rpmbuild/SOURCES folder.

Ru the o a d tar z f e atter - . .tar.gz

Now go to repositories tab in the subversion Edge web service.

In that go to New Repository.

Type the name as webattery and then click create.

Go to repository list and copy the URL.

Create a dire tor su ersio -test a d ha ge the path to it.

No t pe the o a d s o http://fossla .li u pert.i : /s / e atter

webattery --user a e=ad i a d Gi e pass ord a d user a e.

Output

Page 47: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

RESULT

Thus the version control system (webattery) setup is done.

Page 48: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Ex.No : 10

SETTING UP NETWORK INTERFACE

Date :

Aim

To learn how to setup an network interface using various configuration commands.

Procedure

1. To get the IP address, run the following command

[root@bigboy tmp]# ifconfig -a

output

-----------------------------------------------------------------------------

eth0 Link encap:Ethernet HWaddr 00:24:8C:40:B5:D6

inet addr:192.168.113.115 Bcast:192.168.113.255 Mask:255.255.255.0

inet6 addr: fe80::224:8cff:fe40:b5d6/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:19856 errors:0 dropped:0 overruns:0 frame:0

TX packets:10727 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:11628202 (11.0 MiB) TX bytes:2159479 (2.0 MiB)

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:1533 errors:0 dropped:0 overruns:0 frame:0

TX packets:1533 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:2515158 (2.3 MiB) TX bytes:2515158 (2.3 MiB)

--------------------------------------------------------------------------

2. Changing the IP Address

To change the IP Address of the system, we need the following details

1. IP Address

2. Netmask address

Page 49: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

IP Address = 192.168.113.120

NetMask Address : 255.255.255.0

Type the following command to set the ip address

[root@bigboy tmp]# ifconfig eth0 10.0.0.1 netmask 255.255.255.0 up

output

To check the output

[root@localhost lab-manual]# ifconfig -a

eth0 Link encap:Ethernet HWaddr 00:24:8C:40:B5:D6

inet addr:192.168.113.115 Bcast:192.168.113.255 Mask:255.255.255.0

inet6 addr: fe80::224:8cff:fe40:b5d6/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:19856 errors:0 dropped:0 overruns:0 frame:0

TX packets:10727 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:11628202 (11.0 MiB) TX bytes:2159479 (2.0 MiB)

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:1533 errors:0 dropped:0 overruns:0 frame:0

TX packets:1533 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:2515158 (2.3 MiB) TX bytes:2515158 (2.3 MiB)

-------------------------------------------------------------------------------

3. Activate/Deactivate the Network Interface Card

To Deactivate the Network Interface Card

[root@bigboy tmp]# ifdown eth0

To Activate the Network Interface Card

[root@bigboy tmp]# ifup eth0

4. View current Routing Table

To view the current Kernel IP Routing Table

[root@localhost lab-manual]#route

Page 50: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Output

--------------------------------------------------------------------------------------

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

192.168.113.0 * 255.255.255.0 U 2 0 0 eth0

192.168.122.0 * 255.255.255.0 U 1000 0 0 virbr0

169.254.0.0 * 255.255.255.0 U 1000 0 0 eth0

default 192.168.113.1 0.0.0.0 UG 0 0 0 eth0

--------------------------------------------------------------------------------------

[root@localhost lab-manual]# netstat -nr

Kernel IP routing table

Destination Gateway Genmask Flags MSS Window irtt Iface

192.168.113.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0

169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0

0.0.0.0 192.168.113.1 0.0.0.0 UG 0 0 0 eth0

-------------------------------------------------------------------------------

5. Change the default Gateway

To change the default gateway for the NIC card eth0

[root@bigboy tmp]# route add default gw 192.168.1.1 eth0

To make this change permenantly, set in the configuration file

/etc/sysconfig/network

[root@bigboy tmp]# vim /etc/sysconfig/network

Add the following content

NETWORKING=yes

HOSTNAME=bigboy

GATEWAY=192.168.1.1

and save the file and restart network

[root@bigboy tmp]#/etc/init.d/network restart

6. Using ping to Test Network Connectivity

The Linux ping command will send continuous pings, once a second, until stopped with a Ctrl-C.

[root@smallfry tmp]# ping 192.168.1.11

Page 51: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

Output

------------------------------------------------------------------------------------------------------------

PING 192.168.1.11 (192.168.1.11) from 192.168.1.100 : 56(84) bytes of data.

64 bytes from 192.168.1.11: icmp_seq=1 ttl=128 time=3.95 ms

64 bytes from 192.168.1.11: icmp_seq=2 ttl=128 time=7.07 ms

64 bytes from 192.168.1.11: icmp_seq=3 ttl=128 time=4.46 ms

64 bytes from 192.168.1.11: icmp_seq=4 ttl=128 time=4.31 ms

--- 192.168.1.11 ping statistics ---

4 packets transmitted, 4 received, 0% loss, time 3026ms

rtt min/avg/max/mdev = 3.950/4.948/7.072/1.242 ms

------------------------------------------------------------------------------------------------------------

7. Using traceroute to Test Connectivity ==

Another tool for network troubleshooting is the traceroute command. It gives a

listing of all the router hops between your server and the target server. This

helps you verify that routing over the networks in between is correct.

[root@bigboy tmp]# traceroute -I 144.232.20.158

Output

---------------------------------------------------------------------------------------------------------------------------

traceroute to 144.232.20.158 (144.232.20.158), 30 hops max, 38 byte packets

1 adsl-67-120-221-110.dsl.sntc01.pacbell.net (67.120.221.110) 14.408 ms 14.064 ms 13.111 ms

2 dist3-vlan50.sntc01.pbi.net (63.203.35.67) 13.018 ms 12.887 ms 13.146 ms

3 bb1-g1-0.sntc01.pbi.net (63.203.35.17) 12.854 ms 13.035 ms 13.745 ms

4 bb2-p11-0.snfc21.pbi.net (64.161.124.246) 16.260 ms 15.618 ms 15.663 ms

5 bb1-p14-0.snfc21.pbi.net (64.161.124.53) 15.897 ms 15.785 ms 17.164 ms

6 sl-gw11-sj-3-0.sprintlink.net (144.228.44.49) 14.443 ms 16.279 ms 15.189 ms

7 sl-bb25-sj-6-1.sprintlink.net (144.232.3.133) 16.185 ms 15.857 ms 15.423 ms

8 sl-bb23-ana-6-0.sprintlink.net (144.232.20.158) 27.482 ms 26.306 ms 26.487 ms

--------------------------------------------------------------------------------------------------------------------

8. Using Hostnames

To communicate other systems in the network using the hostnames,

add the IP address and hostnames in the file /etc/hosts

[root@bigboy tmp]#vim /etc/hosts

Page 52: THIRUMALAI ENGINEERING COLLEGE KILAMBI, …THIRUMALAI ENGINEERING COLLEGE KILAMBI, KANCHIPURAM-631551 ... For the CS2406 ± Open Source Lab as a part of B.E. , ... PACKET MANAGEMENT

add the contents like

<ip address> <hostname>

------------------------------

192.168.1.10 sun

192.168.1.11 earth

192.168.1.12 mars

192.168.1.13 jupiter

192.168.1.14 pluto

----------------------------

and save the file.

Now you can ping the computers with their hostnames

[root@smallfry tmp]# ping earth

Output

-------------------------------------------------------------------------------------------------

PING earth (192.168.1.11) from 192.168.1.100 : 56(84) bytes of data.

64 bytes from earth(192.168.1.11): icmp_seq=1 ttl=128 time=3.95 ms

64 bytes from earth(192.168.1.11): icmp_seq=2 ttl=128 time=7.07 ms

64 bytes from earth(192.168.1.11): icmp_seq=3 ttl=128 time=4.46 ms

64 bytes from earth(192.168.1.11): icmp_seq=4 ttl=128 time=4.31 ms

--- earth ping statistics ---

4 packets transmitted, 4 received, 0% loss, time 3026ms

rtt min/avg/max/mdev = 3.950/4.948/7.072/1.242 ms

9. Setting the Domain Name Server Address ==

To resolve the hostnames using a Domain Name Server, you have to

add the DNS Server Address in the file /etc/resolv.conf

[root@bigboy tmp]#vim /etc/resolv.conf

This file should contain the DNS server address as

nameserver <IP address of DNS Server>

add the following line

nameserver 192.168.1.1

Result

Thus the complete network interface was configured successfully.