【Ping】——Ping command to test network connectivity——study notes

 Ping in the Internet is to send a data packet to the target end, and then wait for the data returned by Ping to determine whether it can reach the target end.

Ping is a very basic but very important TCP/IP network tool. Its main functions are:

(1) Usually used to detect network connectivity and test network speed;

(2) The IP address of the corresponding host can also be obtained according to the domain name;

(3) According to the TTL value returned by ping, determine the operating system used by the other party and the number of data packets passing through the router.
(4) Because of the above functions, the ping command is often used by hackers for network scanning and attacks.

For network administrators and ordinary users, we usually use it to test the connectivity of the network. If it is not normal, it is a basic tool for detecting network failures.


The five-step method of ping:

first step:

ping 127.0.0.1

We must first have a core framework to use Ping, enter on the console:

ping 127.0.0.1

127.0.0.1 is a reserved IP address, also called the loopback address, which cannot be used by a host alone, so using this address does not test whether it can connect to other hosts, but checks whether the TCP/IP of the machine is installed correctly. You can ping this address even if you are not connected to the Internet, because it is sent on this machine.

Step two:

Ping the IP address of the machine , and some people ping localhost in the second step, but the hosts file of some computers originally resolves localhost to 127.0.0.1, so pinging localhost becomes the first step just mentioned.

 However, the IP address of this machine is divided into public network IP and internal network IP . Generally, you cannot ping your own public network IP, because the router or ISP will prohibit you from pinging your own public network IP, so here you can only ping your own internal network. IP.

for example:

ping 192.168.10.5

 Note that when pinging the intranet IP, you need to connect to the Internet, that is, if the ping fails, there may be a problem with the network cable or wifi connection.

third step:

Ping the default gateway , usually ping your own router, for example:

ping 192.168.10.1

If it doesn't work, check your router to see if it's faulty.

the fourth step:

Ping the IP address . If the ping fails at this step, it proves that it is not a problem with the host or the network. It may be that the other host is offline, or the firewall prohibits the ping request, or the data packet may be discarded on the way.

 Although ping can't tell you why the packet is delayed, repeated, or damaged, we can analyze the external cause based on this.

the fifth step:

Ping the target hostname , usually the ping domain name. For example, we:

ping facebook.com

 facebook.com will get the corresponding IP address through domain name resolution, and then ping the corresponding IP address:

ping 103.252.114.61

Guess you like

Origin blog.csdn.net/qq_50497708/article/details/128167778
Recommended