Saturday 8 February 2014

Powerful Ping command (Linux and Windows Ping)

Ping command is the first step or basic command in networking. It has many options which many people are not aware.

Also the ping command options differ in Linux and Windows.

To ping host 10.0.0.1 , 100 packets with packet size 1100 bytes ,DF bit set, TTL value 32, TOS value as 252, timeout to wait for each reply= 2 sec

we have to use the commands as :


=============================================================================
Windows : ping 10.0.0.1 -n count -l size -f -i TTL -v TOS -w timeout-in-msec

Linux : ping 10.0.0.1 -c count -s size -m dont -t ttl -Q tos -W timeout-in-sec

==============================================================================
Windows : ping 10.0.0.1 -n 100 -l 1100 -f -i 32 -v 252 -w 2000

Linux : ping 10.0.0.1 -c 100 -s 1100 -m dont -t 32 -Q 252 -W 2
=============================================================================






Other options in Windows:


   -t             Ping the specified host until stopped.
                  To see statistics and continue - type Control-Break;
                  To stop - type Control-C.

   -a             Resolve addresses to hostnames.
   -r count       Record route for count hops (IPv4-only).
   -s count       Timestamp for count hops (IPv4-only).
   -j host-list   Loose source route along host-list (IPv4-only).
   -k host-list   Strict source route along host-list (IPv4-only).
   -R             Use routing header to test reverse route also (IPv6-only).
   -S srcaddr     Source address to use.
   -4             Force using IPv4.
   -6             Force using IPv6.


Other options in Linux:

-a
    Audible ping.
-A
    Adaptive ping.
-b
    Allow pinging a broadcast address.
-B
    Do not allow ping to change source address of probes.
-d
    Set the SO_DEBUG option on the socket being used.

-F flow label
    Allocate and set 20 bit flow label on echo request packets.
-f
    Flood ping. For every ECHO_REQUEST sent a period ''.'' is printed, while for ever ECHO_REPLY received a backspace is printed.

-I interface address
    Set source address to specified interface address.

-l preload
    If preload is specified, ping sends that many packets not waiting for reply.
-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.
-q
    Quiet output. only summary lines at startup time and when finished.
-R
    Record route.
-r
    Bypass the normal routing tables and send directly to a host on an attached interface.

-S sndbuf
    Set socket sndbuf. If not specified, it is selected to buffer not more than one packet.

-T timestamp option
    Set special IP timestamp options.

-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).
-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.