65
GNU/Linux Installation & Troubleshooting Guide SPACE (http://www.space-kerala.org) Contents 1 Setting up BIOS 2 1.1 Boot Sequence setting ........................ 2 1.2 Changing the Boot Order in PCs .................. 2 1.3 Setting shared Video Memory .................... 3 1.4 BIOS Anti Virus disabling ...................... 3 2 SATA Controller and GNU/Linux installer 3 3 Introduction to Partitioning 4 3.1 Device naming in GNU/Linux .................... 4 3.2 Primary and logical partitions .................... 4 3.3 GNU/Linux and Windows Partition Analogy ........... 5 4 Boot Loader 5 4.1 The fdisk /mbr Command ...................... 5 4.2 Re-installing grub ........................... 5 5 Device Configurations 6 5.1 Keyboard ............................... 6 5.2 Mouse ................................. 6 5.2.1 PS/2 mouse .......................... 6 5.2.2 Serial mouse ......................... 7 5.2.3 USB mouse .......................... 7 5.3 Display Controller(Adaptor) ..................... 7 5.4 Sound Card ............................. 8 5.5 Scanner ................................ 8 5.6 Webcam ................................ 8 5.7 Digital Video Camera ........................ 8 5.8 Digital Camera ............................ 8 5.9 TV/Tuner Card ............................ 8 5.10 Wi-Fi ................................. 9 6 Internet Connection Settings 9 6.1 Modem ................................ 9 6.2 Asianet ................................ 9 6.3 BSNL Dataone ............................ 9 1

School Gnu Linux

Embed Size (px)

Citation preview

Page 1: School Gnu Linux

GNU/Linux Installation & Troubleshooting

Guide

SPACE(http://www.space-kerala.org)

Contents

1 Setting up BIOS 21.1 Boot Sequence setting . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Changing the Boot Order in PCs . . . . . . . . . . . . . . . . . . 21.3 Setting shared Video Memory . . . . . . . . . . . . . . . . . . . . 31.4 BIOS Anti Virus disabling . . . . . . . . . . . . . . . . . . . . . . 3

2 SATA Controller and GNU/Linux installer 3

3 Introduction to Partitioning 43.1 Device naming in GNU/Linux . . . . . . . . . . . . . . . . . . . . 43.2 Primary and logical partitions . . . . . . . . . . . . . . . . . . . . 43.3 GNU/Linux and Windows Partition Analogy . . . . . . . . . . . 5

4 Boot Loader 54.1 The fdisk /mbr Command . . . . . . . . . . . . . . . . . . . . . . 54.2 Re-installing grub . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

5 Device Configurations 65.1 Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65.2 Mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

5.2.1 PS/2 mouse . . . . . . . . . . . . . . . . . . . . . . . . . . 65.2.2 Serial mouse . . . . . . . . . . . . . . . . . . . . . . . . . 75.2.3 USB mouse . . . . . . . . . . . . . . . . . . . . . . . . . . 7

5.3 Display Controller(Adaptor) . . . . . . . . . . . . . . . . . . . . . 75.4 Sound Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85.5 Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85.6 Webcam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85.7 Digital Video Camera . . . . . . . . . . . . . . . . . . . . . . . . 85.8 Digital Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85.9 TV/Tuner Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85.10 Wi-Fi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

6 Internet Connection Settings 96.1 Modem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96.2 Asianet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96.3 BSNL Dataone . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

1

Page 2: School Gnu Linux

7 Device Drivers 97.1 Hardware Detection . . . . . . . . . . . . . . . . . . . . . . . . . 10

8 AMD 64 10

9 Managing Printing using CUPS 10

10 Network sharing 1010.1 NAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1010.2 SQUID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

11 Some usefull links 11

1 Setting up BIOS

BIOS, in computing, stands for Basic Input/Output System. The BIOS runsoff the onboard flash memory when the computer is powered on and it ini-tializes the chipset and the memory subsystem. Subsequently, it uncompressesitself from flash memory into the system main memory and starts executingfrom there. PC BIOS code also contains diagnostics to assure critical hardwarecomponents, such as keyboard, disk drive, IØports etc., are operational, andproperly initialized. Nearly all BIOS implementations can optionally execute asetup program interfacing the nonvolatile BIOS memory (CMOS). This memoryholds user-customizable configuration data (time, date, hard drive details, etc.)accessed by BIOS code.

1.1 Boot Sequence setting

In computing, booting is a process that starts operating systems when the userturns on a computer system. Many BIOS set-up menus allow you to select thedevices from which Operating System for computer can be selected. In order toinstall GNU/Linux set first device to look for operating system as CD-ROM (asCD-Rom is most commonly used media for GNU/Linux distribution, floppiesare also used some times).

If you have a newer SCSI controller and you have a CD-ROM device attachedto it, you are usually able to boot from the CD-ROM. All you have to do isenable booting from a CD-ROM in the SCSI-BIOS of your controller.

Other popular option is to boot from a USB storage (also called USB memorystick or USB key). Some BIOSes can boot USB storage directly, and somecannot. You may need to configure your BIOS to boot from a Removable driveor even a USB-ZIP to get it to boot from the USB device.

Here are some details about how to set the boot order. Remember to resetthe boot order after GNU/Linux is installed, so that you restart your machinefrom the hard drive.

1.2 Changing the Boot Order in PCs

1. As your computer starts, press the keys to enter the BIOS utility. Often,it is the Delete key. However, consult the hardware documentation for theexact keystrokes.

2

Page 3: School Gnu Linux

2. Find the boot sequence in the setup utility. Its location depends on yourBIOS, but you are looking for a field that lists drives. Common entries onIDE machines are C, A, cdrom or A, C, cdrom. C is the hard drive, andA is the floppy drive.

3. Change the boot sequence setting so that the CD-ROM or the floppy isfirst. Usually, the Page Up or Page Down keys cycle through the possiblechoices.

4. Save your changes. Instructions on the screen tell you how to save thechanges on your computer.

1.3 Setting shared Video Memory

Display controller in computers will need memory memory for its own opera-tions. In high end display controllers and older controllers special ram comeswith controller. Recent days display controller comes with mother board of com-puter. In these kind of computers part of the main system memory is sharedwith display controller. BIOS will allow user to decide how much memory is tobe given to display controller. This setting is very important for GNU/Linuxdistributions. Display resolution and colour depends on size of memory givento display controller. 16 MB minimum memory is recommended for most ofmachines we find these days. If shared memory is less than this GNU/Linuxwill run in lesser resolution like 640x480.

1.4 BIOS Anti Virus disabling

During the installation procedure GNU/Linux installer will modify boot sectorof hardisk. BIOS antivirus softwares some time consider this as virus attackand disable modification of boot sector. This will make installed version ofGNU/inux inaccessible. Disabling BIOS anti virus applications will preventthis from happening.

2 SATA Controller and GNU/Linux installer

Serial ATA (also known as S-ATA or SATA) chipsets are rapidly replacing legacy”parallel ATA” (PATA, i.e., regular ATA/133) chipsets but many GNU/Linuxinstallers don’t yet support many Serial ATA chipsets. If yours isn’t supported,you have an installation obstacle.

There are three workaround options:

1. Switch the motherboard BIOS back to ”legacy ATA mode” (parallel ATA= PATA). Complete a Linux installation. Fetch or build a kernel withsupport for your chipset. Switch the BIOS setting back.

2. Rebuild your installer using kernel 2.4.27 or later, which includes libata,desirable since it adds many new chipsets and gives a (potential, subjectto physical read limits, etc.) 10M/s speed boost to some others comparedto the quite slow 2.4.x drivers/ide set.

3

Page 4: School Gnu Linux

3. Temporarily add a regular PATA drive to your system. Install Linux ontothat. Fetch or build a kernel with support for your chipset. Migrate yoursystem to the SATA drives.

For more information visit the following URL:- http://linuxmafia.com/

faq/Hardware/sata.html

3 Introduction to Partitioning

3.1 Device naming in GNU/Linux

GNU/Linux disks and partition names may be different from other operatingsystems. You need to know the names that Linux uses when you create andmount partitions. Here’s the basic naming scheme:

fd0 First Floppy Drivefd1 Second Floppy Drivehda IDE Hard disk / CD-ROM on the first IDE port (Master)hdb IDE Hard disk / CD-ROM on the first IDE port (Slave)hdc IDE Hard disk / CD-ROM on the second IDE port (Master)hdd IDE Hard disk / CD-ROM on the second IDE port (Slave)hda1 First partition of the first IDE hard diskhdd15 Fifteenth partition of the fourth IDE hard disksda SCSI Hard disk with lowest SCSI ID (e.g. 0)sdb SCSI Hard disk with next higher SCSI ID (e.g. 1)sdc SCSI Hard disk with next higher SCSI ID (e.g. 2)sda1 First partition of the first SCSI hard disksdd10 Tenth partition of the fourth SCSI hard disksr0 SCSI CD-ROM with the lowest SCSI IDsr1 SCSI CD-ROM with the next higher SCSI ID

3.2 Primary and logical partitions

Partitioning is a means to divide a single hard drive into many logical drives.A partition is a contiguous set of blocks on a drive that are treated as anindependent disk.

“Primary” partitions are the original partitioning scheme for PC disks. How-ever, there can only be four of them. To get past this limitation, “extended”and “logical” partitions were invented. By setting one of your primary par-titions as an extended partition, you can subdivide all the space allocated tothat partition into logical partitions. You can create up to 60 logical partitionsper extended partition; however, you can only have one extended partition perdrive.

GNU/Linux represents the primary partitions as the drive name, plus thenumbers 1 through 4. For example, the first primary partition on the first IDEdrive is /dev/hda1. The logical partitions are numbered starting at 5, so thefirst logical partition on that same drive is /dev/hda5. Remember that theextended partition, that is, the primary partition holding the logical partitions,is not usable by itself. This applies to SCSI disks as well as IDE disks.

At a bare minimum, GNU/Linux needs one partition for itself. You can havea single partition containing the entire operating system, applications, and your

4

Page 5: School Gnu Linux

personal files. You also need a separate swap partition. Swap is scratch spacefor an operating system, which allows the system to use disk storage as virtual

memory. By putting swap on a separate partition, GNU/Linux can make muchmore efficient use of it. It is possible to force Linux to use a regular file as swap,but it is not recommended.

3.3 GNU/Linux and Windows Partition Analogy

While Microsoft Windows partition the Hard disk using the C, D , E namingconvention for the first 3 primary partitions, and F for the 4th primary partition,GNU/Linux uses /dev/hda1 for the first primary partition, /dev/hda2 for thesecond primary partition, /dev/hda3 for the third primary partition/dev/hda5,/dev/hda6 etc for the logical drives inside the /dev/hda4 primary partition.Microsoft Windows partitions are accessible as different drive names like C, D,E etc. Windows partition tool will allow user to make 2 primary partitions.One of them is an Extended partition in which logical partitions are created.First primary partition is given the name ’C’ (corresponding to /dev/hda1 inGNU/Linux). Next primary partition is Extend partition which is not accessibledirectly. Logical partitions in this extend partition will be given name ’D’, ’E’etc (corresponding to /dev/hda5, hda6 etc in GNU/Linux).

4 Boot Loader

During the installation procedure system will ask several question relating totime setting, packages to install, device configuration etc. At the end of theprocedure it will ask for installation of Boot Loader. Boot Loaders are special-ized softwares which will load operating system. Boot loaders are particularlyuseful when there are more than one Operating System in computer. GRUBand LiLo are two boot loaders coming with GNU/Linux. Boot Loader shouldbe installed in Master Boot Record.

4.1 The fdisk /mbr Command

fdisk command in Windows OS comes handy when you are try to install GNU/Linuxalong with Windows in same disk and some how GNU/Linux installation failed.In such situation system may be left with no Operating System.

fdisk program comes with Windows system disk. The fdisk /mbr commandre-writes the MBR on the system drive using BIOS calls. This will remove BootLoader installed by GNU/Linux installer. Usually operating sysem which wasavailable before GNU/Linux installation will be activated.

4.2 Re-installing grub

If you reinstall windows after installing GNU/Linux, it will overwrite the grubboot loader and you cannot boot into your GNU/Linux system. To recover theboot loader (GRUB) you need a grub boot floppy/CD. It is safe to make a grubfloppy using the command #grub-floppy /dev/fd0 as root user.

To recover grub:

• boot the system with grub floppy

5

Page 6: School Gnu Linux

• In the grub prompt grub>enter root (hdX,Y) where X is the number ofyour harddisk starting from 0 and Y is the partation where you installedGNU/Linux. The numbering starts from 0, ie if you installed GNU/Linuxon 5th partation of your first harddisk you will enter root (hd0,4). Youcan use TAB key to see all the disks/partitions you have. If you select thecorrect partitions you will see the type of partition which is ext2/3 for agnu/linux system.

• enter setup (hd0)

• reboot the computer after removing the floppy from the drive.

5 Device Configurations

5.1 Keyboard

Keyboard is usually autodetected by installer. Settings for Keyboards are 1.Number of Keys (101/104 etc) 2. Language (us)

In India we are using us as keyboard language (see the dollar sign availablein Key with numeral 4). Earlier keyboards had 101 keys. Now days we havekeyboard with 3 extra keys with ’Window’ sign. Such keyboards are called 104keyboards.

5.2 Mouse

Mouse configuration requires following settings:

1. Interface Type (connector used to connect device with computer)

2. Protocol of the Mouse

Interfaces are usually 3 types. They are serial, PS/2, usb. This can beidentified with connectors at the end of mouse cable. There will be a device entryin GNU/Linux file system corresponding to each of these devices. /dev/ttyS0is used for mouse connected to first serial port, /dev/ttyS1 for mouse in secondserial port and /dev/psaux for PS/2 mouse. Newer versions of GNU/Linuxcomes with a special device entry called /dev/input/mice, very common forUSB mouses and in some case for PS/2 mouses also.

Protocol depends on owner of mouse. Usual choice for this is Auto wheresystem will try to determine protocol on its own. If that fails we will have toset protocol manually. Usual choices are as below.

5.2.1 PS/2 mouse

The “PS/2” protocol should always be tried first for the PS/2 mouse regardlessof the brand of the mouse. Any PS/2 mouse should work with this protocoltype, although wheels and other additional features are unavailable

After verifying the mouse works with this protocol, you may choose to specifyone of “xxxPS/2” protocols so that extra features are made available.

6

Page 7: School Gnu Linux

5.2.2 Serial mouse

You need to manually specify a protocol type for your mouse. Choose one fromthe following list:

IntelliMouseLogitechMicrosoftGlidePointMMHittabMMSeriesMouseManMouseSystemsThinkingMouse

When you choose, keep in mind the following rule of thumb:

1. “Logitech” protocol is for old serial mouse models from Logitech. ModernLogitech mice use either “MouseMan” or “Microsoft” protocol.

2. Most 2-button serial mice support the “Microsoft” protocol.

3. 3-button serial mice may work with the “Mousesystems” protocol. If itdoesn’t, it may work instead with the “Microsoft” protocol although thethird (middle) button won’t function. 3-button serial mice may also workwith the “Mouseman” protocol under which the third button may functionas expected.

4. 3-button serial mice may have a small switch at the bottom of the mouseto choose between “MS” and “PC”, or “2” and “3”. “MS” or “2” usuallymean the ”Microsoft” protocol. “PC” or “3” will choose the ”MouseSys-tems” protocol.

5. If the serial mouse has a roller or a wheel, it may be compatible with the“IntelliMouse” protocol.

6. If the serial mouse has a roller or a wheel and it doesn’t work with the“IntelliMouse” protocol, you have to use it as a regular 2- or 3-buttonserial mouse.

5.2.3 USB mouse

If your mouse is connected to the USB port, it can either be supported bythe “Auto” protocol, or by an OS-specific protocol (see below), or as a genericHuman Interface Device by the “usb” protocol.

5.3 Display Controller(Adaptor)

Drivers for Display controllers comes with X-Window system (frame work forGUI applications in Unix like systems). There are two variants of X-Windowssystems being used in GNU/Linux. They are Xfree86 and X-Org. X-Org isthe latest system with some advanced features. Drivers come as modules inX-Window. Most intel graphics chips like 810, 845 etc. uses the driver i810.For newer chipsets like 915 choose vesa. VESA is a driver which can support

7

Page 8: School Gnu Linux

almost all video cards. If driver module is not available for your specific Displaycontroller try “vesa”.

Configuration tools for X-Window will help in selecting driver for controllerand setting up monitor. Generally we use the command line utilities xfree86configfor xfree86 and xorgconfig for xorg. For a graphical configuration we use thexfree86cfg for xfree86 and xorgcfg for xorg.

In debian systems for xfree86 versions use dpkg-reconfigure xserver-xfree86

for Xorg versions use dpkg-reconfigure xserver-xorg

There is an advanced configuration option recommended only for experts thecommand is X -configure . Copy the file thus generated to the file /etc/x11/xfree86.confand /etc/x11/xorg.conf

5.4 Sound Card

Sound cards are usually detected by GNU/Linux installer. If that is not hap-pening use the lspci command to list all PCI all devices connected. Identify thesound module for your system. Then use tools like modconf to load driver man-ually. In case driver for card is not available Kernel may have to be updated.This happens usually for devices which came to market recently.

alsaconf can be used to automatically detect and configure sound cards.for that the package alsa-base should be installed

5.5 Scanner

Scanners can be configured using a tool named xsane. A hardware compatibilitylist found at http://sane-project.org Any Scanner not found in the sanehardware compatibility list is presently unsupported by GNU/Linux.

5.6 Webcam

See the link for webcams supported in GNU/Linux http://linuxtv.org/v4lwiki/

index.php/Webcams

5.7 Digital Video Camera

Digital Video Cameras can be configured by visiting the Hardware CompatibilityList URL at www.linux1394.org/hcl.php

5.8 Digital Camera

USB storage digital cameras are supported by default in GNU/Linux. Also visitthe URL http://www.gphoto.org/proj/libgphoto2/support.php for the hard-ware compatibility list

5.9 TV/Tuner Card

The TV tuner card Hardware compatibility list is found in the http://linuxtv.org/v4lwiki/index.php/List survey of cards in use now http://linuxtv.

org/v4lwiki/index.php/Main Page

8

Page 9: School Gnu Linux

5.10 Wi-Fi

Wi-Fi devices in GNU/Linux requires the acx100 module that can be foundat http://acx100.sf.net. Additional support is also found at http://www.

linux-wlan.org/ and https://wiki.ubuntu.com/HardwareSupport Presentlycards without the acx 100 module are unsupported in GNU/Linux. Wi-fi devicescan be configured using the iwconfig command.

6 Internet Connection Settings

6.1 Modem

All external modems are supported by GNU/Linux. Most of the internal modemsare not supported. Modems in CDMA/WLL phones are also recognisesed inGNU/Linux. Special initialisation strings are required in case of CDMA phones.Settings are available on internet.

6.2 Asianet

• case 1 DHCP Ethernet In the above screen shot set the Configuration asDHCP instead of the Static IP address.

• Case 2 Download and Time Limited Connections Asianet provides a scriptfor this scheme. Run the script after setting the network configuration asDHCP.

6.3 BSNL Dataone

for configuring bsnl dataone connection use the command pppoeconf

7 Device Drivers

Microsoft Windows device drivers are mostly installed using a driver cd providedby the hardware vendors. In GNU/Linux the drivers are in the /lib/modulesfolder. For example the cdrom device driver for the system which runs akernel version of 2.6.10-5-386 is located in the location /lib/modules/2.6.10-5-386/kernel/drivers/cdrom/cdrom.ko

The driver files are usually found with a .ko extension as in the above ex-ample. The dmesg command program helps users to print out their bootupmessages. The lsmod program to show the status of modules currently in theGNU/linux kernel. The Modprobe program to add modules to the Linux Kernel.syntax:- modprobe module name The rmmod command can be used to removemodules from the Kernel. Syntax:- rmmod (module name) The uname com-mand prints system information. The uname -a gives the following output:Linux Debian 2.6.10-5-386 #1 Fri Jun 24 16:53:01 UTC 2005 i686 GNU/Linuxon a debian gnu/linux system with 2.6.10 kernel.

9

Page 10: School Gnu Linux

7.1 Hardware Detection

lspci is a utility for displaying information about all PCI buses in the systemand all devices connected to them.

lsusb is a utility for displaying information about USB buses in the systemand the devices connected to them.

8 AMD 64

A separate version on GNU/Linux for the AMD 64 bit processor is available fordistributions like Debian GNU/Linux.

9 Managing Printing using CUPS

Printing can be done using the GNOME-Cups tool, which can be invoke withgnome-cups-manager command as root user.Click on New printer, you have theoption of setting up the printer as a local or network printer. You will also haveto choose the make and type of the printer.

Two useful commands for printing are lpq and lprmlpq:- he command shows the printer queue status. A sample lpq command

output is as follows

root@debian:~# lpq

LaserJet-1010 is ready and printing

Rank Owner Job File(s) Total Size

active gnu 32 training-update.sxw 1952768 bytes

lprm:- The command cancels print jobs.

Syntax:- lprm queue number

10 Network sharing

10.1 NAT

In computer networking, network address translation (NAT, also known as net-work masquerading or IP-masquerading) is a technique in which the sourceand/or destination addresses of IP packets are rewritten as they pass througha router or firewall. It is most commonly used to enable multiple hosts on aprivate network to access the Internet using a single public IP address.

echo ’1’ > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

10.2 SQUID

Squid is a high-performance proxy caching server for web clients, supportingFTP, gopher, and HTTP data objects. Unlike traditional caching software,Squid handles all requests in a single, non-blocking, I/O-driven process. Squidkeeps meta data and especially hot objects cached in RAM, caches DNS lookups,

10

Page 11: School Gnu Linux

supports non-blocking DNS lookups, and implements negative caching of failedrequests.

Squid supports SSL, extensive access controls, and full request logging. Byusing the lightweight Internet Cache Protocol, Squid caches can be arrangedin a hierarchy or mesh for additional bandwidth savings. Squid consists of amain server program squid, a Domain Name System lookup program dnsserver,some optional programs for rewriting requests and performing authentication,and some management and client tools. When squid starts up, it spawns aconfigurable number of dnsserver processes, each of which can perform a single,blocking Domain Name System (DNS) lookup. This reduces the amount of timethe cache waits for DNS

11 Some usefull links

• www.gnu.org

• www.gnu.org.in

• www.debian.org

• www.tldp.org

• http://librenix.com

• http://howtoforge.org

• www.space-kerala.org

11

Page 12: School Gnu Linux

�������������� � ���

���������������

���������������������������������������������������������������������������������������������������������������������������������� ��!������������������������∀��� �������������������������������������#��������������∃�����%&∋���������(���� ���������������

������������

�� �������

������

�������

)���������������������������������������∗%&∋+�������∗,−,%+����,−,%���������������������������,����������������������������������������������������������������������������������������������������������������������������

����� �� ���������������

��� ��������.�����

��� ��������,���

��� ,��������.�����

�� ,��������,���

��� #�����,−,%����

��� ,�����,−,%����

�/0�%���������������,−,%��������������������������������������������������������������������������������������∃�������������������������������������������������������������������

&����� ������������ ���&���������∃�������������������������������������∃������������������������������������������∃��������������������

����� �����������

���� #������������������∃������������

���� ,������������������∃������������

���� �����������������������,−,%����

%&∋���������������1������� ������������������∃����������������������������������������������∃����������������������������������������������������������������∃�21������������������%&∋��������32������,−,%������

����������������������������������∗3�4�5�1+����∗3�4�6�2�7�8+

Page 13: School Gnu Linux

� ������������� ����� ��� �

�����������������������������������������������������������

������� ���������� ��������� !��������∀�#� !∃������%������&�#∋�()∗��

�������������������!∋�������!!���������� �����������!������+�,−

�������������������!#������� ��������� ���∋ ��������∋�������−������

�������∋�����������!#������ ��∋��������∋#� #∀�������!������+�,−

�������∀���������� ��∀����� ∀ !����������∀ ∀�������!������+�,−

������������������ ∀ #����� ����������! #�!�∃�������!������+�,−

�������!���������� �� ����� �! �������∋ � !∃�������!������+�,−

�������#���������� �!∋����� !�∋������� �#∀�∀��������!������+�,−

������� ���������� !�∀����� !� �������� ���∀��������!������+�,−

������� ��������� !�∋����� !!�����������∀ ���������!������+�,−��.�/

�����������������������∃�����������������������������������5��������������������������������������������������∗!��!��5+��������8�����������������������������������������!��!��5�������������%��∃����!��!��5�����������9���������9������∃���������������������������������������������������

/ �%−∋

.��������������������������������������������������������������������∀������������������������������������������������∃�������%&∋���������������������

Page 14: School Gnu Linux

���������������������� ��������������������������

�������������� �

Minimum disk space :

Swap :

/ : (Everything you install will go here)

/home : (All user data will go here)

Assumption:

1. You already have an operating system in your hard disk and you want

School GNU/Linux coexists with your existing system.

2. You dont have any unpartitioned space in your harddisk.

In the partitioning menu

in the School GNU/Linux

installer choose

option.

2

Choose the partitions you want to delete to make free space. Use Enter key

on the partition to get the list with delete option.

repete until you get enough (unpartitioned space)

������

�������������

Page 15: School Gnu Linux

3

Select the using enter key.

Choose

form the menu. Choose

Then choose

Confirm

changes by selecting .

�����������

������ ������

������

Page 16: School Gnu Linux

How to change your default screen resolution.

Just like most other configuration files, the configuration files for display, screen

resolution etc. also can be found in the /etc directory. We will see how we can change the

default screen resolution by editing a text file, with the help of this step by step tutorial.

1. Bring up the Run Application dialog box by pressing Alt+F2 on your keyboard.

2. Type gksu gedit in the dialog box and press Enter.

Note: gksu is a special command for opening an application with root/superuser

privileges. We need root privileges because, we have to edit a file which only the root

user can modify.

3. Now you will be prompted for the root password. Type the root password and pressEnter.

4. Open the file /etc/X11/XF86Config-4

5. Press Ctrl-f to bring up the Search dialog box in gedit. Type 'Screen' as the search string

and press Enter.

Page 17: School Gnu Linux

6. We can see that the word 'Screen' being highlighted towards the end of the file.

7. On the fourth line below that, we will find an entry named 'DefaultDepth', and a

numerical value to the right of that. That numerical value is your systems present

colour depth. Immediately below that, we can find various subsections for various

colour depths.

8. Go to the subsection corresponding to your color depth, i.e, if your default depth is 24,

go to the subsection corresponding to a depth of 24.

9. We can find the present resolutions to the right of 'Modes' ie., 800x600 and 640x480.

Since 800x600 is given first, it is given a higher priority and hence, it is the present

resolution of your system.

10. Now type, “1024x768”, including the inverted commas just before “800x600”.

11.Save the file and exit gedit.

12.Now restart gdm by pressing Ctrl+Alt+Backspace.

13.If all goes well, your system should now restart with the new resolution that we added

now.

Troubleshooting:

If your graphical interface doesn't load after pressing Ctrl+Alt+Backspace, and you get a

command line login screen, first login with your username and type the following

command at the terminal and press Enter.

/etc/init.d/gdm restart

Page 18: School Gnu Linux

Troubleshooting1 . Installation1 . 1 Installation not completed or package missinga Media error or I/O error Your installation Cd may have damaged. Try to change the disk Andinstall again.b CD drive problem Installation Not compleated or Package missing error may occure due tounproper functioning of your CD drive. So please Check the cd works on another system.1 . 2 No CD ROM founda Check bios for Serial ATA Controller mode, Set it to Enhanced mode.b Set UDMA option to be enabled ! *c This is well known issue about Intel ATA driver. Try:1 . Boot installer and choose language.On the keyboard choice screen, push Alt+F2 .2 . Execute: echo " libata options atapi_ enable=1 �� /etc/modprobe. conf3. Push Alt+F1 and progress installation.1 . 3 Installable Media Not founda if you have this problem , �rst you have to identify your mother board. if you are using satahard disk &intel 1 01 or 1 02 GGC mother board , When installation starts,1 . Press Alt+F2, in root prompt ( press enter to get root prompt) type modprobe sata_ sil2 Then come back to installation screen with Alt+F1 .3 You can now continue the installation.1 . 4 ACPI ERRORa For installing Debian Gnu/linux �rst set in BIOS ACPI APIC SUPPORT DISABLE. Afterthat Edit menu. lst (gedit /boot/grub/menu. lst) as show below. At end of menu. lst you can seepath of debian Gnu/linux in that you can see kernel path in that at end add this noacpi. Forexamplekernel /boot/vmlinuz-2. 6. 1 4-2-386 root=/dev/hda3 ro noacpi2 Graphics Problem2. 1 No GUI, no error messages, I get only the login prompt1 . login as root or type su to become super user2 . type this command #taskse l ( insert the installer( debian gnu/ linux) cd)Check whether [ ] IT@School GNU/Linux is selected. If not, select it with the SPACE key2. 2 Error Saying I cannot start Xservera if Error is Screen not found 1

Page 19: School Gnu Linux

1 Check lspci to �nd graphics card2 Check the bios for Video Ram Settings (Atleast 8MB)b If there is no bios settings1 Enter video ram as 81 92 manually while recon�guring dpkg-recon�gure xserver-xfree86c if Error is No core device found1 Check the mouse interface Mouse interfaces are usually of 3 types. They are serial, PS/2and usb. This can be identi�ed by the connectors at the end of mouse cable. There will be adevice entry in GNU/Linux �le system corresponding to each of these devices. /dev/ttyS0 isused for mouse connected to the �rst serial port, /dev/ttyS1 for mouse in second serial port and/dev/psaux for PS/2 mouse. Newer versions of GNU/Linux comes with a special device entrycalled /dev/ input/mice, very common for USB mouses and in some case for PS/2 mouses also.Try recon�guring xserver by the command " dpkg-recon�gure xserver-xfree86" and in the mousedetection section, choose the correct device from the list. ie if you have a serial mouse, choose/dev/ttyS0. If it is a ps2 mouse, choose /dev/psaux. If it is a usb mouse, choose /dev/input/mice. and for the protocol, select auto.3. Sound Problem3. 1 No volume control founda if you have no volume controller , then you �rst log in as root.1 Run alsaconf , [ for that take a terminal and type alsaconf] .2 Then Logout and Login again3. 2 Only root user get sounda Add the user to audio group with the command adduser username audio3. 3 Music playing but no sounda Check volume control bye doubleclicking it. If it is low level raise it Try plugging theaudio/speaker cable to a di�erent input4. Modem Problem4. 1 Modem not Detected with gnome-pppa check modem is on4. 2 Frequently disconnectsa Set the Init1 String to AT2

Page 20: School Gnu Linux

Advanced GNU/Linux Utilities1 . Creating a Debian Package CDAll downloaded packages will be downloaded into /var/cache/apt/archives . Copy all packagesexcept the partial folder and create a folder named deb in the user' s home directory and paste itinto that folder. Now open a terminal and enter the commandapt-ftparchive packages deb | gzip > Packages. gzA �le named Packages. gz can now be found in the home directory. Burn the deb along withPackages. gz using gnomebaker to create a DEB CD2. Creating a CD imageTo create an image of a cd, Insert the cd, take a root terminal and type the following commanddd if=/dev/hdc of=anyname. isoAn iso image of that CD will now be created in your home directory (Remember to repalce/dev/hdc with the device name of your CD drive)3. Synaptic Package ManagerThis software helps you to install/remove new/existing packages into your it@school GNU/Linux operating system. You can open Synaptic from the menuDesktop ->Administration-> Synaptic Package ManagerPackage installation from a Deb CDClick on Edit->add CD romThen an index �le of that deb cd will be created in repository.Right click on the package that you want to install and select 'Mark for installation' . Now clickon the ' Apply' button to install the packages.Package installation from internetClick on Settings > Repository > New to open the Repository Settings Dialog box.Eg: URL: http: // ftp. debian. org/debianDistribution : stablesection : mainClick on the reload button to update the index �les in the repository( fromhttp: // ftp. debian. org/debian )4. Remote Desktop using vnc viewerYou have to con�gure some settings before you can use this tool.Click on Application > System Tools > login screen setupIn security option unmark disallow TCP connection. In XDMCP, enable XDMCP. Now settingsare ok. Then click on Application->Run application1

Page 21: School Gnu Linux

Type xvncviewer and press Enter. Now type the ip address of the system that you are trying toaccess.5. Remote Desktop from command terminalPress Alt+ clt+ f1 and Log in as roottype X : 1 -query ipadress Then you can log in to that system.For getting our own system' s desktop press alt+ f7 . For getting the desktop of another system,press alt+ f8For getting next system' s desktop press alt+ ctl+ f2 and type X : 1 -query ipadress. Then you canlog in to that systemFor getting our own system' s desktop press alt+ f7 For getting 1 st system' s desktop press alt+ f8For getting 2nd system' s desktop press alt+ f9Similarly 5 system' s desktops can be seen by pressing alt+ f7 to alt + f1 2For disconnecting from one connection, Take the corresponding terminal and press ctl+ c6. Malayalam font installation ( for browsers)Search for malayalam fonts in google. com. Save all Malayalam fonts into the . fonts directory inyour home directory.The . fonts directory will be hidden by default, as its name starts with a ' . ' . Press Ctrl+ h tomake the hidden �les visible. ( If . fonts directory is not present, create one directory with thatname. )Next take a terminal and type fc-cache now fonts are installed. Close all open browsers andopen it again to view the changes.7. Assigning an ip addressClick on Desktop > Administration > Networking to open the Network Options dialog box.Select eth0 and click on the Properties button.eg: ip: 1 92 . 1 68. 0 . 1subnet mask: 255. 255. 255. 0gateway : ip addr of the net connected systemclick okclick on dns, add button to add the dns ipclick okHow to �nd out your IP address?Open a terminal and entersu -Now enter the root password followed by the following command.ifcon�gTo �nd out if your system is connected to the net/another systemEnter the command ping , followed by the address of the website/other system.2

Page 22: School Gnu Linux

Frequently Asked Questions1 . How can i create Font Works (WordArt) in Writer/ impress?Click View > Toolbars > DrawingClick on the Fontwork Gallery Icon from the Drawing Toolbarfor more tutorials on OpenO�ce, visit http: //www. tutorialsforopeno�ce. org/2. My Motherboard is Intel 1 01 GGC, While installation, it cannot �nd harddisk.It is a SATA harddisk. How can i solve this?When installation starts, Press Alt+F2 , in root prompt ( press enter to get root prompt) typemodprobe sata_ sil then come back to installation screen with Alt+F1 . You can now continuethe installation.3. How to installl a deb �le in School GNU/Linux?Debian packages are packaged as . deb �les. These deb �les can be installed using the Debianpackage manager -dpkg . First cd to the directory where the . deb package is located and use thecommand$dpkg - i packagename. debfor installing the package. The - i switch is used so that the installation takes place in the inter-active mode.4. When I added Tuxpaint from menu to panel, both panels disappeared. How cani get the panels back?Open home folder then press Ctrl+h to show hidden �les. Then remove the �les and folderswhich started with a . ( dot) . Log out and Login back.It is due to a bug in tuxpaint menu item.5. After installing School GNU/Linux in a computer with both windows 98 andWindows XP, Windows XP not booting and shows hal. dll missing.It is a problem with windows xp to identify two primary partitions. Install GNU/Linux into log-ical partitions solve this problem. To do so, you have to choose manual partitioning option andspecify the partition size and choose the option logical when it prompts.6. How can i share internet connection?create a �le share_ net. sh with the following content�������-#! /bin/shecho 1 > /proc/sys/net/ ipv4/ ip_ forwardiptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE�������You may have to change eth0 to eth1 if the internet cable plug in to your second ethernet card.If you are using Dialup connection replace -o eth0 with -o ppp0 in the last line.Execute this script as root on the server (where internet cable reaches) to share the net. connec-tion. 1

Page 23: School Gnu Linux

7. Could you please point me some sites where i get useful information to use andtroubleshoot Debian GNU/Linux?You can check http: //www. aboutdebian. com/ and http: // thegoldenear. org/toolbox/unices/ fordebian speci�c informationwww. howtoforge. com contains various tutorials related to GNU/Linux8. My SATA harddisk is not working what should I do ?Check in bios that you set the Serial ATA controler mode to Enhanced. It is in the section Inte-grated Periferalals or in some mother board, It is in Drive Con�guration.If you are using Intel D1 01 GCC motherboard please see the seperate post regarding that.9. Sound is not working in my system, How can i con�gure it?try alsaconf command as root user.1 0. How do i con�gure my BSNL Broadband (DataOne) connection?Please check the link http: //www. thinkdigit. com/forum/showthread. php?t=21 1 711 1 . How to connect internet using GPRS facility of nokia phone?There is an e�cient and easy to use tool named ' GPRS Easy Connect ' to get GPRS connec-tion on GNU/Linux. You can download it from the following link.http: //easyconnect. linuxuser. hu/1 2 . How do i con�gure my Internel modem ?At present there is no support for internel modem in GNU/Linux. You can check the linkshttp: // linmodems. org/ and http: //www. linuxant. com/drivers/hsf/downloads-installer. php1 3. How do i install FreeBasic in School GNU/Linux?Free Basic is available at http: //www. freebasic. net/ . Download the binary tar. gz for linux.untar it with the command tar -zxvf Freebasic. tar. gzcd to the FreeBasic directory and run . / install. sh -i as root.1 4. How do I �nd which device is attached to my thumbdrive?Issue the command dmesg after inserting the thumb drive. The device will be listed at the endof dmesg output.1 5. I �nd my graphics card chip set with the command lspci. How do i �nd whichdriver to choose for my card?for intel graphics cards 8281 0 to 82865, choose the driver i81 0. For latest intel systems chooseVESA.If your graphics chipset is Nvidia or GeForce choose nv.you can �nd which driver supports which card with man command.man nv will show which all cards supported by nv driver. man i81 0 shows that for intel cards.Make sure you have atleast 8 MB Video memory alotted in your bios.2

Page 24: School Gnu Linux

1 6. How to recover bootloader/grub? or I installed windows, now cannot boot intomy GNU/Linux installation.http: //www. linuxjournal. com/article/4622 this link provide detail information on how to recovergrub.http: // support. space-kerala. org/docs/grub. pdf also contain a step by step tutorial.1 7. How to login as root user graphically? (with gdm)Choose the " Con�gure the login manager" option from the Action menu of login screen,You will be asked to enter root password.In the login manager setup screen, in the security tab, enable the option " Allow root user tologin"1 8. I get the error message saying that Partition not found during Installation.My harddisk is SATA.Check your BIOS for the option SATA controler, and change its value to " Enhanced Mode" .Also make the option " udma" enabled.1 9 . how to add an item in gnome menu/system menu?I will illustrate how I add a Gnome menu entry by giving an example. let us say I have down-loaded the game called Nexuiz in my home folder and I want to make a menu entry. here is howI do it:gksu gedit /usr/share/applications/nexuiz. desktopsave this and close it. Now I have a neat menu entry under games in Gnome menu called" Nexuiz"Now I will explain what I have done though most of it is self-explanatory.1 ) You need to choose a �lename ( lets say " xyz. desktop" ) instead of nexuiz. desktop dependingon how you want to name the �le. however, it will be at the same location ( /usr/share/applica-tions/ )2 ) Now about the entries in the �le: The �rst 3 lines will be the same for all applications ie. ,[Desktop Entry]Encoding=UTF-8Version=1 . 0 Exec should contain the path of the executableIcon should contain the path of the icon u want to choose for the menu entry ( try to make sureits a . png or . xpm �le)Terminal will have a value of true if u want to run the application in a terminal window. MostGUI apps u would NOT want to run in terminal, so u can keep it as falseName and Comment are self explanatoryCategories is the crucial one. Here you CANT put in anything you want ( you are restricted bycertain keywords)Make the �rst word Application; ( the semicolon is important)The second word can be one of the following depending on where you want your app to appearin the menu:GNOME MENU Menu Entry �-> econd word that u have to put in category ( followed by semi-colon) 3

Page 25: School Gnu Linux

Accessories �> Utility;Edutainment �> Education;Games �> Game;Graphics �> Graphics;Internet �> Network;O�ce �> O�ce;Programming �> Development;Sound & Video �> AudioVideo;System Tools �> System;Others �> Other;Now you are all set. save and exit. you will immediately have a new entry in our Gnome menu.Example: /usr/share/applications/ooo-writer. desktop[Desktop Entry]Version=1 . 0Encoding=UTF-8Terminal=falseIcon=ooo-writerType=ApplicationCategories=Application;O�ce;X-Red-Hat-Base;X-SuSE-Core-O�ce;Exec=oo�ce -writer %F20. My panel crashed/getting a message " panel already running"1 ) open the home folder.2 ) Ctrl + H to show hidden �les3) remove all folders starting with . ( dot)4) Ctrl + H to hide hidden �les.21 . How to access �les in my Windows partitions? .Use the Disks option in the Administration Menu to mount the windows partitions. Will put amore detailed document later.22. How do i �nd which graphics card the system has?Execute the command " lspci | grep VGA" at the root prompt. You' ll get a line 'VGA compat-ible controller' followed by the description of your graphics card.If you see a number Intel 8281 0 to 82865 the driver to use is i81 0. For any latest graphics cardsyou can choose the VESA driver. If the card you have is Nvidia or Geforce, choose nv as thedriver.If you want to �nd out the cards supported by a particular driver, use the command " mandriver-name" for example, if you want to �nd which cards are supported by the nv driver, givethe command " man nv" . 4

