laitimes

The seven uses of the ping command, after reading it, you will become a god in an instant

author:Industrial control automation programming

Some friends reflected, can you talk about the use of ping command, in fact, for the use of the command we mentioned some before, but the ping command is not explained too much, generally we use its basic function, today we will take a detailed look at the detailed use of ping command.

First, the basic use of ping is explained in detail

Ping in a network is a very powerful TCP/IP tool. Its main functions are:

1. It is used to detect network connectivity and analyze network speed

2. Get the server IP according to the domain name

3. According to the TTL value returned by ping, judge the operating system used by the other party and the number of packets passing through the router.

We usually use it to ping the IP address directly to test the connectivity of the network.

The seven uses of the ping command, after reading it, you will become a god in an instant

Similar to this, directly ping the IP address or gateway, ping will display the above data, some friends may ask, bytes=32;time<1ms; TTL=128 What do these mean.

bytes value: The packet size, which is bytes.

Time value: response time, the smaller this time, the faster you can connect to this address.

TTL value: Time To Live, which indicates how long the DNS record exists on the DNS server, is a value of the IP protocol packet that tells the router when the packet needs to be dropped. You can roughly determine whether the target system type is Windows series or UNIX/Linux series by the TTL value returned by Ping.

By default, the TTL value is 64 or 255 for Linux systems, 128 for Windows NT/2000/XP systems, 32 for Windows 98 systems, and 255 for UNIX hosts.

Therefore, the general TTL value:

Between 100~130ms, Windows system;

Between 240~255ms, UNIX/Linux system.

Of course, the main thing we know today is not these, but other references to ping.

The ping command has these usages in addition to directly pinging the IP address of the network, verifying network smoothness and speed.

The seven uses of the ping command, after reading it, you will become a god in an instant

Second, the use of ping -t

Ping the specified computer nonstop until the administrator interrupts.

The seven uses of the ping command, after reading it, you will become a god in an instant

This shows that the computer is connected to the router, and the network works well. Press and hold Ctrl+c of the keyboard to terminate it and continue ping, it will stop, and it will summarize how many packets are running and how many are connected.

Third, the use of ping -a

ping-a resolves computer names with NetBIOS names. That is, you can ping its IP address, and the host name can be resolved.

The seven uses of the ping command, after reading it, you will become a god in an instant

Fourth, the use of ping -n

By default, generally only four packets are sent, through this command you can define the number of sends, which is very helpful for measuring network speed, for example, I want to test the average return time of sending 10 packets, what is the fastest time, and what is the slowest time can be obtained by the following:

The seven uses of the ping command, after reading it, you will become a god in an instant

From the above, I can know that in the process of sending 10 packets to 47.93.187.142, 10 were returned without loss, and the fastest return speed of these 10 packets was 32ms, the slowest was 55ms, and the average speed was 37ms. Indicates that my network is good.

If for some bad networks, such as the monitoring system is very stuttering, such a test, the returned results may show that a part of the loss, if the loss is more, then it means that the network is not good, you can intuitively judge the situation of the network.

5. Use of ping -l size

-l size: Sends packets of the specified size to the destination host.

By default, Windows ping sends packets with a size of 32 bytes and a maximum of 65500 bytes. When a packet sent at a time is greater than or equal to 65500 byt, it may cause the receiver computer to go down. So Microsoft limited this number; This parameter is very harmful when combined with other parameters, for example, an attacker can combine the -t parameter to carry out DOS attacks. (So it is dangerous, do not easily use it on other people's computers).

For example: ping -l 65500 -t 211.84.7.46

The IP address will be pinged continuously until it is interrupted by the user with Ctrl+C.

The seven uses of the ping command, after reading it, you will become a god in an instant

In this way, it will keep sending 65500byt packets to the 211.84.7.46 computer, if you only have one computer may not have any effect, but if there are many computers then you can completely paralyze the other party, the network is seriously blocked, which shows that the power is not small.

The use of ping -r count

Record the routes of outgoing and return packets in the Log Routes field, probing through

The number of routes, but only a maximum of 9 routes can be traced.

ping -n 1 -r 9 202.102.224.25 (sends one packet, logs up to 9 routes)

The seven uses of the ping command, after reading it, you will become a god in an instant

The 9 routes will be displayed, you can see the figure above.

The ping command is used more in these 6 categories, and you may use it in the project.

7. Ping network blocks in batches

For a network segment with many IP addresses, if a single detection is really troublesome, then we can directly ping the network segment detection in batches, and the problem with that IP address is clear at a glance.

Let's look at the code first and enter it directly in the command line window:

for /L %D in (1,1,255) do ping 10.168.1.%D

Change the IP address block to the IP address block that you want to check.

The seven uses of the ping command, after reading it, you will become a god in an instant

When the batch command is entered, it will automatically ping all IP addresses in the network segment.

So what does this "for /L %D in(1,1,255) do ping 10.168.1.%D" code mean?

This (1,1,255) in the code is the beginning and beginning of the network segment, which is to detect all IP addresses between 192.168.1.1 and 192.168.1.255 in the network segment, incrementing by 1 each time, directly until the 255 IPs from 1 to 255 are detected.

Retweets are the biggest encouragement! Thank you for your support!