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 , 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 -n count -l size -f -i TTL -v TOS -w timeout-in-msec

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

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

Linux : ping -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:

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

-F flow label
    Allocate and set 20 bit flow label on echo request packets.
    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.
    Suppress loopback of multicast packets. This flag only applies if the ping destination is a multicast address.
    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.
    Quiet output. only summary lines at startup time and when finished.
    Record route.
    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).
    Print full user-to-user latency (the old behaviour).
    Verbose output.
    Show version and exit.

-w deadline
    Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received.