Page 26: School Gnu Linux

23. How to create grub boot �oppy ?You can create a grub boot �oppy with the command " grub-�oppy /dev/fd0" . All data in that�oppy will lost.24. My Mouse is not detected/Mouse is not working . How can i con�gure it?Mouse interfaces are usually of 3 types. They are serial, PS/2 and usb. This can be identi�ed bythe connectors at the end of mouse cable. There will be a device entry in GNU/Linux �lesystem corresponding to each of these devices. /dev/ttyS0 is used for mouse connected to the�rst serial port, /dev/ttyS1 for mouse in second serial port and /dev/psaux for PS/2 mouse.Newer versions of GNU/Linux comes with a special device entry called /dev/ input/mice, verycommon for USB mouses and in some case for PS/2 mouses also.Try recon�guring xserver by the command " dpkg-recon�gure xserver-xfree86" and in the mousedetection section, choose the correct device from the list. ie if you have a serial mouse, choose/dev/ttyS0. If it is a ps2 mouse, choose /dev/psaux. If it is a usb mouse, choose/dev/ input/mice. and for the protocol, select auto.25. I chose the correct Xfree86 driver for my School GNU/linux installation. ButXserver is still not starting and I dont get Graphics mode.Check wheter your BIOS has an option to change Shared Video memory. If so please increaseits amount. If the BIOS doesn' t have that option, specify it as 81 92 ( for 8MB) at the VideoMemory prompt in the con�guration of Xserver. You can recon�gure your Xserver by using thecommand #dpkg-recon�gure xserver-xfree86 ( as root. )26. How to change the graphics driver?Run the following command as the root user#dpkg-recon�gure xserver-xfree86Choose the appropriate driver from the list and restart the graphics using the command#/etc/ init. d/gdm restart27. CD-ROM not found, Installer is asking for driver �oppy disk while installingSchool GNU/Linux.In the BIOS IDE controller option set the value Enhanced Mode form the list.28. How to install Open O�ce Impress 1 ?If you have the School GNU/Linux extra CD; add it to the system using the commandapt-cdrom addthen install it with the commandapt-get install openo�ce-impress-1 . 0Some Useful Linkswww. gnu. orgwww. gnu. org. inwww. debian. orgwww. tldp. orghttp: // librenix. comhttp: //howtoforge. orgwww. space- kerala. org 5

