Wednesday, October 31, 2012

HowTo: Speedup ping and traceroute Command Responses under Linux / Unix

The ping command line utility act as a computer network tool. It used to test whether a particular host is reachable across an IP network. The traceroute command also act as a computer network diagnostic tool for displaying the route (path) and measuring transit

Speedup ping command

The syntax is:

 ping -n -W VALUE -i VALUE host

Where,
  1. -n : Disable DNS lookup to speed up queries.
  2. -W NUMBER : Time to wait for a response, in seconds. The option affects only timeout in absence of any responses, otherwise ping waits for two RTTs.
  3. -i SECONDS : 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.
The default command will produce output as follows:
 ping -c 5 google.com

[sibin@localhost]$ ping -c 5 google.com
PING google.com (74.125.235.8) 56(84) bytes of data.
64 bytes from sin01s04-in-f8.1e100.net (74.125.235.8): icmp_req=1 ttl=54 time=234 ms
64 bytes from sin01s04-in-f8.1e100.net (74.125.235.8): icmp_req=2 ttl=54 time=45.7 ms
64 bytes from sin01s04-in-f8.1e100.net (74.125.235.8): icmp_req=3 ttl=54 time=88.1 ms
64 bytes from sin01s04-in-f8.1e100.net (74.125.235.8): icmp_req=4 ttl=54 time=45.7 ms
64 bytes from sin01s04-in-f8.1e100.net (74.125.235.8): icmp_req=5 ttl=54 time=46.2 ms

--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4002ms
rtt min/avg/max/mdev = 45.758/92.011/234.135/72.918 ms


 Now optimize the ping command:

$ ping -c 5 -n -i 0.2 -W1 google.com

[sibin@ast-wks-069 ~]$  ping -c 5 -n -i 0.2 -W1 google.com
PING google.com (74.125.235.9) 56(84) bytes of data.
64 bytes from 74.125.235.9: icmp_req=1 ttl=54 time=46.4 ms
64 bytes from 74.125.235.9: icmp_req=2 ttl=54 time=46.4 ms
64 bytes from 74.125.235.9: icmp_req=3 ttl=54 time=45.7 ms
64 bytes from 74.125.235.9: icmp_req=4 ttl=54 time=45.5 ms
64 bytes from 74.125.235.9: icmp_req=5 ttl=54 time=49.5 ms

--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 803ms
rtt min/avg/max/mdev = 45.569/46.762/49.541/1.433 ms






Speedup traceroute command

The syntax is:
 
traceroute -n -w SECONDS -q NUMBER host



Where,
  1. -n : Disable DNS lookup to speed up queries.
  2. -w seconds : Set the time (in seconds) to wait for a response to a probe (default 5.0 sec).
  3. -q NUMBER : Sets the number of probe packets per hop. The default is 3.
The following example will wailt 3 seconds (instead of 5), only send out 1 query to each hop (ineader of 3):
$ traceroute -n -w 3 -q 1 www.google.com

 The -N option specifies the number of probe packets sent out simultaneously. Sending several probes concurrently can speed up traceroute considerably. The default value is 16:
$ traceroute -n -w 3 -q 1 -N 32 www.google.com
Please Note that some routers and hosts can use ICMP rate throttling. In such a situation specifying too large number can lead to loss of some responses. You can also limit the maximum number of hops to 16 before giving up (instead of default 30) using the -m option:
$ traceroute -n -w 3 -q 1 -N 32 -m 16 www.google.com

Friday, October 12, 2012

Centos Extra Repos for yum packages


Epel.repo

[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 5 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

webtatic.repo

[webtatic]
name=Webtatic Repository $releasever - $basearch
#baseurl=http://repo.webtatic.com/yum/centos/5/$basearch/
mirrorlist=http://repo.webtatic.com/yum/centos/5/$basearch/mirrorlist
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy

[webtatic-debuginfo]
name=Webtatic Repository $releasever - $basearch - Debug
#baseurl=http://repo.webtatic.com/yum/centos/5/$basearch/debug/
mirrorlist=http://repo.webtatic.com/yum/centos/5/$basearch/debug/mirrorlist
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy

[webtatic-source]
name=Webtatic Repository $releasever - $basearch
#baseurl=http://repo.webtatic.com/yum/centos/5/SRPMS/
mirrorlist=http://repo.webtatic.com/yum/centos/5/SRPMS/mirrorlist
enabled=0
gpgcheck=1

rpmforge.repo

# Name: RPMforge RPM Repository for Red Hat Enterprise 5 - dag
# URL: http://rpmforge.net/
[rpmforge]
name = Red Hat Enterprise $releasever - RPMforge.net - dag
#baseurl = http://apt.sw.be/redhat/el5/en/$basearch/dag
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1