Ping, tracert, traceroute, and netstat commands

Source: Internet
Author: User
Tags traceroute command

Ping, tracert, traceroute, and netstat command to view the ubuntu running status command 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 1 minute, 5 Average load of minutes and 15 minutes 7.who view the total number of login users; whoami view the current user 8.top view process, Kill PID End Process pingping can test the computer name and computer ip address, verify the connection to the remote computer. Verify the connection to one or more remote computers by sending icmp ECHO packets to the computer and listening for echo response packets, this command can be used only 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 parameter-t ping the specified computer until it is interrupted. Ctrl + c stop-a resolve the address to the computer name. Example (homer-PC is the computer name):-l length sends an echo 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. comPING 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 ms64 bytes from 119.75.217.56: icmp_req = 2 ttl = 47 time = 53.0 ms64 bytes from 119.75.217.56: icmp_req = 3 ttl = 47 time = 52.1 ms64 bytes from 119.75.217.56: icmp_req = 4 ttl = 47 time = 53.1 MS traceroute in the Internet, information is transmitted through many segments of the network transmission medium and equipment (routers, switches, servers, gateways, etc) from one end to the other. 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 traceroute hostname command in a UNIX host system and run the Tracert command in Windows: tracerert hostnamehomer @ ubuntu :~ $ Traceroute www. google. comtraceroute 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 Gb/s (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 ms23 *** 24 hg-in-f104.1e100.net (74.125.128.104) 99.795 m S 98.241 MS 98.115 MS Parameters: tracert [-d] [-h maximum_hops] [-j computer-list] [-w timeout] target_name this diagnostic utility sends a message with different lifetime (TL) to the destination) to determine the route 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. The-d parameter specifies that the computer name is not resolved. -H maximum_hops specifies the maximum number of jumps to the target. -Jcomputer-list indicates Loose Source Route in computer-list. -W timeout: the number of milliseconds specified by timeout for each response. The name of the target machine of target_name. 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 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, a host in the United States http://bs.mit.edu:8001/cgi-bin/traceroute Query the data transmission path of the Arctic Star Site www.lodesoft.com (partner of China Webmaster Alliance) in Nanjing, China. The query interface is Traceroute Hack ------------------------------------------------------------------------------. You can search for this index. Please type the keyword to search: the query result is: Traceroute Hack1 E40-RTR-E40SERVER72-ETHER.MIT.EDU (18.72.0.1) 4 MS 4 MS 4 ms2 EXTERNAL-RTR-FDDI.MIT.EDU (18.168.0.12) 4 MS 4 MS 4 ms3 f1-0.cambridge2-br2.bbnplanet.net (192.233.33.6) 4 MS 4 MS 4 ms4 s11-0-1.cambridge1-br1.bbnplanet.net (4.0.1.201) 8 MS 4 MS 4 ms5 p1-0.cambridge1-nbr2.bbnplanet.net (4.0.1.45) 4 MS 4 MS 4 ms6 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 ms8 p2-1.nyc4-nbr3.bbnplanet.net (4.24.4.238) 8 MS 12 MS 12 ms9 p1-0.nyc4-nbr2.bbnplanet.net (4.0.5.25) 8 MS 12 MS 8 ms10 p4-0.sanjose1-nbr2.bbnplanet.net (4.0.5.97) 70 MS 70 MS 70 ms11 p1-0.sanjose1-nbr1.bbnplanet.net (4.0.5.85) 70 MS 70 MS 70 ms12 p4-0.paloalto-nbr2.bbnplanet.net (4.0.1.1) 70 MS 74 MS 70 ms13 p0-0-0.paloalto-cr18.bbnplane T.net (4.0.3.86) 70 MS 74 MS 74 ms14 h1-0.atteasylink.bbnplanet.net (4.1.142.254) 74 MS 74 MS 78 ms15 199.37.127.234 (199.37.127.234) 78 MS 74 MS 78 ms16 205.174.74.170 (small) 230 MS 238 MS 227 ms17 202.97.9.65 (202.97.9.65) 238 MS 231 MS 223 ms18 * Small (202.97.9.49) 234 MS * 19 202.97.10.110 (202.97.10.110) 246 MS 250 MS * 20 small (small) 234 MS 238 MS 238 ms21 20 2.102.24.74 (202.102.24.74) 234 MS 254 MS * v. Traceroute command parameters: Traceroute usage: traceroute [options] <IP-address or domain-name> [data size] [options] has the following content: [-n]: the displayed address is represented by numbers rather than symbols [-v]: Long output [-p]: UDP port settings (default: 33434) [-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. Working Principle of Traceroute: the simplest basic usage of Traceroute is that the traceroute hostnameTraceroute program is designed To use the 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 commands used for network testing the network is disconnected. When you seek help from the network management, you will often see the network management to detect and handle network faults. Some commands are used, understanding and understanding the following commands will help you detect network faults faster, saving time and improving efficiency. PingPing is a useful tool for testing the network connection status and packet sending and receiving status. It is the most commonly used 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 IP address or host name [-t] [-a] [-n count] [-l size] parameter meaning:-t continuously sends data to the target host; -a displays the network address of the target host in the IP address format.-n count specifies the number of Ping attempts, and the specific number of times is specified by count; -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. The TracertTracert 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 meaning:-d does not parse the name of the target host; -h maximum_hops: specifies the maximum number of hops to search for the target address.-j host_list releases the source route according to 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. The NetstatNetstat 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 meaning:-r displays the content of the local route table; -s displays the usage status of each Protocol (including TCP, UDP, and IP);-n displays the address and port in a digital table;-a displays the port numbers of all hosts. The WinipcfgWinipcfg 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 meaning:/all displays all configuration information about IP addresses;/batch [file] writes command results to the specified file;/renew _ all retries all network adapters; /release_all release all network adapters;/renew N reset network adapter N;/release N release network adapter N. In Microsoft Windows 95 and later operating systems, you can run the preceding command ******************** Ipconfig. Ipconfig is a common command for debugging computer networks, it is usually used to display the IP address, subnet mask, and default gateway of the network adapter in the 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 (NIC, 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. The/batch file name writes 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 release the 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 re-allocates IP addresses for 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 Instance 1. Backup network settings ipconfig/batch bak-netcfg Description: Back up network configuration information to the bak-netcfg file. 2. dynamically allocate a new IP address for the network adapter ipconfig/release 1 Description: remove the dynamic IP address of the network adapter (adapter 1. Ipconfig/renew 1 Description: redynamically allocates IP addresses for NICs. DNS: 8.8.8.8 and 8.8.4.4

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.