Page 27: School Gnu Linux

Re/Installing GRUBA step by step tutorial

[email protected]

A boot loader is the first software program that runs when a computer starts. It is

responsible for loading and transferring control to the operating system kernel

software (such as the Hurd or the Linux). The kernel, in turn, initializes the rest of the operating system (e.g. GNU).GRUB or GRand Unified Bootloader is the most commonly used bootloader today. This tutorial shows you how to Re/Install GRUB in your system.

1. MAKING A BOOTABLE FLOPPY

a) Log into any working GNU/Linux system as root user.

b) Insert a blank floppy, and at the root prompt, type:

Your bootable floppy disk is ready now.

2. BOOTING FROM THE FLOPPY

a) Now restart the machine and make the system boot from the floppy.

b) If all goes well, you should get a grub prompt like this:

3. TELLING GRUB WHERE TO LOOK FOR FILES REQUIRED TO BOOT THE

SYSTEM

���������� ��� ���

������

Note: You can do this by

editing the Boot device

priority in the BIOS.

Page 28: School Gnu Linux

This is the most complicated part of the whole process, and therefore let us make the basics clear before moving further.

A system can have one or more than one harddisks, and each of these harddisks can

have several partitions. To make things worse, linux kernel and grub uses different

naming conventions for harddisks and their partitions.

