Table of Contents
Ping Command is the most used command in networking world. Maybe it is the first command that every network engineer has used firstly. During network integration, network operation and troubleshooting activities, we use Ping. There are different Linux Ping Commands used on Linux devices. So, here, we will focus on these commands in Linux. We will learn Linux Ping Command Options with different Examples.
Ping is the abbreviation of “Packet Internet Groper”.Mainly, we use Ping Command to check the connectivity of the peers in networking. In the network world, there are many Linux Servers or Linux based devices. On these devices, Ping is used too much. So, Ping Command in Linux is one of the important command with its Command Options.
To learn Windows Ping Commands, you can also check other Ping Command.
Pinging is the activity to send ICMP (Internet Control Message Protocol) messages between peers. In other words one peer sends ICMP Echo Request and the other replies with ICMP Echo Reply. So, the Ping process is completed. If there is a connectivity between peers, it is successfull. Or, it is unsuccessful.
The options of this command are very important during your network operations or troubleshooting activiries. So, knowing these Options, will provide you a better performance on your network.
Now, let’s focus Linux Ping and learn the Command Options detailly.
You can also access Top Linux Commands and Download Linux Command Cheat Sheet!
Using Ping Command in Linux, is similar to Windows. Simply, we use “ping” keyword and then we write the Ping Option. Lastly we write IP Address or hostname of the destination or ho that we would like to check.
ping [Option] Destination IP Address / Hostname
Below, you can find an example without options.
$ ping 10.10.10.10
$ ping www.ipcisco.com
This is the pure usage of this connectivity checker command. To perform a better performance on our network operations and troubeshooting activities, we need more options of the Linux Ping command.
Ping command reply will include the below fields:
There are many Options in Linux for this command like Options in Windows or in network equipments like routers. Here, we will learn all these Linux Ping Options one by one.You can use these Options, one by one or together with different combinations.
If you would like to use it only for IPv4 Address, you can use “-4”. Below, we can force to ping www.ipcisco.com with IPv4.
$ ping -4 www.ipcisco.com
If you would like to use it only for IPv6 Address, you can use “-6”. Below, we can force to ping www.ipcisco.com with IPv6.
$ ping -6 www.ipcisco.com
If you would like to hear a beep sound, you can use “-a” option with Ping command in Linux.
$ ping -a 10.10.10.10
ping -b
If you would like to allow pinging Broadcast addresses, you can use “-b” option. To use this command with 10.10.10.10 we will use the below Linux command.
$ ping -b 10.10.10.10
To prevent source change, we use “-B” option with this Command. We will use destination address 10.10.10.10 with this option.
$ ping -B 10.10.10.10
“c” stands for “count”. If you use ping with “-c” and “a number” after it, it means that send ping with this number of times. For example, to send 10 ping to destination www.ipcisco.com or 10.10.10.10, we can use the below command:
$ ping -c 10 www.ipcisco.com
$ ping -c 10 10.10.10.10
Option “-d” stands for Debug. To enable Debug IP Packet like below, we use this Linux command option.
$ ping -d 10.10.10.10
“f” stands for “flood”. If you use ping with “-f”, it sends hundreds of pings per second. To send flood 10.10.10.10 address, we can use thebelow command:
$ ping -f 10.10.10.10
There is a default interval between successfull ping packets. This default value is 1 second. To change this default interval we can use“-i” option. It stands for “interval”. For example, if we change this interval to 3 second, we can sue the below Linux ping command. For pinging www.ipcisco.com.
$ ping -i 3 www.ipcisco.com
Source Interface. “-I” Option is used to set the source of Ping packets. There can be multiple interface in your device. You can set a specific interface as the ping source. For example, below we set our ping source as fa1 for pinging www.ipcisco.com0
$ ping -I fa1 www.ipcisco.com
To send ping packet without waiting for a reply, we use “-l” option. If you would like to set this a value more than 3, you should be a root user. To send multiple packets without response to destination 10.10.10.10 we use the below Linux Ping command.
$ ping -l 7 10.10.10.10
If you are not a root user, you can use the below command to set this value:
$ sudoping -l 7 10.10.10.10
To display network addresses as numbers not as host names.
$ ping -n www.ipcisco.com
To display only summary lines at the startup and the finish time, we use “-q” option.
$ ping -q www.ipcisco.com
To ping a local host and bypass the routing table records, “-r” option is used.
$ ping -r 10.10.10.10
“R” option is used for Record Route. It recordss the route of the packet inside IP Header.
$ ping -R www.ipcisco.com
<
Ping “-s” option give us an opportunity to change the default ping packet size. The default ping packet is 56 bytes long. It is trantlated 64 bytes ICMP data. Below, we will change this packet size as 200 bytes for pinging 10.10.10.10.
$ ping -s 200 10.10.10.10
With “-t” option, we can change TTL (Time to Live) Value of Linux Ping.
$ ping -t 300 10.10.10.10
We use option “-T” to print timestamp with ping responses.
$ ping -T 10.10.10.10
We can also use some more additional options together with “-T” options. These are given below:
With “-v” option, we can enable Verbose mode.
$ ping -v 10.10.10.10
To display version number “-V” option is used.
$ ping -V 10.10.10.10
With “-w” option, we can set the time that ping will exits independent of the number of the send packets. To set this time to 2 seconds, we will use the below command:
$ ping -w 2
With “-W” option, we can set the time that we will wait for a ping response. For example to set this interval to 5 seconds, we can use the below command.
$ ping -W 5
Sending 10 packets with 100 Bytes Sized to 1.1.1.1
$ ping -s 100 -c 10 1.1.1.1
Setting Interval to 5 seconds with ping debug option towards 1.1.1.1
$ ping -i 5 -d 10 1.1.1.1
Checking connectivity to www.ipcisco.com from interface fa1 and with TTL 350, with verbose mode.
$ ping -I fa1 5 -t 350 -v
Checking connectivity to www.ipcisco.com with setting response time to 10 seconds with timestamps.
$ ping -W 10 -T
To send 12 packet without waiting any response from www.ipcisco.com with 200 bytes packets.
$ ping -l 12 -s 200
To learn Windows Ping Commands, you can also check other Ping Command.
You can also access Top Linux Commands and Download Linux Command Cheat Sheet!
Leave a Reply