Many low-voltage engineers often encounter network faults in projects that require detection and localization of the fault points through various commands. By using network commands, the troubleshooting work can achieve significant efficiency. Let’s review and learn anew!
1. Ping Command (Internet Packet Explorer)
The ping command is a highly utilized utility primarily used to determine network connectivity. This is very useful for determining whether the network is correctly connected and the status of the network connection. In simple terms, ping is a testing program; if ping runs correctly, it generally rules out faults in the network access layer, network card, Modem input/output lines, cables, and routers, thereby narrowing down the problem.
1. Basic Applications of the Ping Command
Typically, users can use a series of ping commands to find out where the problem lies or to check the network’s operational status. Below is a typical detection sequence and corresponding possible faults:
Pinging the Baidu website on Windows 7
Note: The response time shown as Time=25ms indicates that the smaller this time is, the faster you can connect to this address.
① ping 127.0.0.1
If the test is successful, it indicates that the network card, TCP/IP protocol installation, IP address, and subnet mask settings are normal. If the test fails, it indicates a problem with the TCP/IP installation or settings.
② ping local IP address
If the test fails, it indicates a problem with local configuration or installation, and network devices and communication media should be tested, checked, and troubleshooted.
③ ping other IPs within the local area network
If the test is successful, it indicates that the network card and medium in the local network are functioning correctly. However, if no echo responses are received, it indicates an incorrect subnet mask, network card configuration error, or cable system issue.
④ ping gateway IP
If this command responds correctly, it indicates that the gateway router in the local area network is operational and can respond.
⑤ ping remote IP
If a correct response is received, it indicates successful use of the default gateway. For dial-up internet users, it indicates successful access to the Internet (but does not rule out potential DNS issues with the ISP).
2. Ping Command Parameters
In the DOS window, type ping /? (note that there is a space after ping, which cannot be omitted), or simply type ping followed by a space. Pressing Enter will display the help description for the ping command.
Ping command parameters
3. Example: Testing Target and Performing Name Resolution.
C:>ping –a target IP address
2. ipconfig (Display IP Configuration Values)
IPConfig can be used to display the current TCP/IP configuration settings.
In simple terms, the ipconfig command allows us to quickly obtain the computer’s current IP address, subnet mask, and default gateway information, all of which are essential for testing and fault analysis. Additionally, this command can also clear the DNS cache.
1. ipconfig Command Parameters
Commonly, the most used command is: ipconfig/all, which displays the complete configuration information. For example:
3. arp Command (Address Resolution Protocol)
ARP is an important protocol in the TCP/IP protocol suite, used to determine the physical address of the network card corresponding to an IP address.
Using the arp command, you can view the current contents of the ARP cache on the local computer or another computer. Additionally, the arp command can manually set static pairs of network card physical addresses/IP addresses, which can be used for local static configuration of commonly used hosts such as default gateways and local servers, helping to reduce the amount of information on the network.
By default, the entries in the ARP cache are dynamic; whenever data is sent to a specified destination and the current entry does not exist in the cache, ARP automatically adds that entry.
Common Command Options:
① arp –a: Used to view all entries in the cache.
② arp -a IP: If there are multiple network cards, using arp -a followed by the interface’s IP address will display only the ARP cache entries related to that interface.
③ arp -s IP physical address: Manually input a static entry into the ARP cache. This entry will remain valid during the computer’s boot process, or the manually configured physical address will automatically update the entry in case of an error.
④ arp -d IP: This command can manually delete a static entry.
4. traceroute Command
Mastering the use of the traceroute command to measure routing situations means displaying the path that packets take to reach the destination host.
The basic usage of the traceroute command is to type “tracert host_name” or “tracert ip_address” at the command prompt, where tracert is the name of traceroute in the Windows operating system.
The output has 5 columns:
The first column describes the n-th hop along the path, which is the router’s sequence number along that path;
The second column is the first round-trip time;
The third column is the second round-trip time;
The fourth column is the third round-trip time;
The fifth column is the router’s name and its input port’s IP address.
If the source receives fewer than 3 messages from any given router (due to packet loss in the network), traceroute will place an asterisk after that router number and report fewer than 3 round-trip times to that router.
Additionally, the tracert command can also be used to see the steps the network takes when connecting to a site or which route it takes. If there is a network failure, this command can be used to identify where the problem occurs.
【How to Test Routing in Large Networks】:
(1) Try the “ping www.sina.com.cn” operation multiple times and compare the IP addresses obtained from Sina. If the IP addresses obtained from two pings are different, consider the reasons (such as load balancing). Then, for these different IP addresses, execute the “tracert ip_address” command and observe if there are differences in the output results.
(2) Perform a traceroute test on a site in a large network, recording the test results. Observe whether the n-th hop’s latency is less than that of the n-1 hop. Try to analyze the reasons (hint: consider the roles of the various components of latency in total latency).
(3) At different times of the day, use the traceroute program multiple times to test the routing from a fixed host to a remote fixed IP address. Analyze and compare the measurement data to see if the route changes? If so, does the change occur frequently?
5. route Command
However, when there are two or more routers on the network, users may not want to rely solely on the default gateway. In fact, they may want certain remote IP addresses to be transmitted through a specific router while other remote IPs are transmitted through another router. In this case, users need the corresponding routing information, which is stored in the routing table. Each host and router has its own unique routing table. Most routers use specialized routing protocols to exchange and dynamically update routing tables between routers. However, in some cases, it is necessary to manually add entries to the routing table on routers and hosts. The route command is used to display, manually add, and modify routing table entries. This command can use the following options:
1. route print: This command is used to display the current entries in the routing table, and the output result on a single router segment is shown in the figure.
2. route add: This command can be used to add routing entries to the routing table.
For example, if you want to set a route to the destination network 209.99.32.33, which passes through 5 router segments, first through a local network router with IP 202.96.123.5 and subnet mask 255.255.255.224, the user should input the following command:
route add 209.99.32.33 mask 255.255.255.224 202.96.123.5 metric 5
3. route change: This command can be used to modify the data’s transmission route, but the user cannot use this command to change the destination of the data. The following example changes the previous route to use a path containing three segments:
route add 209.99.32.33 mask 255.255.255.224 202.96.123.250 metric 3
4. route delete: This command can be used to delete routes from the routing table. For example: route delete 209.99.32.33
6. Release IP/Renew IP Command
If the operating system of the computer being used is Windows, when the network is unable to connect or the IP address conflicts, you can use the command to first release the IP address and then renew it to solve the IP address conflict issue.
Command:
ipconfig /release to release the IP address.
Then, you also need to use ipconfig /renew to renew it.
Let’s see how they solve the problem:
1. First release the network IP addressipconfig /release
At this point, the network will be disconnected, and no IP address will be allocated since the IP address has been released.
2. Renew the IP address, ipconfig /renew,
At this point, the network will reconnect, but the IP address will be different from the original one, as a new available IP address has been allocated to connect to the network.
These commands are commonly used, and mastering them can resolve most network issues in low-voltage systems without needing external help.
Source: Low Voltage Industry Network