Grub starts the numbering from 0, and it uses digits for numbering both harddisks

and their partitions.

Linux kernel uses alphabets, starting from a for harddisks, and numbers, starting

from 1 for partitions.

Let us now make the concept clear with the help of these tables.

NAMING OF HARDDISKS(hd)

Harddisk Number Grub Linux kernel

1 hd 0 hda

2 hd 1 hdb

and so on........

NAMING OF PARTITIONS

Harddisk Number Partition Number Grub Linux kernel

1 1 hd 0,0 hda1

1 2 hd 0,1 hda2

2 1 hd 1,0 hdb1

2 5 hd 1,4 hdb5

and so on......

Hope it is clear now. Now back to what we were doing.

a) Specify the location of your root directory in the hard disk.

Suppose the root partition is on the 3rd partition of the 1st hard disk, we type:

���������������

Page 29: School Gnu Linux

b) Now specify the location of the linux kernel on the harddisk

Don't get scared by this command, we are just mentioning the location of vmlinuz,

ie the linux kernel (kernel /boot/vmlinuz-2.6.14-2-386), and specifying the partition on

which it can be found(root=/dev/hda3).

The numbers after vmlinuz represents the version number of the kernel. It may be

different on your system, but don't worry; you can get it by typing upto vmlinuz and

pressing the Tab key.

Also note that /dev/hda3 refers to the 3rd partition on the 1st harddisk. Don't forget to

make the necessary changes according to your system.

c) Now specify the location of initrd.img

d) Now boot into the system using the boot command.

4. INSTALLING GRUB

a) Login as root at the command prompt, and issue the following command:

Note: If you are not sure about the partition number of

your root directory, just type upto 'root(hd'

and press the Tab key twice. You will now be

presented with a list of available options. If there is only one

option, it will automatically be completed for you.

You will be using this autocompletion feature many more

times in this tutorial itself.

������������ �� ���������� �!∀���#∃ ���% ��� ��&#

Note:The initrd file is the Initial Ram Disk that holds the

modules that are needed for the system to boot.

������������ �� ������������� �!∀���#∃

�������

��������∋�&��

Page 30: School Gnu Linux

b) For systems having more than 1 harddisks, specify the name also:

*hda for the first harddisk, hdb for second harddisk and so on..

