Ping, tracert, traceroute, and netstat commands

Source: Internet
Author: User

Command for viewing Ubuntu running status

1. route to view and set the route information for Linux 2. ping: network connectivity check example: Ping 192.168.0.1 parameter:-C is used to specify the number of Ping responses. Example: Ping-C 4 192.168.0.1 the specified number of responses is 4 3. traceroute is used to analyze the network topology format: Traceroute Remote Host IP address or domain name 4. netstat is used to view the network connection status without any parameters. Only the active TCP and UDP port status netstat-A is displayed. all network connections netstat-R are displayed: check the route tables netstat-S: view the running statistics of various network protocols. 5. vmstat outputs 6 categories: process, memory, swap zone, I/O, system, and CPU 6. uptime output has run time, current time and number of users, and average load of 1 minute, 5 minutes, and 15 minutes
7. view the total number of login users by WHO; view the current user by whoami

8. view the process on top. For details about kill PID termination process, refer

Ping

Ping can test the computer name and computer ip address, verify the connection with the remote computer, verify the connection to one or more remote computers by sending ICMP echo data packets to the computer and listening for echo response data packets. This command can only be used after the TCP/IP protocol is installed.

Ping [-T] [-A] [-N count] [-l length] [-F] [-I TTL] [-V TOS] [-r count] [- s count] [[-J computer-list] | [-K computer-list] [-W timeout] destination-list

Parameters

-T ping the specified computer until it is interrupted. CTRL + C stop

-A resolves the address to the computer name. Example (Homer-PC is the computer name ):

-L length sends the echo data packet containing the data volume specified by length. The default value is 32 bytes. The maximum value is 65,527.

-F sends the "Do Not segment" flag in the data packet. Packets are not segmented by the gateway on the route.

-I TTL: Set the TTL field to the value specified by TTL.

-V tos: Set the "service type" field to the value specified by TOS.

-R count records the routes of outgoing and returned packets in the "Record Route" field. Count can specify at least one computer and a maximum of nine computers.

-S count specifies the timestamp of the number of hops specified by count.

-J computer-list uses the computer list specified by computer-list to route data packets. The maximum number of consecutive computers that can be separated by the Intermediate Gateway (routing sparse source) IP addresses is 9.

-K computer-list uses the computer list specified by computer-list to route data packets. The maximum number of IP addresses allowed by consecutive computers to be separated by intermediate gateways (strictly source routes) is 9.

-W timeout specifies the timeout interval, in milliseconds.

Destination-List specifies the remote computer to be pinged.

Homer @ Ubuntu :~ $ Ping www.baidu.com
Ping www.baidu.com (119.75.217.56) 56 (84) bytes of data.
64 bytes from 119.75.217.56: icmp_req = 1 TTL = 47 time = 52.0 MS
64 bytes from 119.75.217.56: icmp_req = 2 TTL = 47 time = 53.0 MS
64 bytes from 119.75.217.56: icmp_req = 3 TTL = 47 time = 52.1 MS
64 bytes from 119.75.217.56: icmp_req = 4 TTL = 47 time = 53.1 MS

Traceroute

In the Internet, information is transmitted from one end to the other through transmission media and devices (routers, switches, servers, gateways, etc.) in many segments in the network. Each device connected to the Internet, such as a host, router, or access server, usually has an independent IP address. With traceroute, we can know the path from your computer to the host on the other end of the Internet. Of course, the path for each packet to arrive at the same destination from a certain source may be different, however, most of the time the routes are the same.

UNIX is traceroute, Windows is tracert.

Traceroute sends a small packet to the target device until it returns, to measure how long it takes. Traceroute of each device in a path must be tested three times. The output results contain the time (MS) of each test, the name of the device (if any), and its IP address.
In most cases, as a network engineering technician or system administrator, you can directly execute the command line on a unix host system:
Traceroute hostname
In Windows, the tracert command is executed:
Tracerert hostname

Homer @ Ubuntu :~ $ Traceroute www.google.com
Traceroute to www.google.com (74.125.128.104), 30 hops Max, 60 byte packets
1 192.168.1.1 (192.168.1.1) 0.449 MS 0.311 MS 0.330 MS
2 211.103.207.17 (211.103.207.17) 1.685 MS 2.035 MS 2.253 MS
...
22 216.239.43.17 (216.239.43.17) 98.035 MS 216.239.43.19 (216.239.43.19) 97.129 MS 209.85.253.71 (209.85.253.71) 101.158 MS
23 ***
24 hg-in-f104.1e100.net (74.125.128.104) 99.795 MS 98.241 MS 98.115 MS

Parameter description:
Tracert [-D] [-H maximum_hops] [-J computer-list] [-W timeout] target_name
The diagnostic utility determines the route to the destination by sending an Internet Control Information Protocol (CMP) response packet with different TTL (TL) to the destination. Each vro on the path must reduce the TTL value by at least 1 before forwarding the ICMP Response Message. Therefore, TTL is a valid redirect count. When the TTL value of the packet is reduced to 0, the router sends the ICMP timeout message to the source system. Tracert can determine the route by sending the first response packet whose TTL is 1 and adding the TTL value to 1 each time in subsequent sending until the target response or the maximum TTL value is reached. Check the ICMP timeout (IME exceeded) Information sent back by the Intermediate router to determine the router. Note that some routers "quietly" discard the expired packets of the time-to-live (TLS) and are invalid for tracert.
Parameters
-D
Specifies an invalid computer name resolution address.
-H maximum_hops
Specify the maximum number of jumps to the target.
-Jcomputer-list
Loose Source Route in computer-list.
-W timeout
Wait for the number of milliseconds specified by timeout for each response.
Target_name
The name of the target computer.
2. What is traceroute gateway -- traceroute Gateway?
Generally, traceroute (or tracert) is based on a single host, however, you can only know the routing quality and data transmission efficiency of any online host on the Internet from the host at hand as the source address. Instead, you can use a web-based approach, as long as a host is installed with a specific CGI program, you can run the relevant program on this host to execute the traceroute function. This host is called the traceroute gateway. The traceroute gateway helps you understand the topology of the physical and logical connections of the network and the efficiency of data transmission. If there are enough gateways, we can easily understand the connection between hosts.
3. Why traceroute?
1. Almost everyone on the Internet (especially webmaster) cares about the connection, routing, connection time, and speed between their computers (or other devices) and the Internet. The traceroute gateway service provided by the regional webmasters organized by chiannetmap will give you a satisfactory answer. From your computer to any other place, chinanetmap (traceroute) can provide each device (IP address) and its connection time. It allows you to draw a path through the network.
2. Many companies and organizations have or are setting up their own servers-especially Web servers. Once you have your own web servers, as the number of Internet users increases (including potential Internet users that cannot be counted), you must be wondering if they can connect to you. How your ISP connects to one or more nap and their connection efficiency will directly affect your connection quality.
3. when you select ISP, backbone network connection, and the host of your site, most knowledgeable netizens like to check the connection performance of the site and how other websites can be connected exactly to and where they are connected. Chinanetmap (traceroute) will give you a perfect answer.
Iv. traceroute features:
Traceroute was first written by Van Jacob son in 1988. At that time, he mainly solved some network problems he encountered. Traceroute is an important tool to correctly understand the IP network and the routing principle. They are a convenient program for the webmaster responsible for network engineering technology and system management.
For ISP, the establishment of traceroute gateway will enable network service providers to help users establish and maintain confidence in the service quality of service providers. ISP with high service quality can set up traceroute gateway to help users understand the efficiency of network connection and data transmission. Of course, ISPs with poor infrastructure and low service quality are afraid of providing such services. As a result, you can use this tool to understand the current network connection status of the service provider.
After a host has installed the relevant traceroute CGI program, you can enter the IP address or name of the target host to obtain the relevant data:
For example: in the United States host http://bs.mit.edu: 8001/cgi-bin/Traceroute
Query the data transmission path of the Polaris site www.lodesoft.com (a partner of the China webmaster Alliance) in Nanjing, China.
The query interface is:
Traceroute hack
--------------------------------------------------------------------------------

You can search for this index. Enter a keyword:
The query result is:
Traceroute hack
1 E40-RTR-E40SERVER72-ETHER.MIT.EDU (18.72.0.1) 4 MS 4 MS
2 EXTERNAL-RTR-FDDI.MIT.EDU (18.168.0.12) 4 MS 4 MS
3 f1-0.cambridge2-br2.bbnplanet.net (192.233.33.6) 4 MS 4 MS
4 s11-0-1.cambridge1-br1.bbnplanet.net (4.0.1.201) 8 MS 4 MS 4 MS
5 p1-0.cambridge1-nbr2.bbnplanet.net (4.0.1.45) 4 MS 4 MS 4 MS
6 p4-1.bstnma1-ba1.bbnplanet.net (4.0.2.170) 4 MS 4 MS 4 MS
7 p1-0.bstnma1-ba2.bbnplanet.net (4.24.4.194) 4 MS 8 MS
8 p2-1.nyc4-nbr3.bbnplanet.net (4.24.4.238) 8 MS 12 MS 12 MS
9 p1-0.nyc4-nbr2.bbnplanet.net (4.0.5.25) 8 MS 12 MS 8 MS
10 p4-0.sanjose1-nbr2.bbnplanet.net (4.0.5.97) 70 MS 70 MS 70 MS
11 p1-0.sanjose1-nbr1.bbnplanet.net (4.0.5.85) 70 MS 70 MS 70 MS
12 p4-0.paloalto-nbr2.bbnplanet.net (4.0.1.1) 70 MS 74 MS 70 MS
13 p0-0-0.paloalto-cr18.bbnplanet.net (4.0.3.86) 70 MS 74 MS 74 MS
14 h1-0.atteasylink.bbnplanet.net (4.1.142.254) 74 MS 74 MS 78 MS
15 199.37.127.234 (199.37.127.234) 78 MS 74 MS 78 MS
16 205.174.74.170 (205.174.74.170) 230 MS 238 MS 227 MS
17 202.97.9.65 (202.97.9.65) 238 MS 231 MS 223 MS
18*202.97.9.49 (202.97.9.49) 234 MS *
19 202.97.10.110 (202.97.10.110) 246 MS 250 MS *
20 202.97.24.178 (202.97.24.178) 234 MS 238 MS 238 MS
21 202.102.24.74 (202.102.24.74) 234 MS 254 MS *
V. Command Parameters of traceroute:
Traceroute usage: Traceroute [Options] <IP-address or domain-name> [data size]
[Options:
[-N]: The displayed address is represented by numbers rather than symbols.
[-V]: Long output
[-P]: UDP port settings (33434 by default)
[-Q]: set the number of TTL tests (3 by default)
[-T]: Set the service type of the test package.
[Data size]: The Data byte length of each test package (38 by default)

6. How traceroute works:
Traceroute: Traceroute hostname
The traceroute program is designed to use the TTL (time to live) field of ICMP and IP header ). First, traceroute sends an IP datasync whose TTL is 1 (in fact, three 40-byte packets are sent each time, including the source address, destination address, and time tag sent by the package) to the destination, when the first router in the path receives the datax, it will reduce the TTL by 1. At this time, the TTL is changed to 0, so the vro will discard the datax and send back an "ICMP time exceeded" message (including the source address of the IP packet, all the content of the IP packet and the IP address of the router). After receiving the message, traceroute will know that the router exists in this path, and then traceroute will send a data packet whose TTL is 2, 2nd vrouters found ...... traceroute adds the TTL of the sent dataphin to 1 to find another vro. This repeated action continues until a dataphin reaches its destination. When datax arrives at the destination, the host does not return the ICMP time exceeded message because it is already the destination. How does traceroute know that the destination has arrived?
When traceroute sends a UDP batch Rams to the destination, the port number it chooses to deliver is a number that is not used by general applications (more than 30000 ), therefore, when the UDP datax arrives at the destination, the host will return an "ICMP port unreachable" message. When traceroute receives the message, it will know that the destination has arrived. Therefore, traceroute does not have a daemon program on the server.
Traceroute extracts the IP address of the device that sends the icmp ttl expired message for domain name resolution. Each time, traceroute prints a series of data, including the domain name and IP address of the route device that passes through, and it takes time for three packets to go back and forth.
Traceroute face = "" has a fixed waiting time for response (icmp ttl expired message ). If this time expires, it prints a series of * numbers indicating that the device cannot send an icmp ttl expiration message response within the specified time on this path. Then, traceroute adds 1 to the TTL recorder and continues.

* ****** Common network test commands

 

 

The network is disconnected. When you turn to the network management, you will often see the network management to detect and handle network faults. Using some commands, understanding and understanding the following commands will help you detect network faults more quickly, this saves time and improves efficiency.

Ping
Ping is a useful tool for testing network connectivity and packet sending and receiving conditions. It is the most common command for network testing. Ping sends a send-back request packet to the target host (address), and requests the target host to reply after receiving the request to determine the network response time and whether the host is connected to the target host (address.

If Ping fails, you can predict that the fault may occur in the following aspects: network cable failure, incorrect network adapter configuration, and incorrect IP address. If the Ping is successful and the network is still unavailable, the problem may be caused by the software configuration of the network system. If the Ping is successful, only a physical path connecting the local host to the target host can be guaranteed.

Command Format:
Ping the IP address or host name [-T] [-A] [-N count] [-l size]

Parameter description:
-T continuously sends data to the target host;

-A displays the network address of the target host in the IP address format;

-N count: the number of Ping attempts. The Count parameter specifies the number of Ping attempts;

-L size indicates the size of the data packet sent to the target host.

For example, if your machine cannot access the Internet, you must first check whether the local area network is faulty.
. Assuming that the IP address of the proxy server on the LAN is 202.160.1, you can run the ping command to avoid 202.160.1 to check whether the local host is connected to the proxy server. For example, the common command to test whether the local Nic is correctly installed is Ping 127.0.0.1.

Tracert
The tracert command is used to display the path through which data packets arrive at the target host and the time when data packets arrive at each node. The command function is similar to the ping command, but the information obtained is much more detailed than the ping command. It displays all the paths of data packets, the IP addresses of nodes, and the time spent. This command is applicable to large networks.

Command Format:
Tracert IP address or host name [-D] [-H maximumhops] [-J host_list] [-W timeout]

Parameter description:
-D does not parse the name of the target host;

-H maximum_hops specifies the maximum number of hops that can be found for the target address;

-J host_list: Release the source route based on the address in the host list;

-W timeout specifies the timeout interval. The default time unit of the program is milliseconds.

For example, if you want to know the detailed transfer path information between your computer and the target host www.cce.com.cn, you can enter tracertwww.ccidnet.com in MS-DOS mode.

If we add some parameters after the tracert command, we can also detect other more detailed information. For example, we can use the-D parameter to specify the path information of the host when the program tracks the host, the domain name of the target host is also resolved.

Netstat
The netstat command helps the network administrator understand the overall network usage. It displays the details of the currently active network connection, such as network connection, route table, and network interface information. It can calculate which network connections are currently running.

Using command parameters, the command can display the usage status of all protocols, including TCP, UDP, and IP. In addition, you can select a specific protocol and view its specific information, the port numbers of all hosts and Detailed Routing Information of the current host are displayed.

Command Format:
Netstat [-R] [-S] [-N] [-A]

Parameter description:
-R: displays the content of the local route table;

-S: displays the usage status of each Protocol (including TCP, UDP, and IP );

-N: the address and port are displayed in a digital table;

-A: displays the port numbers of all hosts.

Winipcfg
The winipcfg command displays the specific configuration information of the IP protocol in a window. The command displays the physical address of the network adapter, the IP address of the host, the subnet mask, and the default gateway, you can also view the host name, DNS server, node type, and other information. The physical address of the network adapter is useful when detecting network errors.

Command Format:
Winipcfg [/?] [/All]

Parameter description:
/All: displays all IP address configurations;

/Batch writes command results to the specified file;

/Renew _ all retry all network adapters;

/Release_all release all network adapters;

/Renew n reset network adapter N;

/Release N Release network adapter n.

You can run the preceding commands in Microsoft Windows 95 and later operating systems.
* ****************** Xiang Jie ipconfig

Ipconfig details

 

Ipconfig is a common command for debugging computer networks. Generally, you can use it to display the IP addresses, subnet masks, and default gateways of network adapters in your computer. In fact, this is only the use of ipconfig without parameters, and its use with parameters is quite good in network applications.

1. parameter description

1./All

Displays the complete TCP/IP configuration information for all network adapters (network adapters, dial-up connections, etc. Compared with the usage without parameters, it provides more information, such as whether the IP address is dynamically allocated and the physical address of the NIC is displayed.

2./batch file name

Write the information displayed in ipconfig to the specified file in text format. This parameter can be used to back up the network configuration of the local machine.

3./release_all and/release N

Releases Dynamic IP addresses allocated by DHCP for all (or specified) adapters. This parameter is applicable to non-static Nic IP addresses. It is usually used in combination with the following renew parameter.

4. ipconfig/renew_all or ipconfig/Renew n

Assign IP addresses to all (or specified) adapters. This parameter is also applicable only to non-static Nic IP addresses. It is usually used in combination with the preceding release parameter.

II. Application Instances

1. Backup network settings

Ipconfig/batch Bak-netcfg

Note: Back up network configuration information to the Bak-netcfg file.

2. dynamically allocate a new address for the NIC

Ipconfig/Release 1

Remove the dynamic IP address of the network adapter (adapter 1.

Ipconfig/Renew 1

Redynamically allocates IP addresses for NICs.

DNS:

8.8.8.8 and 8.8.4.4

 

Reprinted statement:This article from http://hi.baidu.com/goodlucklytimes/blog/item/2b22b6d1e01207309a50276f.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.