Archive for March, 2009

USB SUSE Flash Drive install

Posted in How To's by Shafkat Shahzad, M.Sc on March 28th, 2009

This guide will cover the process of installing SUSE Linux to a USB flash drive using the OpenSUSE Live CD. Please note that due to the limited number of write functions a flash drive can handle before going bad, you may reduce the life of your flash drive by performing this installation.

USB SUSE install Requirements
It is a good idea to note the USB SUSE install requirements as below:
• 4GB+ USB flash drive (Highly recommend the OCZ Rally 2 Turbo)
• OpenSUSE Live CD
• Portable SUSE conversion script

How to make a Portable SUSE:
It is important to note that before proceeding, backup all data you wish to save from your flashdrive. In addition, physically disconnect any internally attached hard drives to avoid the possibility of installing to the wrong device. If your flash drive contains a fat filesystem it will be shrunk and new partitions will be added for the SUSE OS (so you will still have a Windows accessible partition).

1. Download the Live CD KDE (685MB) ISO, burn to a CD and start your system from the
CD
2. Once SUSE is up and running, insert your USB flashdrive
3. When prompted that a new medium has been detected, select the option to Do
Nothing and check the box to Always do this for this type of media then click OK
4. Next, click the My Computer icon from your SUSE desktop
5. Locate your USB device from the Disk Information section on the page
6. Right click on the device and select Properties
7. From the Properties window that appear, click the Mounting tab
8. Uncheck the Mount automatically box and click OK
9. From the Disk Information section, right click on the device again and select to Safely
Remove
10. Now unplug and reinsert your flash drive.
11. You may be prompted again that a new medium has been detected, select the option
to Do Nothing and check the box to Always do this for this type of media then click OK
12. Next, start the installer via the install icon on your desktop and proceed to follow the
onscreen instructions. Once you get to the Live Installation Settings page, click
Partitioning
13. Next, from the Suggested Partitioning page, select the option to Base Partition Setup
on This Proposal and click Next
14. Now from the Expert Partitioner page, select your Fat Partition and click Resize

15. From the resize pop up window that appears, reduce the size of your windows
partition to around 200MB or less
16. In the pop up that appears click Yes to allow the Linux partiton to use the new empty
space
17. Next, Accept and continue the install. Once the installer has finished, reboot your
computer. Remove the CD from the drive and proceed to boot from the USB device
18. Continue the onscreen setup process… users and passwords etc.
19. Skip the Online Update Configuration step.
20. Once your up and running again, press alt+f2 and type konsolesu then press Enter
21. Type wget pendrivelinux.com/downloads/portablesuse.tar.gz
22. Type tar -zxvf *.tar.gz
23. Type ./installation and follow the onscreen instructions answering y to all of the
questions
24. Type reboot to reboot and ensure that everything is still working

You should now be able to run your Portable SUSE from any PC that can boot from a USB device. You can now re-attach any internal drives to your PC and run your Portable SUSE whenever and wherever you want.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

How to do Linux partition

Posted in How To's by Shafkat Shahzad, M.Sc on March 24th, 2009

Generally it is a good idea to allocate about 1GB (1,024MB) to the Linux partition (maybe more depending on your needs). A good size for your swap partition is to match your physical memory (RAM) or use 128MB, whichever is smaller.

The System column lists the type of partition (Linux Native, Linux Swap, Extended, or DOS/Windows). When installing Linux, you usually create an
Extended partition and add logical drives for the Linux Native and Linux Swap.
The Bootable column shows whether each partition is bootable. Bootable partitions are marked with an asterisk. Make sure that your Linux partition is marked as bootable and that no other partition is marked as bootable (use the Edit button to fix this).
The Mount Point column displays where in the UNIX (Linux) file system the partition will be “mounted.” Unlike Windows or DOS, which represent partitions as separate disks, Linux grafts (mounts!) a partition as a directory onto thE “root” or main partition. Ah, and because we are getting technical, you only can have one root partition. If you only have one partition, that partition will be the root partition by default.

The Format column lets you know if the partition will be formatted during th next step. Make sure existing partitions that have data you want to preserve an not formatted. Formatting a partition erases all its contents.

The buttons on the Partition Hard Disk panel perform the following tasks:

The Edit button allows you to change parameters on a partition—such as its start and end sectors (changing the partition’s size), the system type (type of partition), and such options as the mount point and bootable flags. You also can specify whether the partition should be formatted.

To create a new partition on your disk, use the Edit button. Note that you can specify the type of partition to create. Typically you’ll want to create a primary and a swap partition for Linux.

The delete button allows you to reset all settings on the selected partition. ) The Add Logical button creates a logical partition inside an extended partition. Logical partitions can be created only inside of extended partitions.

The Write button does what its name implies: It writes your partition changes to the disk.

The Reset button allows you to undo and revert to the partition settings you had prior to entering this screen.

Partition and Disk Device Names Under Linux
If you have an IDE disk system, Linux will refer to your disk devices as outlined here. /dev/hda is for the master device on the primary IDE channel. The slave device on the primary channel has the name /dev/hdb. The secondary IDE channel shows the names of /devlhdc and /devlhdd for the master and slave devices, respectively. Most IDE systems will have the hard disk as /dev/hda and the ATAPI CD-ROM drive as the secondary master device /dev/hdc.

If your system is SCSI, your devices will be shown as /dev/sda, /dev/sdb, and so on.
Partitions on the disks are shown by appending a number to the end of the device name starting with one. In other words, /dev/hdal refers to the first partition of the primary master device. A second partition on the same disk has the name of /dev/hda2, and so forth. Note that extended partitions begin numbering at 5 and count upwards from there regardless of the number of partitions in your
system.

How to create Linux partition
In order to create Linux partition:

1. If your disk has free space, select one of the Not Used partition identifiers and click Edit.

2. The panel that appears allows you to create a Linux, Swap, Extended, or DOS/Windows-type partition from the System Type popup menu. Leave the Start boundary as it is, but tweak the End boundary until the size of the partition is the size you want. Unless you already have more than two primary partitions, select the Linux option from the System Type and check the Bootable option. This creates a primary partition where you can install Linux. If you’d like to create an extended partition, set the System Type to Extended and go to the next step; otherwise skip to step 4.

3. If the space where you want to install Linux is inside of an extended partition, select the partition and click Add Logical. On the panel that appears, leave the Start boundary as it is, but tweak the End boundary until the size of the partition matches the type of install you want to perform. Check the Bootable option and set the System Type to Linux. Make sure your Windows partition is not bootable, or you won’t be able to start your computer because your computer BIOS won’t know what to do if it finds two bootable partitions. The fix for this is to use DOS FDISK and “reset” the active partition to your Linux or DOS partition.

4. To create the swap partition, you do as you just did in steps 2 or 3. If you want to allocate the swap space in a logical partition, repeat step 3. However, this time, select Swap as the System Type. Remember to allocate an amount of space matching your physical memory. If you have more than 128MB of RAM, allocate space for 128MB only. To allocate the swap space as a primary type partition instead of a logical partition, repeat step 2, selecting Swap as the System Type.

5. After you have defined your Linux and swap partitions, click Write. If you want to redo any of the settings, click Reset.

Partition Information
After defining your partitions, click Next to see the panel, where you’ll see where OpenLinux will be installed. If anything doesn’t look like what you specified, click the Back button to return to the previous screen and redefine your partitions. If you are happy with your settings, click Format Chosen Partitions. Formatting will take a while depending on the size and speed of your disk. When formatting is complete, click Next to proceed to the Select Installation panel.

The Partition Information panel
Click Format Chosen Partitions to format your new Linux partitions.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

Installing a WiFi (Wireless) Card in Kubuntu: Using ndisgtk and ndiswrapper

Posted in How To's by Shafkat Shahzad, M.Sc on March 22nd, 2009

In order to install WiFi (wirless) card in Kubuntu, we need to follow few simple steps. These steps are as mentioned below:
Step 1: Download the Driver
The very first step is to go to your wifi card’s manufacturers website, or your computer model’s drivers page and download the proper driver for your wifi card.
For example:
you can install a my wifi card for the R3000 series Compaq Presario Laptop and for that you can go to the HP support site and enter in the numbers on my computer. In this case you have a R3038CL. You entered that into the search engine on the HP support site, and viola, it will take you to your computer’s support page where you will be able to click on the “Download” section and download your wireless card’s driver.
Step 2: Get the Downloaded and Extracted Driver to Linux
Now this is a WINDOWS driver, so you can’t just double-click the .exe of the driver in Linux and hope it works… The easiest thing to do, if you are a Windows user (which you probably are if you are installing your wireless card from a windows machine.) is to download that file in Windows, then extract it (double-click on it and follow the instructions!) in Windows and either burn it on a CD or slap it on a thumbdrive. If you can’t do either of those, you can also put it on your C: drive and navigate to it on Linux by going to /media and finding your Windows hard drive. But don’t leave it there, you must copy it over to, say, your home folder (/home/username) or your Desktop (/home/username/Desktop).

Step 3: Using Adept. (Skip this if you are already adept at Adept.)
Okay, IF this is the first time you’ve installed anything on Kubuntu and IF you were not able to complete the installation while online (in other words you had to unplug your compy from the internet to get it to install), then there is one step that you MUST do.
Go to Adept in K>System>Adept and enter in you’re password when prompted.
Click on “Adept” (top left of the window) and then click on “Manage Repositories.” Make sure each “deb” and “deb-src” line is BLACK not GRAY. If they are gray, you must right-click on each “deb” and “deb-src” line and select “Enable”. Once you have enabled all of them, click “Apply” at the bottom of the window. Then click on “Fetch Updates” at the top of the window. Now it’s time to get the programs.