��������∋�&�����&(

Page 31: School Gnu Linux

GNU/Linux Networking Tutorial for Newbies

M K Saravanan

Centre for Internet Research

[email protected]

February 21, 2002

Contents

1 License 2

2 Introduction 2

3 Further Information 2

4 Networking fundamentals 24.1 Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24.2 Origin of Internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34.3 Birth of TCP/IP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44.4 Packet Switched Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44.5 IP Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

4.5.1 More about IP Addresses . . . . . . . . . . . . . . . . . . . . . . . . 64.6 Domain Name System (DNS) . . . . . . . . . . . . . . . . . . . . . . . . . . 74.7 TCP/IP Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94.8 Network Interface Card (NIC) . . . . . . . . . . . . . . . . . . . . . . . . . . 94.9 Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.10 Relation between IP Address and MAC address . . . . . . . . . . . . . . . . 114.11 Data Flow from End-to-End . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.12 Note on RFCs/STDs/FYIs/BCPs . . . . . . . . . . . . . . . . . . . . . . . 12

5 Setting up a small network 125.1 DNS Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155.2 Installing Client/Server programs . . . . . . . . . . . . . . . . . . . . . . . . 165.3 Internet Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.4 Telnet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195.5 ssh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205.6 File Transfer Protocol: ftp . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205.7 Web service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225.8 Samba . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Page 32: School Gnu Linux

CONTENTS 2

6 Network Troubleshooting Utilities 296.1 ping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296.2 tcpdump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296.3 ipgrab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306.4 netstat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326.5 traceroute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326.6 tracepath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

7 Before THE END 34

Page 33: School Gnu Linux

1 License 3

1 License

Copyright c© 2002 M K Saravanan

Permission is granted to copy, distribute and/or modify this document under the terms ofthe GNU Free Documentation License, Version 1.1 or any later version published by the FreeSoftware Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-CoverTexts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.txt.

2 Introduction

This tutorial assumes that you already know the basics of GNU/Linux. It won’t teachyou the basic things like editing a file, cp, rm, etc. . . Throughout the tutorial we willassume Redhat 7.2 distribution though the commands are similar in other distribution.This tutorial will teach you only the very minimum basics of networking. I will try toupdate this guide whenever i get free time. You can download the latest copy of thistutorial at http://mksarav.tripod.com.

3 Further Information

A large number of tutorials are available for GNU/Linux on all possible topics. Kindly doa GNU/Linux google search at http://www.google.com/linux. To start with you can gothrough the following HOWTOs:

• LINUX: Rute User’s Tutorial and Exposition by Paul Sheer

http://rute.sourceforge.net

• DOS-Win-to-Linux-HOWTO

• Unix-and-Internet-Fundamentals-HOWTO

• RFC#1180 - A TCP/IP Tutorial

• Networking-Overview-HOWTO

You can download all the HOWTOs and mini-HOWTOs from http://www.linuxdoc.

org. Most of the time the answer for the question you are asking will be available by doinga google search at http://groups.google.com. Please don’t expect spoon-feeding. Beprepared to go through man pages first whenever you are in doubt.

4 Networking fundamentals

4.1 Protocols

If you want to share the resources available in various computers (hardware as well assoftware), then through some means we can connect all of them and make use of the

Page 34: School Gnu Linux

4.2 Origin of Internet 4

available resources with each other. We call the interconnection of all these computers asa Network. To connect two computer with each other, first they should understand whatthe other computer is saying. Say, if you talk in chinese and the opposite guy in Russian,then both of you won’t understand what each other is saying. To solve this problem sayboth of you are following a rule: each should employ a translator whose common languageis english. Then you can establish communication with each other like:

Chinese

Chinese→English(Translator)

Russian

English→Russian(Translator)

Since you followed a rule here, both of you are now able to communicate. Here the ruleis: Employ a translator whose common language is english. In networking terminology, aset of rules is often called a PROTOCOL. Thus if both of you follow a common protocol,you can establish communication with each other. This is what happening in a computernetwork. Thus to establish communication with two computers, both of them must followa common protocol.

4.2 Origin of Internet

GNU/Linux supports a wide variety of networking protocols. However, TCP/IP is thede-facto standard protocol for networking. Before actually discussing about TCP/IP, letus go through some brief history about how this wonderful protocol came into existence.

On 4th October 1957, the world first satellite SPUTNIK was launched by USSR.This created added tension to the cold war between USSR & US at that time. USDoD(United States Department of Defence) decided to increase the research activities in spaceprogramme, and also to integrate the resources and sharing of valuable data spreadedacross various research labs. To increase sharing of resources, USDoD started a projectcalled ARPANET (Advanced Research Project Agency NETwork). The then US presi-dent “Dwight D Eisenhower” saw the need for the ARPA. In 1962, Dr.J.C.R. Licklider waschosen to head ARPA’s research in improving the military’s use of computer technology.

The main goals of ARPANET were:

• To increase the sharing of resources, ARPA began coordinating the developments ofa vendor-independent network to tie the major research sites together. The need fora vendor-independent network was the first priority, since each facility used differentcomputers with proprietary networking technology. In 1968, work began on a privatepacket-switched network, which eventually became known as ARPANET (Mother ofInternet).

• During those days, Centralised Circuit-Switched network, involving dedicated end-to-end connections between two specific sites, were used. In contrast, the ARPANET

Page 35: School Gnu Linux

4.3 Birth of TCP/IP 5

tried to build a De-Centralised network, allowing organisations to interconnect into amesh-like topology. This way the data can be sent from one computer to another usinga variety of different routes. Such a network will survive war-time attack ensuringhigh reliability due to its decentralised nature.

4.3 Birth of TCP/IP

In order to create a vendor-independent network, i.e. to establish communications betweendifferent hardware platforms, we need to follow a certain set of procedures. ARPANETteam came up with a new protocol called TCP/IP (Transmission Control Protocol/InternetProtocol).

TCP/IP Protocol Suite is a collection of various protocols like TCP, IP, ARP, RARP,ICMP, etc. . . Since TCP & IP forms the core of these protocols, the entire protocol suiteitself named as TCP/IP. So, whenever you see the word TCP/IP, remember it is a set ofprotocols.

Once TCP/IP is installed in each computer, we can easily create a vendor-independentnetwork.

UNIX

TCP/IP

WIN-XP

TCP/IP

Slowly TCP/IP became the de-facto standard for Internet Communications. Nowa-days almost all the Intranet also started using TCP/IP. But remember TCP/IP is not theonly protocol available for networking. Several other protocols like IPX/SPX, AppleTalkProtocol, etc. . . are also in use.

If you install TCP/IP in all the computers then you can establish communication witheach other by properly configuring each of them. GNU/Linux comes with inbuilt TCP/IPsupport in the kernel. So you don’t have to do anything special to install TCP/IP.

4.4 Packet Switched Network

To establish communication between two computers, traditionally circuit-swtiched mech-anism were used which involves dedicated end-to-end connection between two sites. Toovercome the problems of Circuit-Switching (war-time attack: no inbuilt fault-tolerance incentralised network), Packet Switching Mechanism was formulated by ARPANET whichensures fault-tolerance due to its decentralised nature.

The data to be sent, will be divided into small packets, each consisting of a HEADERand a FOOTER information. For. e.g. a 10KB data can be broken into ten 1KB packets.

The HEADER will contain source computer (IP) Address, Destination Computer (IP)Address, CRC (Cyclic Redundancy Checksum), TTL (Time To Live), etc. . .

Page 36: School Gnu Linux

4.5 IP Addressing 6

4.5 IP Addressing

To uniquely identify a computer in a network, a new addressing scheme was introducedcalled “IP Addressing”. According to this, each computer will be identified by a uniqueIP address made up of 32 bits. For simplicity, it is usually written in “Dotted DecimalNotation” where each octet in the IP address will be written in decimal form. For e.g.

11001010 00110110 00000110 00010100 is written as 202.54.6.20

IP Addresses are classified as follows:

IP Address Classification (IPv4)

Class-A: 0xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx

0####### %%%%%%%% %%%%%%%% %%%%%%%%

Class-B: 10xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx

10###### ######## %%%%%%%% %%%%%%%%

Class-C: 110xxxxx xxxxxxxx xxxxxxxx xxxxxxxx

110##### ######## ######## %%%%%%%%

Class-D: 1110xxxx xxxxxxxx xxxxxxxx xxxxxxxx

Class-E: 11110xxx xxxxxxxx xxxxxxxx xxxxxxxx

x - can be either 0 or 1

# - constitute Net Id.

% - constitute Host Id.

The different classes of IP addresses are discriminated by their MSB bits. Out of these,Class-E is reserved for future use and Class-D is meant for “Multicast Group Ids”. If wesend a packet to all the host in a network, then we will call it as broadcast. Instead if wesend only to a group of host within a network, then it is called multicast.

Each of the Class-A, B, & C addresses are further logically divided into two partsnamely, “Net id.” and “Host id.”. For e.g. consider,

202.54.6.20 - 11001010 00110110 00000110 00010100

since the address starts with MSB 110, it belongs to Class-C. In Class-C the first threeoctet with MSBs 110 will form the network id. and the last octet is the host id. Thereforethe net id is: 202.54.6 and 20 is the host id.

Page 37: School Gnu Linux

4.5 IP Addressing 7

4.5.1 More about IP Addresses

IP Addresses are issued by InterNIC (Inter Network Information Centre), a US basedNon-Profitable Organisation. Nowadays, countrywise agencies are also coordinating withInterNIC to get you the IP addresses.

The current IP Addressing that we are following is called IPv4 (IP Version 4) whichuses 32 bit IP addresses. At first instance, you may think that we are having a large IPaddr. space.

232 = 4294967296 IP addresses. But in reality, due to the nature of IP Address classi-fication we can only use the following IP addresses:

IPv4 Address Space

Class-A: 0.0.0.0 to 127.255.255.255

Class-B: 128.0.0.0 to 191.255.255.255

Class-C: 192.0.0.0 to 223.255.255.255

Class-D: 224.0.0.0 to 239.255.255.255

Class-E: 240.0.0.0 to 247.255.255.255

Thus, we are actually having < 232 IP Addr. Further Class-E addr. are reserved forfuture use and Class-D is meant for “Multicast Group Ids.”. Therefore for any practicalusage we are left with Class-A, B and C IP Address space. After the introduction of WorldWide Web (WWW) in 1990’s by Tim Berners Lee, the growth rate of number of hosts onInternet started becoming exponential. Unfortunately the IPv4 address classification arenot planned appropriately to tackle the enormous growth rate of various capacity networkson Internet.

To understand the Net id., consider a University Network. If it want to put a server ineach dept. and connect all the departments with Internet, it may easily need 150 to 200IP addresses approximately. Instead of getting individual IP addr. eachtime we introducea new server, it is good to get a Class-C (the nearest match) Net Id. like 202.54.7.0.For a given Class-C net id. you can connect a maximum of 254 hosts. For e.g. let ustake 202.54.7.0 - Class-C Network Id. (imaginary) representing the Univ. N/W. To thisnetwork, now we can connect a max.of 254 hosts with IP addr. from:

202.54.7.1 to 202.54.7.254

All one’s (binary) in the host portion of a Net Id. is a special IP address called “NetDirected BROADCAST IP Address”. Thus in our case, 202.54.7.255 is the Broadcast IPAddr. for the Univ. N/W. Any packet with this IP addr. as destination will reach all thehosts in the Univ. N/W (Hence the name Broadcast).

Given an IP address, to extract the network id. from it, “netmask” are used. For e.g.to extract the net id. portion from a Class C address, say 202.54.6.20, we need to do abinary AND operation with the first 24 most significant bits. Remember in Class-C, thefirst 24 MSBs will form the network id. Let us work out an example.

Page 38: School Gnu Linux

4.6 Domain Name System (DNS) 8

Private Network Ids.

Class-A: (1 network id) 10.x.x.x

Class-B: (16 network ids) 172.16.x.x to 172.31.x.x

Class-C: (256 network ids) 192.168.0.x to 192.168.255.x

Example: Calculating the netmask

Class-C IP address: 202.54.6.20 --> 11001010 00110110 00000110 00010100

Netmask for Class-C: 255.255.255.0 --> 11111111 11111111 11111111 00000000

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

AND operation result: 202.54.6.0 --> 11001010 00110110 00000110 00000000

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

To obtain the netmask for a given IP address, count the number of bits which formsthe network id.. Then netmask can be obtained by writing that many number of binaryones starting from the first MSB and leaving the remaining bits as binary zeroes.

Due to the exponential growth of Internet, IP addresses started exhausting drastically.Within few years from now, we don’t have any more addresses available in IPv4. To solvethis problem, the Internet Engineering Task Force (IETF) came up with a new version ofInternet Protocol called IPv6. IPv6 addresses are 128 bits wide and won’t be exhausted inthe foreseeable future. The transition to IPv6 will take considerable amount of time andwill happen slowly. Several mechanism are being proposed for IPv4 & IPv6 interoperabilitytill the whole world changes to IPv6. In the mean time, to prevent the quick exhaustionof IPv4 addresses, IP subnetting and CIDR (ClassLess Inter Domain Routing) techniquesare introduced.

IP addresses are globally unique. That means, no two host on the Internet will havethe same IP address. But in real life, we may need to have private networks within theorganisation. Depending upon the organisation policy, these private network may or maynot be merged with the Internet in the future. In IPv4, it is not possible to assign a uniqueIP address to each and every host on the Planet. Thus the following network ids. arereserved for private networking purpose.

Anybody can use the above addresses, to setup their own private networks. On Internetyou will never find these IP addresses; if you – then your router is not configured properly.

4.6 Domain Name System (DNS)

To easily remember the IP addresses, a new scheme called “Domain Name System” (DNSin short) was introduced. According to DNS, each IP address will be assigned an uniquename called Domain Name. For e.g., the domain name of 202.54.6.20 is:

IP Addr: 202.54.6.20 <==> md2.vsnl.net.in (Domain Name)

Page 39: School Gnu Linux

4.6 Domain Name System (DNS) 9

IP Addr. follows Left to Right hierarchy whereas the DN follows Right to Left hierarchy.The Domain Names can be made up of two or more words separated by dot. e.g. domainnames are:

www.mitindia.edu

www.comp.nus.edu.sg

ftp.gnu.org

chn.vsnl.net.in

For Administrative and maintenance purposes, a set of Top Level Domains (TLD) wereintroduced.

DNS - Top Level Domains (TLD)

/ (root)

|

|-----|-----|------|-----|------|-------|------|-----------|----------|

.com .net .org .mil .gov .int .edu .arpa (countrywise)

| .in

| .jp

| .de

| (etc.)

Organisational Classification

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

.com - commercial domain

.net - networking companies

.org - non-profitable organisations

.mil - military (US only)

.gov - government (US only)

.int - international organisations

.edu - educational institutions

.arpa - a special domain (more about this later)

(More domains may be added in future like .store, .per etc..,)

Countrywise Classification

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

.in - India

.jp - Japan

.de - Germany

Page 40: School Gnu Linux

4.7 TCP/IP Layers 10

.ru - Russia

.sg - Singapore

.my - Malaysia

etc..,

It is the job of the Network Administrator to maintain a server called DNS server ineach network. The DNS server will maintain a table of Domain Name & IP Address Pairs ofall the hosts in that network. Normally the ISPs (Internet Service Provider) will maintainatleast two DNS servers namely Primary and Secondary (for backup purpose). DNS as awhole is a distributed database. No single host on the Internet will maintain the DN, IPAddress pairs of all hosts exists on the Internet.

4.7 TCP/IP Layers

To standardise the networking protocols, the ISO (International Standardisation Organi-sation) cameup with a generic protocol model called “OSI Reference Model”. OSI standsfor Open System Interconnection. In a typical OSI reference Model, a protocol can berepresented by 7 layers whereas in TCP/IP actually there are only 4 layers. RememberTCP/IP came into existence much before OSI Model and hence became a defacto standardfor Internetworking. In TCP/IP Application Layer take care of the job of Presentation &Session Layer if needed & Link Layer partly take care of the job of Physical Layer.

Note: Some authors may logically represent the Physical Layer function as the fifthLayer in TCP/IP Model.

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

7 Layer - OSI Model 4 Layer - TCP/IP Model

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

(7) * Application Layer * Application Layer

(6) * Presentation Layer "

(5) * Session Layer "

(4) * Transport Layer * Transport Layer

(3) * Network Layer * Network Layer

(2) * Data Link Layer * Link Layer

(1) * Physical Layer "

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

The logical structure of the TCP/IP layers can be represented as shown in the figure.This figure was taken from RFC#1180 and slightly modified to include ICMP and IGMP.

4.8 Network Interface Card (NIC)

To connect each host to the network, we need a network interface card (NIC). Dependingon the technology used at Data Link layer like Ethernet, IBM Token Ring etc. . . We canhave a variety of network interface cards. However ethernet technology is most popular

Page 41: School Gnu Linux

4.8 Network Interface Card (NIC) 11

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

| network applications |

| |

|... \ | / .. \ | / ...|

| ----- ----- |

| |TCP| |UDP| |

| ----- ----- |

| \ / |

| -------- |

| (ICMP)-| IP |-(IGMP) |

| ----- -*------ |

| |ARP| | (RARP) |

| ----- | / |

| \ | / |

| -------------- |

| | ETHERNET | |

| ---@---------- |

----------|-----------------

|

----------------------o---------

Ethernet Cable

Figure: Basic TCP/IP Network Node

ACRONYMS USED:

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

ftp: file transfer protocol

SNMP: Simple Network Management Protocol

DNS: Domain Name System

TCP: Transmission Control Protocol

UDP: User Datagram Protocol

ICMP: Internet Control Message Protocol

IGMP: Internet Group Management Protocol

ARP: Address Resolution Protocol

RARP: Reverse Address Resolution Protocol

Examples:

* Application Layer: ftp, SNMP, telnet, DNS, etc..,

* Transport Layer: TCP, UDP

* Network Layer: IP (ICMP, IGMP)

* Link: Ethernet (ARP, RARP)

Page 42: School Gnu Linux

4.9 Routing 12

and is used by the vast majority of LANs. Thus the NIC that uses Ethernet is commonlycalled as Ethernet Card. Each ethernet card comes with its own address called “HardwareAddress or MAC Address” which consists of 6 bytes (48 bits) represented in Hexa ColonNotation. Here is an e.g. of a MAC address:

00:E0:00:5A:D1:2A

4.9 Routing

If you want to connect your host to more than one network – say, three network, then youwill need three ethernet card to connect to the three networks. Thus, a host may containmore than one ethernet card. Such a host is called a “multi-homed” host. Sometimes, youwant to pass data from one network to another network. For such a situation, you canuse a multi-homed host by configuring the host to forward data between a pair of ethernetcards. Such a host is called a Router. Thus all routers are essentially a multihomed hostbut the reverse may not be true.

In a network, to reach a particular destination, there may be more than one path. Tofind out the optimum path, routers may use “Routing Algorithms”. In a small networkwhere the network topology rarely change, we can use fixed (static) routes. But for a largenetwork, we need to use dynamic routing algorithms to update the routing table as soonas the route changes are detected.

4.10 Relation between IP Address and MAC address

Infact the IP address is the logical address assigned to the NIC, since TCP/IP can identifya NIC, only by an IP address. But to transfer the data, NIC use only the hardwareaddress. So a translation mechanism called ARP was invented to translate the IP addressinto the coressponding MAC address. Sometime, given a MAC address we need to knowthe corresponding IP address. For this another protocol called RARP was introduced.

4.11 Data Flow from End-to-End

Assume that you are sending an email. Email uses a protocol called SMTP (Simple MailTransfer Protocol) to deliver the email to the remote host. SMTP comes under ApplicationLayer. The data will be passed to TCP (Transport Layer). TCP will split the data intosmall units. It will add TCP header information to each unit. Now this unit of data alongwith TCP Header is called a TCP-Segment. TCP sends it to IP (Network Layer). IP willadd its own header information to the TCP-Segment. The unit of TCP-Segment alongwith the IP Header is called an IP-Datagram. IP sends the Datagram to Ethernet (LinkLayer). Ethernet will add its own header information to the IP-Datagram. The unit ofIP-Datagram along with the Ethernet Header is called an Ethernet-Frame.

Now, TCP may receive data from one or more applications. To identify each one ofthem uniquely it will use a number called PORT number (16-bit). Using 16-bit we canhave port no. from 0 to 65535. Ports are classified as well-known ports (used by servers- ranging from 0 to 1023) and ephemeral ports (used by clients - greater than 1023). The

Page 43: School Gnu Linux

4.12 Note on RFCs/STDs/FYIs/BCPs 13

assignment of port numbers is handled by IANA (Internet Assigned Numbers Authority).A single server may provide more than one services each distinguished by the port number.For e.g. a server can provide ftp (Port#21), http (Port#80), telnet (Port#23) all at thesame time. Thus a TCP Connection is identified by 4 parameters:

{Source IP Address, Source Port Number, Destn. IP Address, Destn. Port Number}

(IP Address, Port Number) pair is also called as SOCKET. Thus each TCP connectioncan be uniquely identified by two sockets: source socket and destination socket. Remembera SOCKET identifies one end of a TCP connection.

IP may receive data from one or more sources like TCP, UDP, ICMP, IGMP etc. . .To distinguish each one of them it uses a unique number called protocol number [8-bitprotocol field in the IP Header]. In Unix machine you can find the protocol numbers in/etc/protocols file. For e.g. the value of protocol number for TCP is 6 and that of UDPis 17.

Ethernet may receive data from one or more sources like IP, ARP, RARP etc. . . Todistinguish each one of them it uses a unique number called frame type [16-bit frame typefield in Ethernet Header].

Thus, at the remote end, the Ethernet receive the frame, check its frame type anddemultiplex the datagram to either IP/ARP/RARP. If IP receives the datagram, basedon the 8-bit protocol field, it demultiplex the data to either TCP/UDP/ICMP/IGMP. IfTCP receives the data, based on the 16-bit port number, it demultiplex the data to thecorresponding application.

ICMP, IGMP make use of IP Datagram Delivery Service & ARP, RARP make use ofEthernet for sending ARP/RARP packets. Thus IP may receive data from TCP/UDP/ICMP/IGMP(other sources are also possible, but that is not important here).

4.12 Note on RFCs/STDs/FYIs/BCPs

The official standards in the Internet commmunity are published as “Request for Com-ments” (RFC) documents. However not all RFCs are official standards and they are justavailable for informational purposes. The RFCs which are officially announced as stan-dards are also called as STDs. As of this writing, more than 3200 RFCs are available.RFCs are numbered from 1 and you can download it from several mirror sites on Internet.One of them is http://www.ietf.org/rfc.html. Apart from RFCs, “For Your Informa-tion” and “Best Current Practices” documents are also very valuable. The details aboutemerging technologies, associated problems and experience are also published as “Inter-net Drafts”. You can obtain all the RFCs/STDs/FYIs/BCPs and Internet Drafts fromhttp://sunsite.cnlab-switch.ch/ftp/doc/standard/.

5 Setting up a small network

Understanding the theory of networking will be more perfect only if we do some experi-ment with the real networks. So let us create a mini private network with just two host.

Page 44: School Gnu Linux

5 Setting up a small network 14

GNU/Linux supports a wide variety of Ethernet Cards. If you have the Ethernet Cardin your computer, most distribution will automatically detect it during installation andinclude the appropriate driver modules. We just need to configure the ethernet cards withappropriate IP addresses. The ethernet card will be automatically assigned the device name“eth0” by the kernel. If you have more than one ethernet card in a host, then the remainingwill be assigned with the device name eth1, eth2, etc. . . respectively. Whether you haveethernet card or not, by default all the host will be configured for local loopback interface.There is no any real hardware associated with loopback device. It is just a software in-terface. Those who don’t have real network interface card, can make use of this softwareloopback interface. The kernel will assign the device name “lo” for this interface. By de-fault all the GNU/Linux distribution will configure the local loopback interface with theIP address 127.0.0.1. Theoretically you can use any of the 127.x.x.x. To view/modify theconfiguration of an interface we can use the “ifconfig” command. First do a “man ifconfig”.

bash-2.05# ifconfig lo

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

UP LOOPBACK RUNNING MTU:16436 Metric:1

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

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

collisions:0

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

We can find out whether a interface is alive or not by using the “ping” command. It willsend ICMP ECHO REQUEST message to the destination host. If the destination host isalive, it will respond with an ICMP ECHO REPLY message. Upon receiving the responsefrom the destination host, ping will print the round trip time.

bash-2.05# ping -c1 127.0.0.1

PING 127.0.0.1 (127.0.0.1) from 127.0.0.1 : 56(84) bytes of data.

64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=1.763 msec

--- 127.0.0.1 ping statistics ---

1 packets transmitted, 1 packets received, 0% packet loss

round-trip min/avg/max/mdev = 1.763/1.763/1.763/0.000 ms

The option -c1 tells the ping command to send just one ICMP ECHO REQUESTmessage.

Let us give the name feynman1 and ramanujan2 to our host respectively. Using the“hostname” command, you can set/view the hostname.

1Feynman is a Nobel Laurette in Quantum Electrodynamics. Feynman lectures in Physics are world

famous2Ramanujan is a great Indian mathematician and considered as a genius in number theory.

Page 45: School Gnu Linux

5 Setting up a small network 15

bash-2.05# hostname feynman

bash-2.05# hostname

feynman

bash-2.05#

To distinguish both the host, let us change the command prompt to reflect the usernameand hostname. The command prompt is stored under the environment variable name PS1(“man bash” for more details). Here \ u represent username, \ h represent hostname, \ Wrepresent current working directory.

bash-2.05# export PS1="[\u@\h \W]# "

[root@feynman root]#

You execute similar commands in the other host with the hostname “ramanujan”. Noneof the settings you did will exist once you reboot the computer. To make the configurationpermanent you need to include the configuration commands in the system startup script.On Redhat 7.x machines, these scripts are located under the directory /etc/rc.d/. It maybe under different directory in other distributions. At any given time, all UNIX systemswill be in one of the several possible runlevels. Redhat 7.x systems uses the following setof runlevels:

0 - halt (Do NOT set initdefault to this)

1 - Single user mode

2 - Multiuser, without NFS (The same as 3, if you do not have networking)

3 - Full multiuser mode

4 - unused

5 - X11

6 - reboot (Do NOT set initdefault to this)

You can set the default runlevel in the /etc/inittab file. For e.g. the line:

id:3:initdefault:

will set the default runlevel as 3. During bootup, first the system initialisation will be doneusing the script in /etc/rc.d/rc.sysinit. Then depending upon the runlevel, severalinitialisation scripts will be started by /etc/rc.d/rc with runlevel as argument. You canchange the runlevel at anytime using the init <runlevel>. If you hate doing everythingon command line, you can use the “linuxconf” utility to do most of the settings withoutbothering about the various configuration filenames. linuxconf will need root previlege.Hackers will do everything on command line :-)

We can configure the ethernet cards using “ifconfig”. To run the command you willneed root previlege. So login as root (or use su - ) and type the following command:

[root@feynman root]# ifconfig eth0 192.168.1.1 netmask 255.255.255.0

[root@feynman root]# ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:E0:00:5A:D1:2A

Page 46: School Gnu Linux

5.1 DNS Settings 16

inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

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

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

collisions:0

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

The output shows the interface is UP and running. To shutdown a interface you canuse “down” option (e.g. ifconfig eth0 down).

Similarly you can configure the host “ramanujan” with the IP address 192.168.1.2. Nowwe can try to ping ramanujan from feynman:

[root@feynman root]# ping 192.168.1.2

connect: Network is unreachable

What happenned? We have not yet connected both the hosts physically using a ethernetcable. You need a piece of CAT-5 UTP (UnTwisted Pair) Ethernet Cable for each host,crimped on the both ends with a RJ-45 connector. You need one more device called a HUB(or a switch) to complete the network. A HUB is nothing but a electronic repeater. It willsimply repeat the incoming data from a port to all the other ports. You can find 8-port,16-port, 24-port hubs in the computer store. Connect one end of the cable to the ethernetcard and other end to one of the ports in the HUB. Repeat the same for the other host.Now that the circuit is complete, you can ping ramanujan/feynman from each other.

[root@feynman root]# ping -c1 192.168.1.2

PING 192.168.1.2 (192.168.1.2) from 192.168.1.2 : 56(84) bytes of data.

64 bytes from 192.168.1.2: icmp_seq=0 ttl=255 time=1.566 msec

--- 192.168.1.2 ping statistics ---

1 packets transmitted, 1 packets received, 0% packet loss

round-trip min/avg/max/mdev = 1.566/1.566/1.566/0.000 ms

Congrats! You have successfully setup a TCP/IP network in GNU/Linux.

5.1 DNS Settings

For small network with very few hosts, we don’t need a separate DNS server. Instead we canuse the /etc/hosts file to store the IP addr. and domain name pairs. During installation,by default the entry for localhost will be added. Remember localhost refers the loopbackinterface.

[root@feynman root]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost

[root@feynman root]#

Page 47: School Gnu Linux

5.2 Installing Client/Server programs 17

Now add the IP address <TAB> hostname for the hosts ramanujan and feynman inboth the systems.

[root@feynman root]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost

192.168.1.1 feynman

192.168.1.2 ramanujan

[root@feynman root]#

Also add the following line in the /etc/nsswitch.conf which tells the order the DNSresolver will try to resolve the hostname (Most probably this line will be already there bydefault).

hosts: files dns

The above line tells the DNS resolver, to look for the file /etc/hosts first and then theDNS server.

From now onwards, you can simply use the hostname instead of specifying the IP addressin most of the commands. If you have Internet access through a appropriate gateway in yournetwork, then you need to set the domain name server entries in the file /etc/resolv.conf.A sample /etc/resolv.conf file will look like:

[mksarav@hanuman mksarav]$ cat /etc/resolv.conf

domain comp.nus.edu.sg

nameserver 137.132.90.2

search comp.nus.edu.sg

In the above e.g. the line “nameserver 137.132.90.2” represent the first name server thatthe system will use for any DNS query. You can add optional second and third entries ifyou want. The line “domain comp.nus.edu.sg” tells you that the example host (hanuman)belongs to the “comp.nus.edu.sg” domain.

5.2 Installing Client/Server programs

One way of installing whatever client and server programs you want is just select “Every-thing” option during the GNU/Linux Installation. It may be the good way for a beginner,but ultimately it is always good to compile a software from the source code.

RedHat comes with a package installation and management system called “RedHatPackage Manager (RPM)” where each package filename ends with a .rpm extension. Toinstall a .rpm package:

rpm -ivh <packagename.rpm>

Page 48: School Gnu Linux

5.2 Installing Client/Server programs 18

e.g.

rpm -ivh telnet-server-0.17-20.rpm

rpm -ivh telnet-0.17-20.rpm

To upgrade a package use the -U option like:

rpm -Uvh wu-ftpd-2.6.1-18.rpm

rpm -Uvh ftp-0.17-12.rpm

To get a list of all packages installed in your system use:

rpm -qa | less

To uninstall (erase) a package use the -e option like:

rpm -e anonftp-4.0-9

To compile a software from the source code (.tar.gz), mostly you will need to perform thefollowing steps:

1. login as root (or su -)

2. cd /usr/local/src

3. tar -zxvf path/package.tar.gz

4. cd package

5. ./configure

6. make

7. make install

will install the binaries in /usr/local/bin.For example, let us install the packet sniffing utility called “ipgrab” following the above

method:

[mksarav@feynman mksarav]$ su -

Password:

[root@feynman root]# cd /usr/local/src

[root@feynman src]# tar -zxvf /home/mksarav/download/ipgrab-0.9.8.tar.gz

[root@feynman src]# cd ipgrab-0.9.8/

[root@feynman ipgrab-0.9.8]# ./configure

[root@feynman ipgrab-0.9.8]# make

[root@feynman ipgrab-0.9.8]# make install

Installing and upgrading software packages with out any conflict is an art. For a thor-ough understanding of various methods of software installation and other details kindlyrefer the following HOWTOs:

• Software-Building-HOWTO

• Software-Proj-Mgmt-HOWTO

Page 49: School Gnu Linux

5.3 Internet Services 19

• Software-Release-Practice-HOWTO

• RPM-for-Unix-HOWTO

• RPM-HOWTO

For the rest of the tutorial we will assume that all the necessary client and server programsare already installed in the system. We will only explain the basic configuration details.

5.3 Internet Services

A wide variety of Internet Services are available in GNU/Linux. Some of them are:

• Telnet (remote login)

• File transfer protocol (ftp)

• Secure Shell (ssh)

• Name Server (e.g. bind)

• Web Server (e.g. Apache)

• Mail Server (e.g. Sendmail, exim, qmail)

• SMB Protocol (e.g. Samba - to share files across WIN and GNU/Linux systems)

• finger

• discard

• echo

etc. . . To quickly go through the various possible services have a look at /etc/services

file. However all of the services listed in the file may not be available in your system. Theentries in /etc/services tell you the port number that the particular service will listenfor any incoming connection and the possible protocols (tcp/udp) that can be used.

Most of the network server programs can be run in two modes either as a standaloneprogram or invoked by the inetd daemon (inetd stands for Internet services daemon). Adaemon is nothing but a process running in the background. In the standalone mode,the server will be always running in the background and ready to serve for any incomingconnections. In case of inetd, whenever some incoming connections request for a particularservice, it will be lauched by the inetd daemon. In most of the UNIX systems, the inetdconfiguration will be in the file /etc/inetd.conf. However in Redhat 7.x systems, ithas been put in a separate directory /etc/xinetd.d (xinetd stands for Extended Internetservices). Here is an excerpt from the xinetd man page:

. . . xinetd performs the same function as inetd: it starts programs that provide Internetservices. Instead of having such servers started at system initialization time, and be dormantuntil a connection request arrives, xinetd is the only daemon process started and it listens

Page 50: School Gnu Linux

5.4 Telnet 20

on all service ports for the services listed in its configuration file. When a request comes in,xinetd starts the appropriate server. Because of the way it operates, xinetd (as well as inetd)is also referred to as a super-server. The services listed in xinetd’s configuration file can beseparated into two groups. Services in the first group are called multi-threaded and theyrequire the forking of a new server process for each new connection request. The new serverthen handles that connection. For such services, xinetd keeps listening for new requestsso that it can spawn new servers. On the other hand, the second group includes servicesfor which the service daemon is responsible for handling all new connection requests. Suchservices are called single-threaded and xinetd will stop handling new requests for themuntil the server dies. Services in this group are usually datagram-based. So far, the onlyreason for the existence of a super-server was to conserve system resources by avoiding tofork a lot of processes which might be dormant for most of their lifetime. While fulfillingthis function, xinetd takes advantage of the idea of a super-server to provide features suchas access control and logging. Furthermore, xinetd is not limited to services listed in/etc/services. Therefore, anybody can use xinetd to start special-purpose servers. . . . ”

The /etc/xinetd.conf file will include the scripts in /etc/xinetd.d. You can en-able/disable a particular service from the configuration file for that service under the di-rectory /etc/xinetd.d. You can start/stop/restart the xinetd service using the script/etc/rc.d/init.d/xinetd.

[root@feynman root]# /etc/rc.d/init.d/xinetd <start>|<restart>|<stop>

5.4 Telnet

Telnet is the good old protocol, to connect and work in a remote system. To connect tothe remote system, the telnet server must be running on the remote system. To enable thetelnet server you need to change the line

disable = yes

to

disable = no

in the file /etc/xinetd.d/telnet. Restart the xinetd daemon using:

[root@feynman root]# /etc/rc.d/init.d/xinetd restart

Stopping xinetd: [ OK ]

Starting xinetd: [ OK ]

[root@feynman root]#

Now you can telnet to feynman from ramanujan. Follow similar steps in the hostramanujan to telnet from feynman.

[root@feynman root]# telnet ramanujan

Trying 192.168.1.2...

Connected to ramanujan (192.168.1.2).

Escape character is ’\^]’.

