The ping command
The ping command is the basic troubleshooting tool for TCP/IP. You use it to determine whether basic TCP/IP connectivity has been established between two computers. If you're having any kind of network trouble between two computers, the first troubleshooting step is almost always to see whether the computers can ping each other.
The basic syntax of ping is straightforward:
ping [options] address
The options can be
- -c: The number of packets to send. If you omit this, ping continues to send packets until you interrupt it.
- -d: Floods the network with packets, as many as 100 per second. Use with care!
- -i: Specifies how many seconds to wait between sending packets. The default is one second. If you're having intermittent connection problems, you may try letting ping run for a while with this option set to a higher value, such as 60, to send a packet every minute.
- -R: Displays the route the packets take to get to the destination computer.
TipPing will continue to ping the destination computer until you interrupt it by pressing Ctrl+Z.
You can specify the host to ping using an IP address, as in this example:
$ ping 192.168.1.100 PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data. 64 bytes from 192.168.1.100: icmp_seq=1 ttl=128 time=0.382 ms 64 bytes from 192.168.1.100: icmp_seq=2 ttl=128 time=0.345 ms 64 bytes from 192.168.1.100: icmp_seq=3 ttl=128 time=0.320 ms 64 bytes from 192.168.1.100: icmp_seq=4 ttl=128 time=0.328 ms
You can also ping using a DNS name, as in this example:
$ ping www.lowewriter.com PING www.lowewriter.com (209.68.34.15) 56(84) bytes of data. 64 bytes from www.lowewriter.com (209.68.34.15): icmp_seq=1 ttl=47 time=88.9 ms 64 bytes from www.lowewriter.com (209.68.34.15): icmp_seq=2 ttl=47 time=87.9 ms 64 bytes from www.lowewriter.com (209.68.34.15): icmp_seq=3 ttl=47 time=88.3 ms 64 bytes from www.lowewriter.com (209.68.34.15): icmp_seq=4 ttl=47 time=87.2 ms
In this tutorial:
- Linux Commands
- Command Shell Basics
- Editing commands
- Wildcards
- Redirection and piping
- Environment variables
- Shell scripts
- Directory and File Handling Commands
- The cd command
- The mkdir command
- The rmdir command
- The ls command
- The cp command
- The rm command
- The mv command
- The touch command
- The cat command
- Commands for Working with Packages and Services
- The rpm command
- Commands for Administering Users
- The usermod command
- The chage command
- The passwd command
- The newusers command
- The groupadd command
- The groupdel command
- Commands for Managing Ownership and Permissions
- The chgrp command
- The chmod command
- Networking Commands
- The ipconfig command
- The netstat command
- The ping command
- The route command
- The traceroute command