Step 4: Getting ndiswrapper and ndisgtk
You might find a few websites on how to use ndiswrapper and such, and they are good sites and very helpful, but… we have an easier way, ndisgtk! In your adept window search for ndisgtk. The nice thing installing ndisgtk using Adept is… it will automatically install ndiswrapper for you. After the search is complete, click on the little blue arrow beside ndisgtk, and then click “Request Install” and click “Apply” at the top of the window and watch the magic happen.

Step 5: Whew! Almost There: We must make one little change…
Now that you’ve installed it, go to K>System>Windows Wireless Drivers and right-click. Select “Edit Item.” This will bring up the “KDE Menu Editor”. On the right side where it reads “Command:” make sure the line beside it reads “kdesu /usr/bin/ndisgtk” The line might begin with “gksudo” and you must change it to “kdesu”.

Step 6: Install that Sucker (Driver)!
Bring up your “Windows Wireless Drivers” (K>System>Windows Wireless Drivers) Click on “Install New Drivers.” Navigate to your Windows driver folder (that we extracted earlier) and find the .inf file. (it will be something like “bcmwl5.inf”) Click on the .inf file and select “Open”. Now click “Install”. If all goes as planned you will see the ______.inf file and “Driver Present, Hardware Present.” (The scope of this tutorial will not cover what to do if you do not see the “Driver Present, Hardware Present” line)

Step 7: Possibly Optional
Least not Last… IF you have a Broadcom wifi card, (you will if you have a Compaq R3000 series Lappy like me) you must “blacklist” the default driver that Kubuntu comes with. This is a very simple, but necessary step.
Time for some Command Prompt-age… The easiest way I’ve found to do this is hit Alt+F2, type in “Konsole”, and hit enter. (or K>System>Konsole) Now type “sudo kate /etc/modprobe.d/blacklist”. You will be prompted for your password. When the file come up in the editor, scroll to the bottom and type on an empty line “blacklist bcm43xx” (without the quotes). Save it, and close it out. Restart your computer and you should get some hot wifi action! Woohoo!

A very nice wifi program that comes with your Kubuntu install is “Wireless Assistant.” (K>Internet>Wireless Assistant) You should be able to enter in your wireless settings and get up and running.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

Building a Linux Wireless Network without Access Point (AP) from the scratch

Posted in How To's by Shafkat Shahzad, M.Sc on March 22nd, 2009

Installing the Client Computer
The computer is a:
Pentium I 133Mhz
Hard disk= 1.2Gb
VGA=Trident 256Kb ISA
Ethernet= 3Com 509c ISA
Wireless= Conceptronic Airbridge 11iDT (PCI)
RAM=32 Mb
Floppy and CDROM 44x

First be sure to have the PCMCIA card inside the PCI.

Select on bios CDROM to BOOT, insert Red Hat linux CD 1 and power on

On the first menu type: text

Welcome to Redhat Linux press OK

Language selection: I’ll select Spanish

Keyboard: es

Mouse selection: None (I don’t have it)

Installation Type: Custom

Hard disk Partition: Disk Druid

Delete all the partitions and then create:
ext3 type partition on / size=1150Mb
swap type partition with the rest of diskspace= 72Mb (aprox RAMx2)
OK
now a screen asks me to use SWAP because of the low RAM size it has.
Choose OK
Boot Manager menu
Select to install GRUB on /dev/hda Master Boot Record (MBR)
Special parameters for the boot manager? no, just press OK

Boot Manager Configuration, the default is OK

Grub Password? I do not need it, but if you want, type in a password

Firewall configuration, choose No Firewall (you can setup it later)

Languages supported: English(UK)

Time Zone: UK

Root Password: Type whatever you want as a password

User add: add an user account (recommended)

Autentication Configuration: Default is OK (Shadow and MD5)

Packages selection:
Choose this:

Notebook support
Network support
Emacs
Utilities
Software development
Kernel development

Total Size=821Mb

Press OK

Now you will have to wait for the installation process.
You will only need Redhat 7.3 disks 1 and 2
Then you’ll be asked to create a boot floppy disk (a good idea)
Completed , press OK to reboot
the CD will be ejected and the machine rebooted
Kudzu (hardware detection utility) detects the 3com ethernet card I press Configure
Do you like to setup networking? yes
IP adress 192.168.0.12
Netmask: 255.255.255.0
Default Gateway (IP):
Primary Nameserver: 195.235.113.3
OK
The login screen will appear

Red Hat Linux release 7.3 (Valhalla)
Kernel 2.4.18-3 on an i586

localhost login:

login as root and type the password you set.

Now we will install a ssh server to login remotely, this is optional (because the computer is not near)
insert CD number 2 and mount it:
mount /mnt/cdrom
cd /mnt/cdrom/Redhat/RPMS/
ls *ssh*
and install the ssh server
rpm -Uvh ssh-server….rpm
cd /
and umount it
umount /mnt/cdrom

now ssh server will be launched when you reboot, but to enable right now type:
/etc/init.d/sshd start

now from another linux computer on the network:
ssh root@192.168.0.12
to login remotely as root

Let’s continue. Seting up the wireless card:
chmod 744 /etc/pcmcia/config.opts

use now your favorite text editor:

emacs /etc/pcmcia/config.opts
go to the bottom and type:

card “Conceptronic Wireless”
version “802.11″, “11Mbps Wireless LAN Card”
bind “orinoco_cs”

Save (Ctrl+X,Ctrl+S) and exit (Ctrl+X,Ctrl+C)
Another file must change is:

chmod 744 /etc/pcmcia/wireless.opts

emacs /etc/pcmcia/wireless.opts

Go to the bottom and search for:

# Generic example (describe all possible settings)
*,*,*,*)

and modify with this fields like this:

*,*,*,*)
INFO=”Wireless Client Configuration”
ESSID=”sorgonet.com”
MODE=”Managed”
RATE=”auto”
CHANNEL=”1″
# La clave se pone si es encriptada
KEY=”"
;;

Save and Exit.
What does it mean:
INFO put whatever you want
ESSID is the ID for the wireless which is defined you the Access Point you connect to.
MODE Managed is to use it like a client
RATE auto is the speed
KEY is used for encripted connections the password comes here (we don’t use it)

Now must create this file:
emacs /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
MODE=managed
ESSID=”sorgonet.com”
RATE=auto
TXPOWER=auto
KEY=”" # Only for encrypted connections
BOOTPROTO=static
IPADDR=10.0.0.2
NETMASK=255.0.0.0
ONBOOT=yes
GATEWAY=10.0.0.1
Save and Exit

Now its time to reboot
reboot

login again as root and to check it type iwconfig and ifconfig:

[root@localhost root]# iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

eth1 IEEE 802.11-DS ESSID:”sorgonet.com” Nickname:”localhost.localdomain”
Mode:Managed Frequency:2.422GHz Access Point: 44:44:44:44:44:44
Bit Rate:2Mb/s Tx-Power=15 dBm Sensitivity:1/3
Retry min limit:8 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0/92 Signal level:134/153 Noise level:134/153
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

[root@localhost root]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:20:AF:5A:5A:1D
inet addr:192.168.0.12 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:127 errors:0 dropped:0 overruns:0 frame:0
TX packets:95 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:12347 (12.0 Kb) TX bytes:12349 (12.0 Kb)
Interrupt:5 Base address:0×220

eth1 Link encap:Ethernet HWaddr 00:50:C2:01:97:19
inet addr:10.0.0.2 Bcast:10.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:4 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:512 (512.0 b)
Interrupt:11 Base address:0×100

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:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)

[root@localhost root]#

Now we can install also wavemon to see the signal strength