Page 51: School Gnu Linux

5.5 ssh 21

Red Hat Linux release 7.2 (Enigma)

Kernel 2.4.7-10 on an i686

login:

5.5 ssh

Telnet has been in wide spread use for almost two decades now. However, it has a potentialsecuirty problem. Both the data and password transmitted over the network are cleartext. That means, any intermediate node on the network can sniff the telnet packets andcrack down your password. To avoid this potential problem, most of the installation startedswitching over to the secure shell (ssh) instead of telnet. “ssh” encrypts all traffic (includingpasswords) to effectively eliminate eavesdropping, connection hijacking, and other network-level attacks.

OpenSSH is a FREE version of the SSH protocol suite. Additionally, OpenSSH providesa myriad of secure tunneling capabilities, as well as a variety of authentication methods.The OpenSSH suite includes the ssh program which replaces rlogin and telnet, scp whichreplaces rcp, and sftp which replaces ftp. Also included is sshd which is the server side ofthe package, and the other basic utilities like ssh-add, ssh-agent, ssh-keygen and sftp-server.OpenSSH supports SSH protocol versions 1.3, 1.5, and 2.0. You can download openssh fromhttp://www.openssh.org.

You can run “sshd” as a standalone daemon. As a root user start the sshd using

[root@ramanujan root]# /etc/rc.d/init.d/sshd start

