Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the ping command of Linux system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use the ping command of the Linux system, the article is very detailed, has a certain reference value, interested friends must read it!

I believe that the ping command is all too familiar, but there are not many people who can maximize the function of ping. Of course, I am not saying that I can make the most of ping. I just often use ping as a tool.

I. detailed explanation of the basic use of ping

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

It is used to detect the connectivity of the network and analyze the network speed according to the domain name to get the server IP to judge the operating system used by the other party and the number of packets passing through the router according to the TTL value returned by ping.

We usually use it to directly ping ip addresses to test network connectivity.

Such as this, direct ping ip address or gateway, ping will display the above data, some friends may ask, bytes=32;time

Bytes value: packet size, that is, bytes.

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

The TTL value: Time To Live, which indicates that DNS records how long it has been 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 size of the TTL value returned by Ping.

By default, the TTL value of the Linux system is 64 or 255. The TTL value is 128 for the Windows98 system, the TTL value is 32, and the TTL value for UNIX hosts is 255.

Therefore, the general TTL value:

Between 100~130ms, Windows system

Between 240~255ms, UNIX/Linux system.

Of course, our main understanding today is not these, but other references to ping.

The ping command has these uses in addition to directly ping the ip address of the network to verify the availability and speed of the network.

II. The use of ping-t

Ping the designated computer uninterruptedly until the administrator interrupts.

This shows that the computer is connected to the router, and the network effect is very good. Press and hold the Ctrl+c on the keyboard to stop ping, and it will stop, and it will summarize how many packets are running and how many are turned on and off.

III. The use of ping-a

Ping-a parses the computer name and the NetBios name. It is possible to resolve the host name by ping its ip address.

The use of ping-n

By default, only four packets are sent. You can define the number of packets sent by yourself through this command, which is very helpful to measure the speed of the network. For example, I want to test the average return time of sending 10 packets. The fastest time and the slowest time can be obtained by the following:

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

If some bad networks, such as the monitoring system, are very stuttered, the test results may show that some of them are missing. If more are lost, it means that the network is not good. The situation of the network can be judged intuitively.

5. The use of ping-l size

-l size: sends packets of the size specified by size to the target host.

By default, the ping of Windows sends a packet size of 32byt, which can send a maximum of 65500byt. When the packet sent at one time is greater than or equal to 65500byt, it may cause the receiver computer to downtime. So Microsoft limits this value; this parameter can be very harmful in combination with other parameters, such as attackers can carry out DOS attacks with the-t parameter. So it is dangerous, don't use it easily from other people's computers.

For example: ping-l 65500-t 211.84.7.46

The ping command is executed continuously on the IP address until it is interrupted by the user with Ctrl+C.

In this way, it will keep sending data packets of 65500byt size to 211.84.7.46 computer, if you have only one computer, it may not be effective, but if you have many computers, it can completely paralyze the other party, and the network is seriously blocked, which shows that it is very powerful.

VI. The use of ping-r count

Record the routes of outgoing and return packets in the record Route field, and detect the

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

Ping-n 1-r 9 202.102.224.25 (send one packet and record up to 9 routes)

All nine routes will be shown, as shown in the figure above.

The ping command is mostly used in these six categories, which you may use in the project.

7. Batch Ping network segments

For a network segment with a large number of ip addresses, if a single detection is really troublesome, then we can directly batch ping network segment detection, which ip address has a problem, at a glance.

First look at the code and enter it directly in the command line window:

For / L% D in (1jie 1255) do ping 10.168.1% D

Change the IP address field to the IP address field you want to check

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

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

The one in the code (1re1255) is the beginning and beginning of the network segment, that is, it detects all the ip addresses of the network segment from 192.168.1.1 to 192.168.1.255, increasing by 1 at a time, directly to the end of the detection of the 255 ip from 1 to 255.

The above is all the contents of this article entitled "how to use ping commands in Linux system". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report