wget -c ftp://rpmfind.net/linux/contrib/libc6/i386/wavemon-0.3.3-1.i386.rpm
rpm -Uvh wavemon-0.3.3-1.i386.rpm
wavemon to run it (but we have first to be connected to an Access Point to recieve data.

route add default gw 10.0.0.1 dev eth1

Installing a Linux Access Point (wireless card in Master mode)

The PC is:
Pentium I 75Mhz
HD= 4.3Gb
RAM= 64Mb
VGA= S3 Trio
Ethernet= ISA 3Com c509
Wireless= Conceptronic Airbridge 11iDT (PCI)
CDROM 44x
First: Enter the BIOS setup utility and choose:
No floppy disk, Boot from CDROM and Halt on NO Errors. That’s because once all intalled, we won’t connect a keyboard nor a VGA card an do not wish to have Keyboard Not Found errors.

Then Insert first Red Hat 8.0 CD and select linux text.
Welcome to Red Hat linux, CD found, Media test, SKIP.
Welcome to Red Hat linux press OK.
Select Language, we choose English.
Select keyboard type: es (english)
Mouse Selection: no mouse OK
Installation type: Custom
Hard Disk Partition Configuration: Select Disk Druid
Delete all existing partitions and create one ext3 / and other swap
The hard disk is 4110Mb we choose:
3900Mb ext3 as /
The remaining space SWAP 211Mb
press OK.
Boot Loader Config: Choose GRUB.
Boot Loader additional parameters: just press OK (we dont need it)
Password for GRUB write one if you want.
Default boot loader configuration: Red Hat Linux /dev/hda1 OK.
Boot Loader install choose to install on MBR.
Firewall Configuration: None and OK.
Additional language to use on this system: English (English) OK.
Time zone: British Standard Time
Root Password: enter the password on both textbox and OK.
Add users: Add a user with his own password. OK.
Authentification Config: The Defaults are:
* Shadow passwords
* MD5 passwords
OK
Packages selection: We have 4Gb of disk space so, we installed more than we need.
* Administration tools
* Development Tools
* Editors
* FTP Servers
* Kernel Development
* Network Servers
* Server Configuration tools
* System Tools
* Text Based Internet
* Web Server
Total: 1183 Mb.
OK
A complete system log will be created. Press OK.

Now its time to wait… installation is copying files to your hard disk.
Change to CD disk 2 when requested.
Create a boot disk, since we have not floopy disk we don’t create it.
Congratulations, press OK
The CD-ROM will be ejected, remove it, the sistem will reboot.
We only used CD 1 and 2 of Red Hat linux.
The system will boot, and kudzu detects our ethernet card, we press Configure
Do you Like to setup networking? YES
Configure TCP/IP
IP adress 192.168.0.69
Netmask: 255.255.255.0
Default Gateway (IP): 192.168.0.1
Primary Nameserver: 195.235.113.3
OK

The login screen appears, login as user: root and your password.

Type setup and go to System Services

Unselect:
isdn
lpd
sendmail

and Select:
httpd
vsftpd

and quit, now reboot

This driver can be found here
http://hostap.epitest.fi/
The latest version can be downloaded: hostap-2002-09-12.tar.gz

wget -c http://hostap.epitest.fi/releases/hostap-2002-09-12.tar.gz
tar -zxvf hostap-2002-09-12.tar.gz
cd hostap-2002-09-12
now check for wireless-tools
rpm -qa |grep ‘wireless-tools’
it says that redhat 8.0 comes with lastest version wireless-tools-25-1 and it’s installed on our system. To check for newer versions, go to www.rpmfind.net and search for wireless.

cd /usr/src/
ln -s linux-2.4 linux
cd linux/configs
Here the .config files remains.
cp kernel-2.4.18-i586.config ../.config
cd /root/hostap-2002-09-12
make pccard
make install_pccard

chmod 644 /etc/pcmcia/config.opts
edit /etc/pcmcia/config.opts and add this lines at bottom:

card “Conceptronic Wireless”
version “802.11″, “11Mbps Wireless LAN Card”
bind “hostap_cs”

We can install bridge-utils package and this can be downloaded from:
http://bridge.sourceforge.net/bridge-utils/bridge-utils-0.9.6-1.i386.rpm
and also comes on Red Hat 8.0 CDs.

cd /root
wget -c http://bridge.sourceforge.net/bridge-utils/bridge-utils-0.9.6-1.i386.rpm
rpm -Uvh bridge-utils-0.9.6-1.i386.rpm
cd /etc/sysconfig/network-scripts/

emacs ifcfg-eth0
Leave only this lines:
DEVICE=eth0
IPADDR=192.168.0.69
NETMASK=255.255.255.0
BOOTPROTO=static
ONBOOT=yes
GATEWAY=192.168.0.1

Save and exit

emacs /etc/sysconfig/network-scripts/ifcfg-wlan0
Leave only this lines

DEVICE=wlan0
MODE=Master
ESSID=”sorgonet.com”
RATE=auto
TXPOWER=auto
KEY=”"
BOOTPROTO=static
ONBOOT=yes
/usr/bin/prism2_param wlan0 host_decrypt 1
IPADDR=10.0.0.1
NETMASK=255.0.0.0
NETWORK=10.0.0.0

Save and exit.

To Share the internet connection add this lines to rc.local:

emacs /etc/rc.d/rc.local

#Activate ip_forward
echo 1 > /proc/sys/net/ipv4/ip_forward
#Delete rules
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -F INPUT
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -F OUTPUT
/sbin/iptables -P FORWARD DROP
/sbin/iptables -F FORWARD
/sbin/iptables -t nat -F
#Apply new rules
/sbin/iptables -A FORWARD -i wlan0 -o eth0 -m state –state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT
/sbin/iptables -A FORWARD -j LOG
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Save and exit.

To install a DHCP server to assign IP address to clients follow the steps:
You can found the package on redhat 8.0 CDs dhcp-3.0pl1-9.i386.rpm
rpm -Uvh dhcp-3.0pl1-9.i386.rpm
setup
select System Services, and check DCHPD to run it automatically when system boots.

emacs /etc/dhcpd.conf

Put this lines:

option routers 10.0.0.1;
option domain-name-servers 195.235.113.3, 195.235.96.90;
subnet 10.0.0.0 netmask 255.0.0.0 {
range 10.0.0.100 10.0.0.250;
}
ddns-update-style ad-hoc;

Save and exit.

reboot

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

How to Install Windows Wireless Network Device Drivers in Ubuntu

Posted in How To's by Shafkat Shahzad, M.Sc on March 16th, 2009

NdisWrapper is effectively an open-source driver that allows Linux to use standard Windows XP drivers for wireless network devices. NdisWrapper can be described as being a translation layer between the Linux kernel and the Windows drivers, which can be installed using NdisWrapper’s configuration tools.
NdisWrapper should only be used in one of two situations:
• Your wireless network hardware simply isn’t recognized by Ubuntu, which is to say, all you see when you click the NetworkManager icon is a Manual Configuration option; you don’t see any wireless networks listed. Of course, you should first ensure that the wireless hardware in your computer is actually switched on - some notebooks offer the facility to deactivate it to save battery life.
• Your network hardware is recognized by Ubuntu but fails to work correctly or adequately when you configure it. Perhaps it is unable to associate with wireless base stations, for example, or maybe you can’t connect to WPA-enabled base stations and consider WEP too insecure for your surroundings. If this is the case, in addition to installing NdisWrapper, you’ll need to undertake an additional step in order to blacklist the existing Ubuntu driver.
Using NdisWrapper is relatively simple and just a handful of commands are required. However, getting hold of the necessary Windows driver files is harder work because, unfortunately, NdisWrapper isn’t designed to work with the usual method of driver distribution: .exe files. Instead, NdisWrapper needs the specific .inf and .sys files that constitute the driver - effectively, the Windows system files. These are contained within the .exe file and must be manually extracted.
NdisWrapper is far from perfect. Not all wireless devices have been proven to work with it, and it’s not necessarily the case that a driver available for Windows will work under Linux. Sometimes trial and error is required. Annoyingly, Windows drivers sometimes appear to work but then prove unreliable. Some might stop working. Some might even crash your system. The best plan is simply to give it a try.
In the instructions in this section, we explain how to make an Atheros AR5008 wireless network device that’s built into an Apple MacBook work under Ubuntu using NdisWrapper. The instructions remain essentially the same for all types of wireless network hardware. However, some specific details, such as download addresses, will obviously differ.
First, you’ll need to install the NdisWrapper software, and then you can install the necessary Windows drivers. These steps will make your wireless network device available under Ubuntu. Then you can follow the instructions in the previous section to connect to that wireless network.

Installing the NdisWrapper Configuration Tools
NdisWrapper consists of two components: a kernel module and configuration tools. The kernel module comes as part of the default kernel package, so is installed by default, but you will need to download and install the configuration tools manually.
You’ll be prompted to download these files. Save the files to a floppy disk or USB memory stick, or burn them to a blank CD-R/RW disk. Then, on the Ubuntu computer, copy the downloaded files to the desktop.
Next, open a terminal window (Applications > Accessories > Terminal), and type the following, which will install the new software:
cd ~/Desktop
sudo dpkg -i ndis*
You’ll need to enter your password when prompted. When the commands have finished, and you see the command prompt again, close the terminal window.

Installing the Windows XP Drivers
Once the NdisWrapper configuration software is installed, you can install the Windows XP wireless network device drivers. There are several parts to the procedure:
• Identify the wireless network hardware, and then source the appropriate Windows driver.
• Extract the necessary .sys and .inf files from the driver archive (and possibly .bin files, although this is rare).
• You may need to blacklist the built-in Ubuntu driver, so that NdisWrapper can associate with the hardware.
• Use the NdisWrapper configuration tool to install the Windows driver.
These steps are covered in the following sections. You will need another computer that’s already online to download some files and check the NdisWrapper web site for information. If your computer dual-boots, you can use your Windows setup to do this.

Identifying Your Wireless Network Hardware and Sourcing Drivers
To identify the wireless network hardware for use with NdisWrapper, it’s necessary to discover two pieces of information: the make and model of the hardware and the PCI ID number. The former is the make and model of the hardware, as identified by Ubuntu as a result of system probing, rather than what’s quoted on the packaging for the wireless network device or in its documentation. These details discovered by Ubuntu will usually relate to the manufacturer of the underlying components, rather than the company that manufactured the hardware. The PCI ID is two four-digit hexadecimal numbers used by your computer to identify the device internally. The same PCI ID numbering system is used by both Windows and Ubuntu, which is why it’s so useful in this instance.
You can find both the PCI ID and the make/model information using the Device Manager tool. Then follow these steps:
1) Select Applications > System Tools > Device Manager. In the left column, find the entry that reads Network Controller, Networking Wireless Control Interface, or WLAN Interface. You might also look for USB Interface, PCI Bridge, or 802.11 to exhaust your search. Then look at the corresponding summary in the right column, where you’ll find the make and model of the hardware listed under the Vendor and Model headings. If no useful details are listed, you might need to click the parent entry in the list. On one test system, we found the WLAN Interface entry, but saw the make and model details only after we clicked the Ethernet Controller parent entry in the list on the left.
2) Write down the make and model shown in Device Manager. For example, on a test notebook containing an Atheros wireless network device, the make and model read “AR5418 802.11abgn Wireless PCI Express Adapter”. Remember that these details don’t relate to those listed in the instruction manual or computer packaging (our notebook’s specification lists the hardware simply as “Built-in AirPort Extreme Wi-Fi”). This is because Ubuntu is identifying the hardware generically, reading information from its component hardware.
3) Click the Properties tab of Device Manager (if this isn’t visible, click View > Device Properties) and look through the information there for a line that begins info.udi. Look at the end of the line, and make a note of the two sets of characters that are separated by an underscore and preceded by pci_. Look at the image for an example taken from our test machine. Yours may differ, but the line should always end with pci_ and then the digits. If it doesn’t, you have selected the wrong entry in the list of devices on the left. Try examining a different entry, such as the parent of the entry in the list.
4) Write down the characters following pci_ at the end of the info.udi line. Written alongside each other, the two sets of digits that are separated by an underscore form the all-important PCI ID number. In written form, they’re usually separated by a colon. If either of the sets of letters or numbers is less than four characters long, simply add zeros before them in order to make four characters. For example, in the above image, the end of the info.udi line reads 168c_24. We add two zeros before 24, making a complete PCI ID of 168c:0024. On another test PC, the end of the line read 168c_13. Adding two zeros before the 13 gives a PCI ID of 168c:0013.
5) Using another computer that’s able to go online, visit. On the main menu, click Documents/Wiki, and then click the List of Cards Known to Work link. This is a community-generated listing of the wireless network devices that have been proven to work with NdisWrapper.
6) The “known to work” cards are grouped in alphabetical order. Select the appropriate list based on the card manufacturer’s name. (Remember to use the name you discovered using Device Manager in steps 1 and 2, and not the official name in the computer’s manual or packaging.)
7) Using the search function of your browser (Ctrl+F within Firefox), look for the PCI ID number you noted earlier, in the format described in step 4. For the example in the above image, we would search for 168c:0024. In the list, look to match the following things, presented in order of importance:
• The PCI ID
• The model name of the wireless hardware, as reported by Device Manager (listed on the Summary tab)
• The manufacturer and model of the notebook, as mentioned on its case or within its documentation
It’s likely many entries in the list may match your PCI ID, so search until you find the one that best matches the model of the hardware. If there are still many matches, search until you find an entry that matches the manufacturer and model of the notebook. You might not be lucky enough to find an exact match for the notebook manufacturer and model, however, and you might need to select the most likely choice. Use your common sense and judgment. If your notebook is manufactured by Asus, for example, but you can’t find the drivers for the exact model, then choose drivers for another Asus model.