Starting sshd: [ OK ]

[root@ramanujan root]#

A typical ssh session will look like:

[mksarav@feynman mksarav]$ ssh mksarav@ramanujan

The authenticity of host ’192.168.1.2 (192.168.1.2)’ can’t be established.

RSA key fingerprint is 71:ca:ad:00:93:0f:10:f8:7b:65:ef:cd:86:17:4d:e7.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added ’192.168.1.2’ (RSA) to the list of known hosts.

[email protected]’s password:

Last login: Tue Jan 22 14:44:01 2002

[mksarav@ramanujan mksarav]$

“ssh” comes with lot of other utilities. For more details kindly refer the manual pages.

5.6 File Transfer Protocol: ftp

“ftp” is a widely used Internet file transfer program, to transfer the files between differenthosts.

In Redhat 7.x system, by default the ftp server is disabled and if you try to access itwill show the following error message:

Page 52: School Gnu Linux

5.6 File Transfer Protocol: ftp 22

[mksarav@ramanujan mksarav]$ ftp feynman

ftp: connect: Connection refused

ftp> quit

[mksarav@ramanujan mksarav]$

To enable the ftp server you need to change the line

disable = yes

to

disable = no

in the file /etc/xinetd.d/wu-ftpd. Restart the xinetd daemon using:

[root@feynman root]# /etc/rc.d/init.d/xinetd restart

Stopping xinetd: [ OK ]

Starting xinetd: [ OK ]

[root@feynman root]#

Now you can ftp to feynman from ramanujan.

[mksarav@ramanujan mksarav]$ ftp 192.168.1.1

Connected to 192.168.1.1.

220 feynman FTP server (Version wu-2.6.1-16) ready.

530 Please login with USER and PASS.

530 Please login with USER and PASS.

KERBEROS_V4 rejected as an authentication type

Name (192.168.1.1:mksarav): mksarav

331 Password required for mksarav.

Password:

230 User mksarav logged in.

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> help

Commands may be abbreviated. Commands are:

! cr mdir proxy send

$ delete mget sendport site

account debug mkdir put size

append dir mls pwd status

ascii disconnect mode quit struct

bell form modtime quote system

binary get mput recv sunique

bye glob newer reget tenex

case hash nmap rstatus trace

ccc help nlist rhelp type

cd idle ntrans rename user

Page 53: School Gnu Linux

5.7 Web service 23

cdup image open reset umask

chmod lcd passive restart verbose

clear ls private rmdir ?

close macdef prompt runique

cprotect mdelete protect safe

ftp> quit

221-You have transferred 0 bytes in 0 files.

221-Total traffic for this session was 315 bytes in 0 transfers.

221 Thank you for using the FTP service on feynman.

[mksarav@ramanujan mksarav]$

Follow similar steps in the host ramanujan to ftp from feynman.

scp

Similar to telnet, ftp also send everything including your password as plain text on thenetwork thus creating a major security problem. Nowadays most of the organisationsstarted using the “scp” program that comes as a part of “ssh”.

[mksarav@feynman mksarav]$ scp file1.dat mksarav@ramanujan:

mksarav@ramanujan’s password:

file1.dat 100% |*****************************| 3041 00:00

[mksarav@feynman mksarav]$

The above command will copy the file1.dat file in feynman to the host ramanujan underthe home directory of user mksarav. Don’t forget to type the colon at the end.

5.7 Web service

Web service is provided by the “httpd” daemon. There are many free and commercial webserver programs are available. However, the “Apache” web server is very popular and isavailable freely under the GNU GPL License. To start the web service:

[root@ramanujan /]# /etc/rc.d/init.d/httpd start

Starting httpd: [ OK ]

[root@ramanujan /]#

Now, if you type http://ramanujan from feynman, you will see the test page for theApache Web Server. From where this file came? In Redhat 7.x, you can put all your files in/var/www/html. By default there will a /var/www/html/index.html which contains thetest page that you saw. You can modify this file as you want. If you want to use any cgiscripts using perl or python or whatever language you choose, then you have to put yourscripts in the /var/www/cgi-bin/ directory.

By default, the httpd daemon will listen at port 80, for any incoming HTTP request.You change many of the default settings in the file /etc/httpd/conf/httpd.conf.

Many commercial sites, will host more than one website on the same server. Further forproviding webservice on Internet, you have to get a proper global IP address and register

Page 54: School Gnu Linux

5.8 Samba 24

+---------------------+

| SMB |

+---------------------+

| TCP/IP |

+---------------------+

Figure: SMB (CIFS) implementation in WIN-2K and later versions

your domain name. You also need to add an DNS entry either with a commercial DNSservice provider or you can run your own DNS server also. Only then your hostname willbe resolved to the appropriate IP address from any part of the world. Explaining all thesedetails is beyond the scope of this tutorial.

5.8 Samba

Samba is a set of tools originally written by Andrew Tridgell to share the resources suchas disk and printers between UNIX and Windows hosts. IBM and Sytec developed aproprietary network system called “PC-Network” to share files between various PCs on asmall LAN. This PC-Network used a small device driver known as NetBIOS (Network BasicInput/Output System). PC-Network came with its own proprietary hardware later beingreplaced by Ethernet. Lots and lots of software was written for use with the NetBIOS API(Application Programming Interface). Several vendors implemented the NetBIOS API ontop of protocols such as IPX/SPX, and TCP/IP. NetBIOS over TCP/IP is often called NBTand has become the preferred NetBIOS transport. The workings of NBT are described inRFC#1001 and RFC#1002 (collectively known as Internet STD#19).

In the early 1980’s, Intel and Microsoft came up with a protocol called SMB (ServerMessage Block) which was designed to run PC-Network LAN using the NetBIOS API tosend and receive packets.

+---------------------+

| SMB |

+---------------------+

| NetBIOS |

+---------------------+

| TCP/IP |

+---------------------+

Figure: SMB implementation before WIN 2000

Microsoft used this in DOS, Win 3.1/9x. In Windows 2000, They modified the SMB proto-col to run directly over the TCP/IP. However they maintained the backward compatibility.For later versions of SMB, Microsoft started using the name CIFS (Common Internet FileSystem).

Page 55: School Gnu Linux

5.8 Samba 25

The main services of NetBIOS/TCP-IP are:

• Name Service

• Datagram Distribution Service

• Session Service

NetBIOS uses a name to identify each host on the network. Remeber NetBIOS names arenothing to do with Domain Name System and the whole thing happenned much before theDNS was invented. The NBT Name Service keeps track of which names are in use at whichIP addresses, thus allowing the underlying IP network to find the nodes and transportNetBIOS messages between them. The Name Service runs on UDP port 137 whereas theDatagram Service (connectionless) and Session service (connection-oriented) runs on port138 and 139 respectively.

[mksarav@feynman mksarav]$ grep netbios /etc/services

netbios-ns 137/tcp # NETBIOS Name Service

netbios-ns 137/udp

netbios-dgm 138/tcp # NETBIOS Datagram Service

netbios-dgm 138/udp

netbios-ssn 139/tcp # NETBIOS session service

netbios-ssn 139/udp

[mksarav@feynman mksarav]$

In Windows, NetBIOS Name Service is handled by WINS (Windows Internet Name Ser-vice). Again don’t confuse this with the DNS. Both are different though the job is similar.If you sent a query like “Hey, who is the host NEWTON?” – then the WINS server willsend a reply with the corresponding IP address.

Samba is the best known and most popular open source implementation of SMB (CIFS).Whatever resources like disks, printers etc. . . that you can share with other hosts in thenetwork are called SMB SHARES. There are four basic things one can do with Samba:

1. Share a GNU/Linux drive with WIN machines.

2. Access an SMB share with GNU/Linux machines.

3. Share a GNU/Linux printer with Windows machines.

4. Share a WIN printer with GNU/Linux machines.

The smbd and nmbd daemons in the Samba package provides the necessary service. Thelater provides the NetBIOS nameserver support to clients. In Redhat 7.x systems, you canstart the samba services using:

[root@feynman root]# /etc/rc.d/init.d/smb start

Starting SMB services: [ OK ]

Starting NMB services: [ OK ]

[root@feynman root]#

Page 56: School Gnu Linux

5.8 Samba 26

The whole Samba service is controlled by the settings in the /etc/samba/smb.conf file.There are too many options that you can use in smb.conf file which can’t be covered inthis tutorial. For this tutorial let us assume, you have WINDOWS in the host ramanujan.You reboot the host ramanujan into WINDOWS and configure it with the same TCP/IPsettings as it was in GNU/Linux. For simplicity, let us use the same hostname ramanujanfor the WINDOWS computer name. Further you should have installed the Files and

Printer Sharing for Microsoft Networks. You can do this from Control Panel →Network Connections → Local Area Connections. If you don’t know how to do this,ask a local WINDOWS Guru.

Accessing GNU/Linux home directory from WINDOWS

Let us explain the working of samba with a simple smb.conf file:

[mksarav@feynman mksarav]$ cat /etc/samba/smb.conf

[global]

workgroup = mks

interfaces = 192.168.1.1/24

encrypt passwords = yes

smb passwd file = /etc/smbpasswd

[homes]

guest ok = no

read only = no

The generic settings and the one which applies to all the SMB shares are done under the[global] section. Here we are creating a workgroup called “mks” and asking samba to usethe interface 192.168.1.1. The /24 is to indicate the network id. Further we are forcingsamba to use encrypted password and use the /etc/smbpasswd file instead of /etc/passwd.The [homes] section tells that no guest login is allowed and only users with valid accountin the GNU/Linux machine is allowed to login.

Since we asked to use /etc/smbpasswd file, first we need to create Samba username andpassword. We can do this using:

[root@feynman root]# touch /etc/smbpasswd

[root@feynman root]# smbadduser mksarav:mksarav

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

ENTER password for mksarav

New SMB password:

Retype new SMB password:

Added user mksarav.

If there is no file called /etc/smbpasswd initially then touch /etc/smbpasswd will createa empty file. The command smbadduser mksarav:mksarav tells the mapping between theusername in /etc/passwd and Samba username. Here we want to use the same username inboth. Since we have changed the configuration details, we have to restart the smbd daemon.

Page 57: School Gnu Linux

5.8 Samba 27

[root@feynman root]# /etc/rc.d/init.d/smb restart

Shutting down SMB services: [ OK ]

Shutting down NMB services: [ OK ]

Starting SMB services: [ OK ]

Starting NMB services: [ OK ]

[root@feynman root]#

Samba package comes with its own set of utilities like smbclient, smbstatus, smbpasswd,smbprint, smbmount, smbumount etc. . . to access SMB/CIFS resources on servers. smbclientis a ftp-like client to access SMB/CIFS resources. Let us first check whether we are ableto access the home directories in the host feynman, using smbclient. i.e. we are essentiallytesting Samba from the same host.

[mksarav@feynman mksarav]$ smbclient -L feynman

added interface ip=192.168.1.1 bcast=192.168.1.255 nmask=255.255.255.0

Password:

Anonymous login successful

Domain=[MKS] OS=[Unix] Server=[Samba 2.2.1a]

Sharename Type Comment

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

homes Disk

IPC$ IPC IPC Service (Samba 2.2.1a)

ADMIN$ Disk IPC Service (Samba 2.2.1a)

Server Comment

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

FEYNMAN Samba 2.2.1a

Workgroup Master

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

MKS FEYNMAN

[mksarav@feynman mksarav]$

The -L option allows you to look at what services are available on a server. When it ask forpassword just press enter. The output shows there is a SHARE called “homes” availableon this server. Let’s see whether we are able to access this share.

[mksarav@feynman mksarav]$ smbclient //feynman/homes -U mksarav

added interface ip=192.168.1.1 bcast=192.168.1.255 nmask=255.255.255.0

Password:

Domain=[MKS] OS=[Unix] Server=[Samba 2.2.1a]

smb: \> help

ls dir du lcd cd

pwd get mget put mput

Page 58: School Gnu Linux

5.8 Samba 28

rename more mask del open

rm mkdir md rmdir rd

prompt recurse translate lowercase print

printmode queue cancel quit q

exit newer archive tar blocksize

tarmode setmode help ? history

!

smb: \>

The -U option tells the SMB username. The SMB service name is specified with //NetBIOS

hostname/SMB share name. Here the NetBIOS hostname of the system is feynman andthe SMB share name is homes. The smb: \> interface will exactly look like ftp interfaceand you can get/put the files from/to the mksarav home directory. So far we have beentesting everything from the same host.

Let us see what WINDOWS Network Neighbourhood (or from My Network places)shows. Remember you should have enabled the settings NetBIOS over TCP/IP in theTCP/IP properties of the host ramanujan (now booted with WINDOWS). The NetworkNeighbourhood will now show a workgroup called “Mks”. If you double click it, it will showsomething like:

Samba 2.2.1a (Feynman)

If you double click Feynman, then it will prompt you for a username/password. Here i havelogin with my username “mksarav” (smbusername) and my password (smbpassword). Nowyou will see something like:

homes

mksarav

Printers and Faxes

Here both the shares homes and mksarav represent the home directory of the user mksaravin the host feynman. Now you can do anything with this share just like another windowsfolder.

Alternatively, you can also access the SMB service directly from the Internet Explorerbrowser by typing \\computername\sharename.

Accessing WINDOWS shared folder from GNU/Linux

Let us share the folder C:\MP3> in the host ramanujan and try to access it from feynman.Right Click the folder MP3 in ramanujan, you will see sharing and security options. Inthat enable the Share this folder option and give the share name as MP3. This processmight be slightly different depending upon whether you are using WIN9x/WIN2K. If youare in doubt, you can ask any local WIN expert.

Now, we can try to access this share from the GNU/Linux host feynman.

[mksarav@feynman mksarav]$ smbclient -L ramanujan -U Administrator

Page 59: School Gnu Linux

5.8 Samba 29

added interface ip=192.168.1.1 bcast=192.168.1.255 nmask=255.255.255.0

Got a positive name query response from 192.168.1.2 ( 192.168.1.2 )

Password:

Domain=[WORKGROUP] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

Sharename Type Comment

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

IPC$ IPC Remote IPC

mp3 Disk

Server Comment

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

RAMANUJAN

Workgroup Master

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

MKS FEYNMAN

WORKGROUP RAMANUJAN

[mksarav@feynman mksarav]$

[mksarav@feynman mksarav]$ smbclient //ramanujan/mp3 -U Administrator

added interface ip=192.168.1.1 bcast=192.168.1.255 nmask=255.255.255.0

Got a positive name query response from 192.168.1.2 ( 192.168.1.2 )

Password:

Domain=[WORKGROUP] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

smb: \> ls

. D 0 Thu Feb 14 21:44:12 2002

.. D 0 Thu Feb 14 21:44:12 2002

Collections D 0 Thu Feb 14 21:51:40 2002

new D 0 Wed Feb 20 23:24:02 2002

57175 blocks of size 262144. 44733 blocks available

smb: \> quit

[mksarav@feynman mksarav]$

In a big network, mostly you will find a WINS server running. In that case, you caninclude the option wins server in /etc/samba/smb.conf. Here is the file I use to accessmy university network SMB shares. For security reason the IP address has been blankedwith x.

[global]

workgroup = mks

interfaces = 137.132.x.x/x

encrypt passwords = yes

smb passwd file = /etc/smbpasswd

wins server = 137.132.x.x

Page 60: School Gnu Linux

6 Network Troubleshooting Utilities 30

[homes]

guest ok = no

read only = no

Here is how i will access my university network:

[mksarav@hanuman mksarav]$ smbclient -W nusstf -L nts27 -U dcssmk

Password:

Here the option -W is used to mention the DOMAIN.Sharing the printers is not covered in this tutorial but i will add it in a later version of

this tutorial. For more information on SMB you can read SMB-HOWTO and also go throughhttp://www.samba.org. At samba site, you will find lot of documentation.

6 Network Troubleshooting Utilities

A variety of network troubleshooting utilites are availble for GNU/Linux. In this section,we can see some of the essential utilities.

6.1 ping

The most commonly used utility to find out whether a host is alive or not is the “ping”.We saw how to do this in Sec.5 on page 12. Some of the useful option with ping are:

-R This option will set the RECORD ROUTE option in the ECHO REQUEST packet.When you use this option it will show the IP addresses of the intermediate routers thatthe packet is traversing. Since all these extra details are stored in the IP optionalheader space, at the maximum it can display only nine such routes. You can usetraceroute instead of this.

-s Specifies the number of data bytes to be sent. The default is 56. Thus the size of theoutgoing IP packet will be 20 (IP header) + 8 (ICMP header) + 56 = 84 data bytes.

-f Flood ping. Outputs packets as fast as they come back or one hundred times per second,whichever is more. This option will be very much useful for doing some performancemeasurements. For every ECHO REQUEST sent a period “.” is printed, while forevery ECHO REPLY received a backspace is printed. This provides a rapid displayof how many packets are being dropped. Only the super-user may use this option.This will create excessive traffic on a network and should be used with caution.

Go through the man pages for more details and some of the pitfalls of ping.

6.2 tcpdump

If you want to see how the real packets will look like on the network, then tcpdump is yourfriend. It prints out the headers of packets on a network interface. You can specify whichpackets you want to see. A variety of boolean expression can be mentioned to filter and

Page 61: School Gnu Linux

6.3 ipgrab 31

see particular types of packets. The most commonly used option is -i to tell tcpdump tocapture the packets from that particular interface. Let us ping ramanujan from feynmanand see the tcpdump output. In one of the console you run the tcpdump -i eth0 icmp

command as root and from other console you do ping -c1 ramanujan.

[root@feynman root]# tcpdump -i eth0 icmp

tcpdump: listening on eth0

16:09:58.134196 feynman > ramanujan: icmp: echo request (DF)

16:09:58.134354 ramanujan > feynman: icmp: echo reply

136 packets received by filter

0 packets dropped by kernel

[root@feynman root]#

The icmp option above will tell tcpdump to show only the ICMP packets.Some of the useful options are:

-s With this option you can specify a particular number of bytes of data to be collectedfrom each packet rather than the default of 68.

-w You have to mention a file name so that the raw packets will be written to that filerather than parsing and printing them out on the console. They can be later printedwith the -r option.

Don’t underestimate the use of tcpdump. You can do a variety of troubleshooting usingit. W. Richard Stevens has used this tool extensively for his book TCP/IP Illustrated- Vol.I.

6.3 ipgrab

ipgrab is similar to tcpdump but much more user friendly. It will print out the packet head-ers in plain ASCII output if you want. Here is the “ipgrab” output of the ping -c1 feynman:

[root@ramanujan root]# ipgrab -ieth0 icmp

ipgrab 0.9.8

Listening on device eth0 (ethernet)

**************************************************************************

Ethernet (1014193584.000364)

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

Hardware source: 00:60:97:db:8d:96

Hardware destination: 00:90:27:90:e6:6b

Type / Length: 0x800 (IP)

Media length: 98

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

Page 62: School Gnu Linux

6.3 ipgrab 32

IP Header

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

Version: 4

Header length: 5 (20 bytes)

TOS: 0x00

Total length: 84

Identification: 0

Fragmentation offset: 0

Unused bit: 0

Don’t fragment bit: 1

More fragments bit: 0

Time to live: 64

Protocol: 1 (ICMP)

Header checksum: 46681

Source address: 192.168.1.2

Destination address: 192.168.1.1

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

ICMP Header

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

Type: 8 (echo request)

Code: 0

Checksum: 51972

Identifier: 23832

Sequence number: 0

**************************************************************************

Ethernet (1014193584.000527)

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

Hardware source: 00:90:27:90:e6:6b

Hardware destination: 00:60:97:db:8d:96

Type / Length: 0x800 (IP)

Media length: 98

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

IP Header

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

Version: 4

Header length: 5 (20 bytes)

TOS: 0x00

Total length: 84

Identification: 24552

Fragmentation offset: 0

Unused bit: 0

Don’t fragment bit: 0

More fragments bit: 0

Time to live: 255

Page 63: School Gnu Linux

6.4 netstat 33

Protocol: 1 (ICMP)

Header checksum: 55152

Source address: 192.168.1.1

Destination address: 192.168.1.2

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

ICMP Header

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

Type: 0 (echo reply)

Code: 0

Checksum: 54020

Identifier: 23832

Sequence number: 0

6 packets received

0 packets dropped by kernel

ARP: 0

IP: 2

ICMP: 2

IGMP: 0

UDP: 0

TCP: 0

IPX: 0

GRE: 0

IPv6: 0

ICMPv6: 0

OSPF: 0

RSVP: 0

AH: 0

ESP: 0

You can download ipgrab from http://ipgrab.sourceforge.net. First go throughthe manual pages which is available on the same site.

6.4 netstat

netstat will print network connection details, routing tables, interface statistics, and otherdetails. You will appreciate the output of netstat if you know how the TCP/IP protocolswork.

6.5 traceroute

Using the ping -R option you can’t see much about the routes that a packet traverseto reach the destionation host. However traceroute will provide you the details of each

Page 64: School Gnu Linux

6.6 tracepath 34

intermediate router that the packet traverse. However the packet need not has to go throughthe same route each time.

[mksarav@hanuman mksarav]$ /usr/sbin/traceroute mksarav.tripod.com

traceroute to mksarav.tripod.com (209.202.196.70), 30 hops max, 38 byte packets

1 gw6509a-81a.comp.nus.edu.sg (137.132.81.6) 0.571 ms 0.474 ms 0.435 ms

2 115-19.priv.nus.edu.sg (172.18.115.19) 0.668 ms 0.696 ms 0.640 ms

3 core-pgp-vlan143.priv.nus.edu.sg (172.18.20.129) 0.711 ms 0.739 ms 0.703 ms

4 core-cc-vlan21.priv.nus.edu.sg (172.18.20.5) 0.735 ms 0.685 ms 0.651 ms

5 svrfrm1-cc-vlan165.priv.nus.edu.sg (172.18.20.90) 0.993 ms 0.786 ms 0.808 ms

6 gk-pix-f1-821.nus.edu.sg (137.132.3.130) 2.383 ms 3.507 ms 5.626 ms

7 165.21.48.101 (165.21.48.101) 178.774 ms 175.404 ms 184.515 ms

8 GE-1-1-0.bedok.singnet.com.sg (165.21.12.1) 183.482 ms 185.186 ms 185.768 ms

9 POS2-0.tp-core1.ix.singtel.com (202.160.250.53) 176.590 ms 178.955 ms 184.295 ms

10 POS0-1.above-core1.ix.singtel.com (202.160.250.34) 368.292 ms 363.799 ms 385.227 ms

11 POS2-0.paix-core1.ix.singtel.com (202.160.250.46) 379.003 ms 375.040 ms 377.120 ms

12 paix.exodus.net (198.32.176.15) 364.584 ms 374.864 ms 370.863 ms

13 bbr02-p3-0.sntc08.exodus.net (209.185.9.233) 383.027 ms 378.060 ms 376.887 ms

14 bbr01-p8-0.sntc04.exodus.net (206.79.9.186) 374.507 ms 369.439 ms 372.050 ms

15 bbr01-p1-0.ftwo01.exodus.net (209.185.9.110) 421.193 ms 417.206 ms 416.456 ms

16 bbr02-p3-0.ekgv01.exodus.net (206.79.9.54) 447.018 ms 437.996 ms 436.417 ms

17 bbr01-p2-0.okbr01.exodus.net (206.79.9.129) 433.585 ms 421.279 ms 436.054 ms

18 bbr02-p6-0.wlhm01.exodus.net (209.185.9.118) 448.084 ms 443.928 ms 442.889 ms

19 dcr03-g1-0.wlhm01.exodus.net (64.14.70.49) 451.590 ms 450.102 ms *

20 csr02-ve243.wlhm01.exodus.net (64.14.70.26) 447.934 ms * 455.011 ms

21 209.67.242.86 (209.67.242.86) 451.882 ms !X 447.694 ms !X 446.326 ms !X

[mksarav@hanuman mksarav]$

Find out from the man traceroute what the !X in the output means.

6.6 tracepath

tracepath traces path to a destination host discovering MTU (Maximum TransmissionUnit) along the path. This will help you to identify the bottleneck link in the path to adestination.

[mksarav@hanuman mksarav]$ /usr/sbin/tracepath www.bbc.co.uk

1?: [LOCALHOST] pmtu 1500

1: gw6509a-81a.comp.nus.edu.sg (137.132.81.6) 2.072ms

2: 115-19.priv.nus.edu.sg (172.18.115.19) 2.282ms

3: core-pgp-vlan143.priv.nus.edu.sg (172.18.20.129) 2.384ms

4: core-cc-vlan21.priv.nus.edu.sg (172.18.20.5) 2.392ms

5: svrfrm1-cc-vlan165.priv.nus.edu.sg (172.18.20.90) 2.394ms

6: gk-pix-f1-821.nus.edu.sg (137.132.3.130) 5.078ms

7: 165.21.48.101 (165.21.48.101) 181.171ms

8: GE-1-1-0.bedok.singnet.com.sg (165.21.12.1) asymm 9 173.820ms

9: POS2-0.tp-core1.ix.singtel.com (202.160.250.53) 174.541ms

10: POS1-0.tp-core2.ix.singtel.com (202.160.250.150) 384.624ms

11: POS2-0.paix-core1.ix.singtel.com (202.160.250.46) 393.607ms

12: 198.32.176.151 (198.32.176.151) 392.192ms

Page 65: School Gnu Linux

7 Before THE END 35

13: rt0-POS3-0.sjc.bbc.co.uk (212.58.255.173) 396.120ms

14: rt1-S2-1.111ny.bbc.co.uk (212.58.255.169) 486.564ms

15: rt0.111ny.bbc.co.uk (212.58.255.137) 488.105ms

16: rt0-POS5-0.thny.bbc.co.uk (212.58.255.41) 477.914ms

17: www2.thny.bbc.co.uk (212.58.240.32) asymm 18 487.517ms reached

Resume: pmtu 1500 hops 17 back 18

[mksarav@hanuman mksarav]$

The above output shows that you can’t send a packet with size > 1500 to reach the desti-nation. If you exceed this limit, the IP packet will get fragmented into smaller packetsize (< 1500). Let us see the effect with an example. Using ping -s option let usfirst ping the host www.bbc.co.uk with 1472 data bytes (so that the packet size will be1472+8+20=1500):

[mksarav@hanuman mksarav]$ ping -c2 -s1472 www.bbc.co.uk

PING www.bbc.net.uk (212.58.240.31) from 137.132.81.78 : 1472(1500) bytes of data.

1480 bytes from www1.thny.bbc.co.uk (212.58.240.31): icmp_seq=0 ttl=238 time=457.837 msec

1480 bytes from www1.thny.bbc.co.uk (212.58.240.31): icmp_seq=1 ttl=238 time=456.507 msec

--- www.bbc.net.uk ping statistics ---

2 packets transmitted, 2 packets received, 0% packet loss

round-trip min/avg/max/mdev = 456.507/457.172/457.837/0.665 ms

Now let us repeat the experiment with 1473 data bytes (packet size now will be 1473+8+20=1501):

[mksarav@hanuman mksarav]$ ping -c2 -s1473 www.bbc.co.uk

PING www.bbc.net.uk (212.58.240.31) from 137.132.81.78 : 1473(1501) bytes of data.

--- www.bbc.net.uk ping statistics ---

2 packets transmitted, 0 packets received, 100% packet loss

[mksarav@hanuman mksarav]$

Why it shows 100% packet loss? In the IP header there is a bit called “Don’t fragmentbit” to tell the intermediate routers not to fragment the packet. ping sends all the packetswith the “Don’t fragment” bit set in the IP header but unfortunately the first host MTUis 1500 and it needs to fragment the packet. But ping told not to fragment it. So it willsimply discard the packet.

7 Before THE END

You may also go through the basic GNU/Linux exercises by the author at http://mksarav.tripod.com. This entire tutorial is prepared using LATEXwith vim editor. The first twodigrams were drawn using the GNU pic. I thank the entire Open Source and Free Soft-ware Community for providing a whole lot of tools and OS, completely free for the entirecommunity. Especially I am very much inspired by Donald E Knuth for his TEXand RMS(Richard M Stallman) for contributing his entire life for the Free Software.