Extracting the Driver Components
Once the drivers are downloaded, you’ll need to extract the .sys and .inf file relevant to your wireless network hardware. These are all that NdisWrapper needs, and the rest of the driver files can be discarded. However, extracting the files can be hard to do, because often they’re contained within an .exe file. (Most driver .exe files are actually self-extracting archive files.) Additionally, the driver file might contain drivers for several different models of hardware, and it’s necessary to identify the particular driver .inf file relevant to your wireless network device.
If the driver you’ve downloaded is a .zip file, then your task will probably be much easier. Simply double-click the downloaded .zip file to look within it for the directory containing the actual driver files.
If the driver is an .exe file, it’s necessary to extract the files within it. With any luck you might be able to do this using an archive tool like WinZip, assuming that you’ve downloaded the file using Windows. Simply open the archive using the File > Open menu option within WinZip. You may have to select All Files from the File Type drop-down list in order for the .exe file to show up in the file list. However, if you’re using Windows, we recommend an open-source and free of charge program called Universal Extractor, which can be downloaded from. This program can extract files from virtually every kind of archive, including most driver installation files. Once it is installed, simply right-click the installation .exe file, and select UniExtract to Subdir. This will then create a new folder in the same directory as the downloaded file, containing the contents of the installer file.
Once you’ve extracted the files within your downloaded driver file, look for the files you need. It’s likely those driver files will be contained in a folder called something like Driver or named after the operating system, like Win_XP. Once you’ve found the relevant directory, look for .inf, .sys, and .bin files (although you may not find any .bin files; they’re used in only a handful of drivers). You can ignore any other files, such as .cab and .cat files. Click and drag the .inf, .sys, and .bin files to a separate folder.
The task now is to find the .inf file for your hardware. If there’s more than one, you’ll need to search each until you find the one you need. You need to look for text that corresponds to the PCI ID you noted earlier. Open the first .inf file in a text editor (doubleclicking will do this in Windows), and using the search tool, search for the first part of the PCI ID, as discovered earlier. For the example in the image on the previous page, we would search for 168c. If you don’t find it within the file, move on to the next .inf file, and search again. When you get a search match, it will probably be in a long line of text and to the right of the text VEN_.
Then look further along that line to see if the second part of the PCI ID is mentioned, probably to the right of text that reads DEV_. In the case of the driver file we downloaded for the example, the entire line within the .inf file read as follows (the two component PCI ID parts are shown in bold):
%ATHER.DeviceDesc.0023% = ATHER_DEV_0023.ndi, PCI\VEN_168C&DEV_0024
If you find both component parts of the PCI ID in the line, as in this example, then you’ve found the .inf file you need. (In fact, you’ll probably find many lines matching what you need, which is fine.)
You must now transfer the .inf file, along with the .sys and .bin files (if any .bin files were included with the driver) to the computer on which you want to install the drivers. This can be done by putting them onto a floppy disk, by burning them onto CD, or by using a USB memory stick. Create a new directory called driver on the desktop and save them there.
Your procedure from this point depends on if Ubuntu recognized your wireless networking device when you first booted but was unable to make it work correctly. If it did then you will need to blacklist the built-in driver, so that NdisWrapper can associate with the hardware. If the device wasn’t recognized, you can skip straight to the “Using NdisWrapper to Install the Drivers” page.

Blacklisting Existing Drivers
To blacklist the existing built-in driver that didn’t work with your wireless device, you need to find out the name of the kernel module and then add it to the /etc/modprobe.d/ blacklist file. Here are the steps:
1) Open Device Manager (System > Administration > Device Manager), and select the entry in the list for your wireless network device. This is the one you discovered in steps 1 and 2 earlier, on the “Identifying Your Wireless Network Hardware and Sourcing Drivers” page.
2) Click the Properties tab (if this isn’t visible, click View > Device Properties), and look for the line that begins info.linux.driver. Then look in the value column, and make a note of what’s there. For example, on our test notebooks, the value column read rt2500usb. Close Device Manager.
3) Open a terminal window (Applications > Accessories > Terminal). Type the following to open the blacklist configuration file in the Gedit text editor:
gksu gedit /etc/modprobe.d/blacklist
4) At the bottom of the file, type the following on a new line:
blacklist modulename

Replace modulename with the name of the module you discovered earlier. For example, on our test system, we typed the following (as shown in the image):
blacklist rt2500usb
5) Save the file, and then reboot your computer.
You should now find that the wireless network device is no longer visible when you click the NetworkManager icon, and all you see is a Manual Configuration option. This is good, because it means the hardware no longer has a driver attached, and you can now tell NdisWrapper to use the hardware.

Using NdisWrapper to Install the Drivers
On the Ubuntu computer on which you wish to install the drivers, you should now have the .inf file from the previous steps, plus the .sys and possibly .bin files that constitute the driver. You should have copied these files from the removable storage device into a new folder on your desktop named driver.
It is important to note that if you have used a USB memory stick to transfer the files, it should appear automatically on the desktop as soon as it’s inserted. When you’ve finished with it, right-click the desktop icon, and select Unmount. You must do this before physically removing any kind of USB memory device, as explained later in this guide.
To install the driver using NdisWrapper, follow these instructions:
1) Click System > Administration > Windows Wireless Drivers. Enter your password when prompted.
2) Click the Install New Driver button.
3) The Install Driver dialog box appears, prompting you to select the .inf file for your wireless device. Click the Location drop-down list to open a file browsing dialog box.
4) Navigate to the .inf file you copied to your system, which you have placed in the driver folder on your desktop. Double-click the desktop folder, and then doubleclick the driver folder listed in the right column. Select the .inf file you copied in the driver folder and then click the Open button.
5) Back in the Install Driver dialog box, click the Install button.
6) At this point, you should see the driver listed at the left column of the Wireless Network Drivers dialog box. It specifies the name of the driver installed and whether the hardware is installed. If it says the hardware isn’t installed, you’ve probably selected the wrong .inf file, or might be using the wrong driver file. Return to the previous sections and try to get an alternative Windows driver.
7) No reboot is necessary and your wireless network card should work immediately. To test if the driver works, click the NetworkManager icon and see if there are wireless networks listed. If it works, click Close to exit the Wireless Network Drivers dialog box.
Following this, you should find the network device is available for configuration. Follow the earlier instructions for connecting to a wireless network.

Removing NdisWrapper Drivers
As mentioned earlier, although NdisWrapper can solve a lot of headaches with nonworking wireless hardware, it isn’t perfect. You might find that the Windows driver you install simply doesn’t work. In such a case, you can download a different version of the driver and try again. But first you’ll need to remove the existing driver.
Select Click System > Administration > Windows Wireless Drivers and enter your password when prompted. In the Windows Network Drivers dialog box, select the driver you want to remove in the left column and click Remove Driver. Click Yes when prompted to confirm the removal. Click Close to exit the tool.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

How to install Virtual box and run Windows XP from Ubuntu

Posted in How To's by Shafkat Shahzad, M.Sc on March 11th, 2009

Virtualbox is a virtualisation package for Linux originally developed by Sun Microsystems. It’s an incredibly powerful and easy way of being able to run Windows XP or Vista from Ubuntu. The last part of this guide will talk you through the process of installing Virtualbox, after which we’ll look at installing Windows XP. Running XP inside Ubuntu has so many benefits, like file compatibility, using active-x in internet explorer and lots more.
How is it done?
Installing Virtualbox is quite straightforward. There’s a simple process to follow to get up and running with your XP virtual machine. That process looks like this:
1) Install Virtualbox using Synaptic package manager
2) Add your user profile to the vboxusrs group so Virtualbox will work
3) Create a virtual machine in Virtualbox
4) Install Windows XP (from CD in this post) on your new virtual machine
5) Booting your virtual machine from the Windows XP installation CD
Installing Virtualbox using Synaptic Package Manager
Open Synaptic (System>Administration) - search for “virtualbox-ose” and install.
Add your user profile to the vboxusrs group
Once Virtualbox is installed, you’ll have to add your user profile to a group created by the install process called vboxusrs. Time to start using Terminal - here’s the command:
sudo adduser [your username]vboxusers
Create a virtual machine in Virtualbox
You’re now ready to start the application (Applications>System Tools>InnoTek VirtualBox) - here’s how it looks:
We’re going to create a new virtual machine called WinXP-2 so you can see the process from start to finish. There are about 8 steps to follow, begin by clicking the “New” button.
The virtual machine wizard dialogue. Click next to get started, give the new machine a name and select the type of OS you’re going to install.
Give the new machine a name and select the type of OS you’re going to install.
Create a “dynamically expanding image” - if you use up all the available space the disk image you’re creating will expand.
Now select the actual size of the image. This is how much virtual hard disk space you’ll have to play with when you first boot the machine. When you click next you’ll be given a summary of what’s happening so far.
You’re now taken to the Virtual hard disk dialogue and your new hard disk has been created and should display in the drop down. Click next. You’re given one final confirmation and that’s it, click finish.
Booting your virtual machine from the Windows XP installation CD
Clicking finish will take you back to the virtualbox user interface. Clicking “start” will initiate the first run wizard. There’s no need to use the wizard, actually it’s quite important to get used to the settings dialogue.
To be able to get your virtual machine booting from an XP install cd, we need to mount the CD/DVD drive. Click the settings button and you will see this window - click the CD/DVD-ROM tab.
Make sure you select the “Mount CD/DVD Drive” checkbox.
While you’re in the settings window, familiarise yourself with the different tabs. Particularly, “Network” - it’s worth taking a look and making sure that the “cable connected” check box is selected - which enables your new virtual machine to get an internet connection. When you’re done, click OK.
Finally, with the Windows XP installation CD in your drive, click the start button.
Once you’ve got XP completely installed, you might want to install the guest additions ISO, which will allow you a full screen resolution and a lot of compatibility between

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

Linux/Unix Command mount

Posted in How To's by Shafkat Shahzad, M.Sc on March 10th, 2009

All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree. Conversely, the umount (8) command will detach it again.
The standard form of the mount command, is

mount -t type device dir
This tells the kernel to attach the file system found on device (which is of type type) at the directory dir. The previous contents (if any) and owner and mode of dir become invisible, and as long as this file system remains mounted, the pathname dir refers to the root of the file system on device.
Three forms of invocation do not actually mount anything:
mount -h
prints a help message;

mount -V
prints a version string; and just

mount [-l] [-t type]
lists all mounted file systems (of type type). The option -l adds the (ext2, ext3 and XFS) labels in this listing.
Since Linux 2.4.0 it is possible to remount part of the file hierarchy somewhere else. The call is
mount –bind olddir newdir
After this call the same contents is accessible in two places. This call attaches only (part of) a single filesystem, not possible submounts. The entire file hierarchy including submounts is attached a second place using
mount –rbind olddir newdir
Since Linux 2.5.1 it is possible to atomically move a subtree to another place. The call is

mount –move olddir newdir
The proc file system is not associated with a special device, and when mounting it, an arbitrary keyword, such as proc can be used instead of a device specification. (The customary choice none is less fortunate: the error message `none busy’ from umount can be confusing.)
Most devices are indicated by a file name (of a block special device), like /dev/sda1, but there are other possibilities. For example, in the case of an NFS mount, device may look like knuth.cwi.nl:/dir. It is possible to indicate a block special device using its volume label or UUID (see the -L and -U options below).
The file /etc/fstab, may contain lines describing what devices are usually mounted where, using which options. This file is used in three ways:
(i) The command
mount -a [-t type] [-O optlist]
(usually given in a bootscript) causes all file systems mentioned in fstab (of the proper type and/or having or not having the proper options) to be mounted as indicated, except for those whose line contains the noauto keyword. Adding the -F option will make mount fork, so that the filesystems are mounted simultaneously.
(ii) When mounting a file system mentioned in fstab, it suffices to give only the device, or only the mount point.
(iii) Normally, only the superuser can mount file systems. However, when fstab contains the user option on a line, then anybody can mount the corresponding system.
Thus, given a line
/dev/cdrom /cd iso9660 ro,user,noauto,unhide
any user can mount the iso9660 file system found on his CDROM using the command
mount /dev/cdrom
or
mount /cd
Only the user that mounted a filesystem can unmount it again. If any user should be able to unmount, then use users instead of user in the fstab line. The owner option is similar to the user option, with the restriction that the user must be the owner of the special file. This may be useful e.g. for /dev/fd if a login script makes the console user owner of this device.
The programs mount and umount maintain a list of currently mounted file systems in the file /etc/mtab. If no arguments are given to mount, this list is printed. When the proc filesystem is mounted (say at /proc), the files /etc/mtab and /proc/mounts have very similar contents. The former has somewhat more information, such as the mount options used, but is not necessarily up-to-date (cf. the -n option below). It is possible to replace /etc/mtab by a symbolic link to /proc/mounts, but some information is lost that way, and in particular working with the loop device will be less convenient.
OPTIONS
The full set of options used by an invocation of mount is determined by first extracting the options for the file system from the fstab table, then applying any options specified by the -o argument, and finally applying a -r or -w option, when present.
Options available for the mount command:
-V
Output version.
-h
Print a help message.
-v
Verbose mode.
Mount all filesystems (of the given types) mentioned in fstab.
(Used in conjunction with -a.) Fork off a new incarnation of mount for each device. This will do the mounts on different devices or different NFS servers in parallel. This has the advantage that it is faster; also NFS timeouts go in parallel. A disadvantage is that the mounts are done in undefined order. Thus, you cannot use this option if you want to mount both /usr and /usr/spool.
Causes everything to be done except for the actual system call; if it’s not obvious, this “fakes” mounting the file system. This option is useful in conjunction with the -v flag to determine what the mount command is trying to do. It can also be used to add entries for devices that were mounted earlier with the -n option.
Add the ext2, ext3 and XFS labels in the mount output. Mount must have permission to read the disk device (e.g. be suid root) for this to work. One can set such a label for ext2 or ext3 using the e2label(8) utility, or for XFS using xfs_admin(8).
Mount without writing in /etc/mtab. This is necessary for example when /etc is on a read-only file system. Tolerate sloppy mount options rather than failing. This will ignore mount options not supported by a filesystem type. Not all filesystems support this option. This option exists for support of the Linux autofs-based automounter.
Mount the file system read-only. A synonym is -o ro.
Mount the file system read/write. This is the default. A synonym is -o rw.
Mount the partition that has the specified label.
Mount the partition that has the specified uuid. These two options require the file /proc/partitions (present since Linux 2.1.116) to exist.
-t vfstype
The argument following the -t is used to indicate the file system type. The file system types which are currently supported are: adfs, affs, autofs, coda, coherent, cramfs, devpts, efs, ext, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, ramfs, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs, xiafs. Note that coherent, sysv and xenix are equivalent and that xenix and coherent will be removed at some point in the future — use sysv instead. Since kernel version 2.1.21 the types ext and xiafs do not exist anymore.
For most types all the mount program has to do is issue a simple mount (2) system call, and no detailed knowledge of the filesystem type is required. For a few types however (like nfs, smbfs, ncpfs) ad hoc code is necessary. The nfs ad hoc code is built in, but smbfs and ncpfs have a separate mount program. In order to make it possible to treat all types in a uniform way, mount will execute the program /sbin/mount.TYPE (if that exists) when called with type TYPE. Since various versions of the smbmount program have different calling conventions, /sbin/mount.smb may have to be a shell script that sets up the desired call.
The type iso9660 is the default. If no -t option is given, or if the auto type is specified, the superblock is probed for the filesystem type (adfs, bfs, cramfs, ext, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, ntfs, qnx4, reiserfs, romfs, udf, ufs, vxfs, xfs, xiafs are supported). If this probe fails, mount will try to read the file /etc/filesystems, or, if that does not exist, /proc/filesystems. All of the filesystem types listed there will be tried, except for those that are labeled “nodev” (e.g., devpts, proc and nfs). If /etc/filesystems ends in a line with a single * only, mount will read /proc/filesystems afterwards.
The auto type may be useful for user-mounted floppies. Creating a file /etc/filesystems can be useful to change the probe order (e.g., to try vfat before msdos) or if you use a kernel module autoloader. Warning: the probing uses a heuristic (the presence of appropriate `magic’), and could recognize the wrong filesystem type, possibly with catastrophic consequences. If your data is valuable, don’t ask mount to guess.
More than one type may be specified in a comma separated list. The list of file system types can be prefixed with no to specify the file system types on which no action should be taken. (This can be meaningful with the -a option.)
For example, the command:
mount -a -t nomsdos,ext
mounts all file systems except those of type msdos and ext.
Used in conjunction with -a, to limit the set of filesystems to which the -a is applied. Like -t in this regard except that it is useless except in the context of -a. For example, the command:
mount -a -O no_netdev
mounts all file systems except those which have the option _netdev specified in the options field in the /etc/fstab file.
It is different from -t in that each option is matched exactly; a leading no at the beginning of one option does not negate the rest.
The -t and -O options are cumulative in effect; that is, the command
mount -a -t ext2 -O _netdev
mounts all ext2 filesystems with the _netdev option, not all filesystems that are either ext2 or have the _netdev option specified. Some of the options are only useful when they appear in the /etc/fstab file. The following options apply to any file system that is being mounted (but not every file system actually honors them - e.g., the sync option today has effect only for ext2, ext3 and ufs):
async
All I/O to the file system should be done asynchronously.
atime
Update inode access time for each access. This is the default.
auto
Can be mounted with the -a option.
defaults
Use default options: rw, suid, dev, exec, auto, nouser, and async.
dev
Interpret character or block special devices on the file system.
exec
Permit execution of binaries.
_netdev
The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).
noatime
Do not update inode access times on this file system (e.g, for faster access on the news spool to speed up news servers).
noauto
Can only be mounted explicitly (i.e., the -a option will not cause the file system to be mounted).
nodev
Do not interpret character or block special devices on the file system.
noexec
Do not allow execution of any binaries on the mounted file system. This option might be useful for a server that has file systems containing binaries for architectures other than its own.
nosuid
Do not allow set-user-identifier or set-group-identifier bits to take effect. (This seems safe, but is in fact rather unsafe if you have suidperl (1) installed.)
nouser
Forbid an ordinary (i.e., non-root) user to mount the file system. This is the default.
remount
Attempt to remount an already-mounted file system. This is commonly used to change the mount flags for a file system, especially to make a readonly file system writeable. It does not change device or mount point.
Mount the file system read-only.
Mount the file system read-write.
Allow set-user-identifier or set-group-identifier bits to take effect.
All I/O to the file system should be done synchronously.
All directory updates within the file system should be done synchronously. This affects the following system calls: creat, link, unlink, symlink, mkdir, rmdir, mknod and rename.
user
Allow an ordinary user to mount the file system. The name of the mounting user is written to mtab so that he can unmount the file system again. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).
Allow every user to mount and unmount the file system. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line users,exec,dev,suid).
Remount a subtree somewhere else (so that its contents are available in both places). See above.
Move a subtree to some other place. See above.
FILESYSTEM SPECIFIC MOUNT OPTIONS. The following options apply only to certain file systems. We sort them by file system. They all follow the -o flag.
Mount options for adfs uid=value and gid=value
Set the owner and group of the files in the file system (default: uid=gid=0). ownmask=value and othmask=value
Set the permission mask for ADFS ‘owner’ permissions and ‘other’ permissions, respectively (default: 0700 and 0077, respectively).
Mount options for affs
uid=value and gid=value
Set the owner and group of the root of the file system (default: uid=gid=0, but with option uid or gid without specified value, the uid and gid of the current process are taken).
setuid=value and setgid=value
Set the owner and group of all files.
mode=value
Set the mode of all files to value & 0777 disregarding the original permissions. Add search permission to directories that have read permission. The value is given in octal. protect
Do not allow any changes to the protection bits on the file system.
usemp
Set uid and gid of the root of the file system to the uid and gid of the mount point upon the first sync or umount, and then clear this option.
verbose
Print an informational message for each successful mount.
prefix=string
Prefix used before volume name, when following a link.
volume=string
Prefix (of length at most 30) used before ‘/’ when following a symbolic link.
reserved=value
(Default: 2.) Number of unused blocks at the start of the device.
root=value
Give explicitly the location of the root block.
bs=value
Give blocksize. Allowed values are 512, 1024, 2048, 4096.
grpquota / noquota / quota / usrquota
These options are accepted but ignored. (However, quota utilities may react to such strings in /etc/fstab.)
Mount options for coherent
None.
Mount options for devpts
The devpts file system is a pseudo file system, traditionally mounted on /dev/pts. In order to acquire a pseudo terminal, a process opens /dev/ptmx; the number of the pseudo terminal is then made available to the process and the pseudo terminal slave can be accessed as /dev/pts/.
uid=value and gid=value
This sets the owner or the group of newly created PTYs to the specified values. When nothing is specified, they will be set to the UID and GID of the creating process. For example, if there is a tty group with GID 5, then gid=5 will cause newly created PTYs to belong to the tty group.
mode=value
Set the mode of newly created PTYs to the specified value. The default is 0600. A value of mode=620 and gid=5 makes “mesg y” the default on newly created PTYs.
Mount options for ext
None. Note that the `ext’ file system is obsolete. Don’t use it. Since Linux version 2.1.21 extfs is no longer part of the kernel source.
Mount options for ext2
The `ext2′ file system is the standard Linux file system. Due to a kernel bug, it may be mounted with random mount options (fixed in Linux 2.0.4).
bsddf / minixdf
Set the behaviour for the statfs system call. The minixdf behaviour is to return in the f_blocks field the total number of blocks of the file system, while the bsddf behaviour (which is the default) is to subtract the overhead blocks used by the ext2 file system and not available for file storage. Thus
% mount /k -o minixdf; df /k; umount /k
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/sda6 2630655 86954 2412169 3% /k
% mount /k -o bsddf; df /k; umount /k
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/sda6 2543714 13 2412169 0% /k
(Note that this example shows that one can add command line options to the options given in /etc/fstab.)
check / check=normal / check=strict
Set checking level. When at least one of these options is set (and check=normal is set by default) the inodes and blocks bitmaps are checked upon mount (which can take half a minute or so on a big disk, and is rather useless). With strict checking, block deallocation checks that the block to free is in the data zone.
No checking is done. This is fast. Recent kernels do not have a check option anymore - checking with e2fsck (8) is more meaningful.
debug
Print debugging info upon each (re)mount.
errors=continue / errors=remount-ro / errors=panic
Define the behaviour when an error is encountered. (Either ignore errors and just mark the file system erroneous and continue, or remount the file system read-only, or panic and halt the system.) The default is set in the filesystem superblock, and can be changed using tune2fs(8).
grpid or bsdgroups / nogrpid or sysvgroups
These options define what group id a newly created file gets. When grpid is set, it takes the group id of the directory in which it is created; otherwise (the default) it takes the fsgid of the current process, unless the directory has the setgid bit set, in which case it takes the gid from the parent directory, and also gets the setgid bit set if it is a directory itself.
resgid=n and resuid=n
The ext2 file system reserves a certain percentage of the available space (by default 5%, see mke2fs (8) and tune2fs (8)). These options determine who can use the reserved blocks. (Roughly: whoever has the specified uid, or belongs to the specified group.) sb=n
Instead of block 1, use block n as superblock. This could be useful when the filesystem has been damaged. (Earlier, copies of the superblock would be made every 8192 blocks: in block 1, 8193, 16385, … (and one got hundreds or even thousands of copies on a big filesystem). Since version 1.08, mke2fs has a -s (sparse superblock) option to reduce the number of backup superblocks, and since version 1.15 this is the default. Note that this may mean that ext2 filesystems created by a recent mke2fs cannot be mounted r/w under Linux 2.0.*.) The block number here uses 1k units. Thus, if you want to use logical block 32768 on a filesystem with 4k blocks, use “sb=131072″.
grpquota / noquota / quota / usrquota
These options are accepted but ignored.
nouid32
Disables 32-bit UIDs and GIDs. This is for interoperability with older kernels which only store and expect 16-bit values.
Mount options for ext3
The `ext3′ file system is version of the ext2 file system which has been enhanced with journalling. It supports the same options as ext2 as well as the following additions: journal=update
Update the ext3 file system’s journal to the current format.
journal=inum
When a journal already exists, this option is ignored. Otherwise, it specifies the number of the inode which will represent the ext3 file system’s journal file; ext3 will create a new journal, overwriting the old contents of the file whose inode number is inum.
noload
Do not load the ext3 file system’s journal on mounting.
data=journal / data=ordered / data=writeback
Specifies the journalling mode for file data. Metadata is always journaled.
journal
All data is committed into the journal prior to being written into the main file system.
ordered
This is the default mode. All data is forced directly out to the main file system prior to its metadata being committed to the journal.
writeback
Data ordering is not preserved - data may be written into the main file system after its metadata has been committed to the journal. This is rumoured to be the highest-throughput option. It guarantees internal file system integrity, however it can allow old data to appear in files after a crash and journal recovery.
Mount options for fat (Note: fat is not a separate filesystem, but a common part of the msdos, umsdos and vfat filesystems.)
blocksize=512 / blocksize=1024 / blocksize=2048
Set blocksize (default 512).
uid=value and gid=value
Set the owner and group of all files. (Default: the uid and gid of the current process.) umask=value
Set the umask (the bitmask of the permissions that are not present). The default is the umask of the current process. The value is given in octal.
dmask=value
Set the umask applied to directories only. The default is the umask of the current process. The value is given in octal. Present since 2.5.43.
fmask=value
Set the umask applied to regular files only. The default is the umask of the current process. The value is given in octal. Present since 2.5.43.
check=value
Three different levels of pickyness can be chosen:
r[elaxed]
Upper and lower case are accepted and equivalent, long name parts are truncated (e.g. verylongname.foobar becomes verylong.foo), leading and embedded spaces are accepted in each name part (name and extension).
n[ormal]
Like “relaxed”, but many special characters (*, ?, <, spaces, etc.) are rejected. This is the default.
s[trict]
Like “normal”, but names may not contain long parts and special characters that are sometimes used on Linux, but are not accepted by MS-DOS are rejected. (+, =, spaces, etc.)
codepage=value
Sets the codepage for converting to shortname characters on FAT and VFAT filesystems. By default, codepage 437 is used.
conv=b[inary] / conv=t[ext] / conv=a[uto]
The fat file system can perform CRLFNL (MS-DOS text format to UNIX text format) conversion in the kernel. The following conversion modes are available:
binary
no translation is performed. This is the default.
text
CRLFNL translation is performed on all files.
auto
CRLFNL translation is performed on all files that don’t have a “well-known binary” extension. The list of known extensions can be found at the beginning of fs/fat/misc.c (as of 2.0, the list is: exe, com, bin, app, sys, drv, ovl, ovr, obj, lib, dll, pif, arc, zip, lha, lzh, zoo, tar, z, arj, tz, taz, tzp, tpz, gz, tgz, deb, gif, bmp, tif, gl, jpg, pcx, tfm, vf, gf, pk, pxl, dvi).
Programs that do computed lseeks won’t like in-kernel text conversion. Several people have had their data ruined by this translation. Beware!
For file systems mounted in binary mode, a conversion tool (fromdos/todos) is available. cvf_format=module
Forces the driver to use the CVF (Compressed Volume File) module cvf_module instead of auto-detection. If the kernel supports kmod, the cvf_format=xxx option also controls on-demand CVF module loading.
cvf_option=option
Option passed to the CVF module.
debug
Turn on the debug flag. A version string and a list of file system parameters will be printed (these data are also printed if the parameters appear to be inconsistent).
fat=12 / fat=16 / fat=32
Specify a 12, 16 or 32 bit fat. This overrides the automatic FAT type detection routine. Use with caution!
iocharset=value
Character set to use for converting between 8 bit characters and 16 bit Unicode characters. The default is iso8859-1. Long filenames are stored on disk in Unicode format.
quiet
Turn on the quiet flag. Attempts to chown or chmod files do not return errors, although they fail. Use with caution!
sys_immutable, showexec, dots, nodots, dotsOK=[yes|no]
Various misguided attempts to force Unix or DOS conventions onto a FAT file system.
Mount options for hpfs
uid=value and gid=value
Set the owner and group of all files. (Default: the uid and gid of the current process.)
umask=value
Set the umask (the bitmask of the permissions that are not present). The default is the umask of the current process. The value is given in octal.
case=lower / case=asis
Convert all files names to lower case, or leave them. (Default: case=lower.)
conv=binary / conv=text / conv=auto
For conv=text, delete some random CRs (in particular, all followed by NL) when reading a file. For conv=auto, choose more or less at random between conv=binary and conv=text. For conv=binary, just read what is in the file. This is the default.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

How to install Ubuntu

Posted in How To's by Shafkat Shahzad, M.Sc on March 9th, 2009

This guide will talk you through your first Ubuntu installation, hopefully teaching you everything you need to know to give Ubuntu a try without breaking or removing your existing Windows installation.
The guide uses Wubi to install Ubuntu, from Windows.
Ubuntu installation guide
If you’re planning on installing the latest version of Ubuntu (Intrepid Ibex 8.10) then there’s now no need to download Wubi installer. You can install Ubuntu straight from the CD inside Windows, and the install process takes care of automatically partitioning your hard drive for you.
1) Download the Ubuntu ISO and save to your desktop
2) Burn the ISO image to a blank CD using Roxio CD creator or similar:
3) Run the CD from “My Computer” - the CD should ask permission to run at which point you’ll see this option screen:
4) Select “install inside Windows” and follow the instructions. From this point, the screens are pretty much the same as Wubi installer. This process however uses the Grub Bootloader to start Ubuntu.
If you’ve got the space on your hard drive, go for 30gb or more for the installation size.
2) Now configure your installation using the simple settings options. You can specify the location of the Ubuntu installation on your Windows partition, the size of the Ubuntu installation, the Ubuntu flavour (Ubuntu, Kubuntu, Xubuntu, etc), your preferred language, and a username and password for the Ubuntu system.
3) Click reboot now, and select “Ubuntu” on the startup screen. You now have a fully functional dual boot Windows / Ubuntu machine.
How to set up your wireless network
Next, we’re going to set up the wireless network. By now you should have correctly installed Ubuntu and after a restart and a login, you’ll see a desktop a little like this:
Remember before you do anything, you’ll need to connect your PC to a wireless network.
How to connect to your wireless network in Hardy Heron
Connecting to your wireless router so you can access the internet is pretty easy. Here are the steps:
1) In the top menu, click System>Administration>Network
2) The network settings dialogue will appear. Click “unlock” and key in your password. Now, highlight the wireless connection, and click the properties button on the right.
3) A dialog box will appear. Click “enable roaming mode” and click ok. Now close the network settings dialogue.
4) Next, you need to click the wireless logo in the top right hand of your screen. A small menu will appear. Click the wireless network you want to join and a dialogue box will appear
Just key in the WPA / security details of your wireless LAN and click connect. Ubuntu will connect to the network straight away
How to install a Nvidia display driver
This guide will show how to set up your Nvidia display driver, and how to instantly tweak the graphics performance of your new installation.
Nvidia drivers don’t seem to be open source like many other drivers for Ubuntu. All that means is that they don’t share their source code (closed source) in the way that Ubuntu developers need to be able to make things better, more usable and all that other stuff they like to do.
How to install your Nvidia driver
1) Go to System>Administration>Hardware drivers
2) Click on the “Enabled” check box and follow the instructions…
3) Eventually you’ll see this message. Time to restart your computer.
When you’ve restarted your machine, it’s time to start thinking about putting your new driver to good use. Let’s get the default visual effects set up correctly:
4) Go to System>Preferences>Appearance and select the “Visual effects” tab and select Extra
Your machine will instantly “feel” more responsive and you’ll notice the full use of your graphics card is being utilised. Try moving a window - fun, isn’t it! “Wobbly Windows” is a feature of Compiz and we’ll be looking at how tu use Compiz to create a desktop cube environment next.
How to install Compiz Fusion
Compiz is a seriously powerful extension to Gnome (basically the GUI for Linux). It’s been possible to create extra desktops in Ubuntu for a long time, but with Compiz you can switch between them via a three dimensional cube, which is actually very usable and seriously cool. Amaze your friends with Compiz by showing them your machine doing tricks like this:
Installing Compiz from hardy Heron is extremely easy. In fact, you already have it installed in Ubuntu Hardy. If you have an earlier version of Ubuntu, follow these instructions. If you have Hardy, read on…
Compiz is already installed but you need access to the advanced settings manager to activate the cube and cube rotation. You’re going to install a package called: compizconfig-settings-manager. Installing it in Hardy is easy -
1) Go to Synaptic Package Manager (System>Administration>Synaptic Package Manager) and do a search for compizconfig-settings-manager. Check the install box and click apply.
2) if you go to System>Preferences you’ll see that a new menu item has appeared - “Advanced desktop effects settings”. Open the menu.
This is the compiz settings manager, the place where you activate all of the cool tricks. There are so many fiddly little settings to play with that it would be impossible to write about them all. There are however some really important ones to switch on that are worthy of note and will provide an important first step:
3) Under “Desktop” check “Desktop Cube”. There are lots of settings inside this module, but for the time being leave it checked
4) Underneath the desktop cube checkbox, check “Rotate Cube”.
If all goes well, then holding down CTRL>ALT and the right hand mouse button should instantly zoom you out and display a three dimensional desktop! Mouse around and it will spin up and down and from left to right.
When it comes to installing Ubuntu, there are so many useful snippets of information on blogs and guides all over the internet.
This guide will talk you through your first Ubuntu installation, hopefully teaching you everything you need to know to give Ubuntu a try without breaking or removing your existing Windows installation.
The guide uses Wubi to install Ubuntu, from Windows.
Ubuntu installation guide
If you’re planning on installing the latest version of Ubuntu (Intrepid Ibex 8.10) then there’s now no need to download Wubi installer. You can install Ubuntu straight from the CD inside Windows, and the install process takes care of automatically partitioning your hard drive for you.
1) Download the Ubuntu ISO and save to your desktop
2) Burn the ISO image to a blank CD using Roxio CD creator or similar:
3) Run the CD from “My Computer” - the CD should ask permission to run at which point you’ll see this option screen:
4) Select “install inside Windows” and follow the instructions. From this point, the screens are pretty much the same as Wubi installer. This process however uses the Grub Bootloader to start Ubuntu.
If you’ve got the space on your hard drive, go for 30gb or more for the installation size.
2) Now configure your installation using the simple settings options. You can specify the location of the Ubuntu installation on your Windows partition, the size of the Ubuntu installation, the Ubuntu flavour (Ubuntu, Kubuntu, Xubuntu, etc), your preferred language, and a username and password for the Ubuntu system.
3) Click reboot now, and select “Ubuntu” on the startup screen. You now have a fully functional dual boot Windows / Ubuntu machine.
How to set up your wireless network
Next, we’re going to set up the wireless network. By now you should have correctly installed Ubuntu and after a restart and a login, you’ll see a desktop a little like this:
Remember before you do anything, you’ll need to connect your PC to a wireless network.
How to connect to your wireless network in Hardy Heron
Connecting to your wireless router so you can access the internet is pretty easy. Here are the steps:
1) In the top menu, click System>Administration>Network
2) The network settings dialogue will appear. Click “unlock” and key in your password. Now, highlight the wireless connection, and click the properties button on the right.
3) A dialog box will appear. Click “enable roaming mode” and click ok. Now close the network settings dialogue.
4) Next, you need to click the wireless logo in the top right hand of your screen. A small menu will appear. Click the wireless network you want to join and a dialogue box will appear
Just key in the WPA / security details of your wireless LAN and click connect. Ubuntu will connect to the network straight away
How to install a Nvidia display driver
This guide will show how to set up your Nvidia display driver, and how to instantly tweak the graphics performance of your new installation.
Nvidia drivers don’t seem to be open source like many other drivers for Ubuntu. All that means is that they don’t share their source code (closed source) in the way that Ubuntu developers need to be able to make things better, more usable and all that other stuff they like to do.
How to install your Nvidia driver
1) Go to System>Administration>Hardware drivers
2) Click on the “Enabled” check box and follow the instructions…
3) Eventually you’ll see this message. Time to restart your computer.
When you’ve restarted your machine, it’s time to start thinking about putting your new driver to good use. Let’s get the default visual effects set up correctly:
4) Go to System>Preferences>Appearance and select the “Visual effects” tab and select Extra
Your machine will instantly “feel” more responsive and you’ll notice the full use of your graphics card is being utilised. Try moving a window - fun, isn’t it! “Wobbly Windows” is a feature of Compiz and we’ll be looking at how tu use Compiz to create a desktop cube environment next.
How to install Compiz Fusion
Compiz is a seriously powerful extension to Gnome (basically the GUI for Linux). It’s been possible to create extra desktops in Ubuntu for a long time, but with Compiz you can switch between them via a three dimensional cube, which is actually very usable and seriously cool. Amaze your friends with Compiz by showing them your machine doing tricks like this:
Installing Compiz from hardy Heron is extremely easy. In fact, you already have it installed in Ubuntu Hardy. If you have an earlier version of Ubuntu, follow these instructions. If you have Hardy, read on…
Compiz is already installed but you need access to the advanced settings manager to activate the cube and cube rotation. You’re going to install a package called: compizconfig-settings-manager. Installing it in Hardy is easy -
1) Go to Synaptic Package Manager (System>Administration>Synaptic Package Manager) and do a search for compizconfig-settings-manager. Check the install box and click apply.
2) if you go to System>Preferences you’ll see that a new menu item has appeared - “Advanced desktop effects settings”. Open the menu.
This is the compiz settings manager, the place where you activate all of the cool tricks. There are so many fiddly little settings to play with that it would be impossible to write about them all. There are however some really important ones to switch on that are worthy of note and will provide an important first step:
3) Under “Desktop” check “Desktop Cube”. There are lots of settings inside this module, but for the time being leave it checked
4) Underneath the desktop cube checkbox, check “Rotate Cube”.
If all goes well, then holding down CTRL>ALT and the right hand mouse button should instantly zoom you out and display a three dimensional desktop! Mouse around and it will spin up and down and from left to right.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

Linux/Unix Command

Posted in How To's by Shafkat Shahzad, M.Sc on March 8th, 2009

<Ping uses the ICMP protocol’s mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway. ECHO_REQUEST datagrams (“pings”) have an IP and ICMP header, followed by a struct timeval and then an arbitrary number of “pad” bytes used to fill out the packet.
OPTIONS
-a
Audible ping.
-A
Adaptive ping. Interpacket interval adapts to round-trip time, so that effectively not more than one (or more, if preload is set) unanswered probes present in the network. Minimal interval is 200msec for not super-user. On networks with low rtt this mode is essentially equivalent to flood mode.
-b
Allow pinging a broadcast address.
-B
Do not allow ping to change source address of probes. The address is bound to one selected when ping starts.
-c count
Stop after sending count ECHO_REQUEST packets. With deadline option, ping waits for count ECHO_REPLY packets, until the timeout expires.
-d
Set the SO_DEBUG option on the socket being used. Essentially, this socket option is not used by Linux kernel.
-F flow label
Allocate and set 20 bit flow label on echo request packets. (Only ping6). If value is zero, kernel allocates random flow label.
-f
Flood ping. For every ECHO_REQUEST sent a period “.” is printed, while for ever ECHO_REPLY received a backspace is printed. This provides a rapid display of how many packets are being dropped. If interval is not given, it sets interval to zero and outputs packets as fast as they come back or one hundred times per second, whichever is more. Only the super-user may use this option with zero interval.
-i interval
Wait interval seconds between sending each packet. The default is to wait for one second between each packet normally, or not to wait in flood mode. Only super-user may set interval to values less 0.2 seconds.
-I interface address
Set source address to specified interface address. Argument may be numeric IP address or name of device. When pinging IPv6 link-local address this option is required.
-l preload
If preload is specified, ping sends that many packets not waiting for reply. Only the super-user may select preload more than 3.
-L
Suppress loopback of multicast packets. This flag only applies if the ping destination is a multicast address.
-n
Numeric output only. No attempt will be made to lookup symbolic names for host addresses.
-p pattern
You may specify up to 16 “pad” bytes to fill out the packet you send. This is useful for diagnosing data-dependent problems in a network. For example, -p ff will cause the sent packet to be filled with all ones.
-Q tos
Set Quality of Service -related bits in ICMP datagrams. tos can be either decimal or hex number. Traditionally (RFC1349), these have been interpreted as: 0 for reserved (currently being redefined as congestion control), 1-4 for Type of Service and 5-7 for Precedence. Possible settings for Type of Service are: minimal cost: 0×02, reliability: 0×04, throughput: 0×08, low delay: 0×10. Multiple TOS bits should not be set simultaneously. Possible settings for special Precedence range from priority (0×20) to net control (0xe0). You must be root (CAP_NET_ADMIN capability) to use Critical or higher precedence value. You cannot set bit 0×01 (reserved) unless ECN has been enabled in the kernel. In RFC2474, these fields has been redefined as 8-bit Differentiated Services (DS), consisting of: bits 0-1 of separate data (ECN will be used, here), and bits 2-7 of Differentiated Services Codepoint (DSCP).
-q
Quiet output. Nothing is displayed except the summary lines at startup time and when finished.
-R
Record route. Includes the RECORD_ROUTE option in the ECHO_REQUEST packet and displays the route buffer on returned packets. Note that the IP header is only large enough for nine such routes. Many hosts ignore or discard this option.
-r
Bypass the normal routing tables and send directly to a host on an attached interface. If the host is not on a directly-attached network, an error is returned. This option can be used to ping a local host through an interface that has no route through it provided the option -I is also used.
-s packetsize
Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.
-S sndbuf
Set socket sndbuf. If not specified, it is selected to buffer not more than one packet.
-t ttl
Set the IP Time to Live.
-T timestamp option
Set special IP timestamp options. timestamp option may be either tsonly (only timestamps), tsandaddr (timestamps and addresses) or tsprespec host1 [host2 [host3 [host4]]] (timestamp prespecified hops).
-M hint
Select Path MTU Discovery strategy. hint may be either do (prohibit fragmentation, even local one), want (do PMTU discovery, fragment locally when packet size is large), or dont (do not set DF flag).
-U
Print full user-to-user latency (the old behaviour). Normally ping prints network round trip time, which can be different f.e. due to DNS failures.
-v
Verbose output.
-V
Show version and exit.
-w deadline
Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received. In this case ping does not stop after count packet are sent, it waits either for deadline expire or until count probes are answered or for some error notification from network.
-W timeout
Time to wait for a response, in seconds. The option affects only timeout in absense of any responses, otherwise ping waits for two RTTs.
When using ping for fault isolation, it should first be run on the local host, to verify that the local network interface is up and running. Then, hosts and gateways further and further away should be “pinged”. Round-trip times and packet loss statistics are computed. If duplicate packets are received, they are not included in the packet loss calculation, although the round trip time of these packets is used in calculating the minimum/average/maximum round-trip time numbers. When the specified number of packets have been sent (and received) or if the program is terminated with a SIGINT, a brief summary is displayed. Shorter current statistics can be obtained without termination of process with signal SIGQUIT.
If ping does not receive any reply packets at all it will exit with code 1. If a packet count and deadline are both specified, and fewer than count packets are received by the time the deadline has arrived, it will also exit with code 1. On other error it exits with code 2. Otherwise it exits with code 0. This makes it possible to use the exit code to see if a host is alive or not.
This program is intended for use in network testing, measurement and management. Because of the load it can impose on the network, it is unwise to use ping during normal operations or from automated scripts.
ICMP PACKET DETAILS
An IP header without options is 20 bytes. An ICMP ECHO_REQUEST packet contains an additional 8 bytes worth of ICMP header followed by an arbitrary amount of data. When a packetsize is given, this indicated the size of this extra piece of data (the default is 56). Thus the amount of data received inside of an IP packet of type ICMP ECHO_REPLY will always be 8 bytes more than the requested data space (the ICMP header).
If the data space is at least of size of struct timeval ping uses the beginning bytes of this space to include a timestamp which it uses in the computation of round trip times. If the data space is shorter, no round trip times are given.
DUPLICATE AND DAMAGED PACKETS
ping will report duplicate and damaged packets. Duplicate packets should never occur, and seem to be caused by inappropriate link-level retransmissions. Duplicates may occur in many situations and are rarely (if ever) a good sign, although the presence of low levels of duplicates may not always be cause for alarm.
Damaged packets are obviously serious cause for alarm and often indicate broken hardware somewhere in the ping packet’s path (in the network or in the hosts).
TRYING DIFFERENT DATA PATTERNS
The (inter)network layer should never treat packets differently depending on the data contained in the data portion. Unfortunately, data-dependent problems have been known to sneak into networks and remain undetected for long periods of time. In many cases the particular pattern that will have problems is something that doesn’t have sufficient “transitions”, such as all ones or all zeros, or a pattern right at the edge, such as almost all zeros. It isn’t necessarily enough to specify a data pattern of all zeros (for example) on the command line because the pattern that is of interest is at the data link level, and the relationship between what you type and what the controllers transmit can be complicated.
This means that if you have a data-dependent problem you will probably have to do a lot of testing to find it. If you are lucky, you may manage to find a file that either can’t be sent across your network or that takes much longer to transfer than other similar length files. You can then examine this file for repeated patterns that you can test using the -p option of ping.
TTL DETAILS
The TTL value of an IP packet represents the maximum number of IP routers that the packet can go through before being thrown away. In current practice you can expect each router in the Internet to decrement the TTL field by exactly one.
The TCP/IP specification states that the TTL field for TCP packets should be set to 60, but many systems use smaller values (4.3 BSD uses 30, 4.2 used 15).
The maximum possible value of this field is 255, and most Unix systems set the TTL field of ICMP ECHO_REQUEST packets to 255. This is why you will find you can “ping” some hosts, but not reach them with telnet (1) or ftp(1).
In normal operation ping prints the ttl value from the packet it receives. When a remote system receives a ping packet, it can do one of three things with the TTL field in its response:
*
Not change it; this is what Berkeley Unix systems did before the 4.3BSD Tahoe release. In this case the TTL value in the received packet will be 255 minus the number of routers in the round-trip path.
Set it to 255; this is what current Berkeley Unix systems do. In this case the TTL value in the received packet will be 255 minus the number of routers in the path from the remote system to the pinging host.
*
Set it to some other value. Some machines use the same value for ICMP packets that they use for TCP packets, for example either 30 or 60. Others may use completely wild values.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists