Common Network Commands for Low Voltage Applications

Common Network Commands for Low Voltage Applications

9 Common Network Commands, Very Practical!

Common Network Commands for Low Voltage Applications

1. ping Command

PING (Packet Internet Groper),

the Internet packet explorer, is a program used to test network connectivity. Ping operates in the TCP/IP network architecture at the application layer, primarily sending ICMP (Internet Control Message Protocol) Echo request messages to a specific destination host to test whether the destination is reachable and to understand its related status.

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’s input/output lines, cables, and routers, thereby narrowing down the scope of the problem.
Ping can display the time taken for a request to return in milliseconds. If the response time is short, it indicates that the datagram does not have to pass through too many routers or networks, resulting in a faster connection speed. Ping can also display TTL (Time To Live), which can be used to estimate how many routers the data packet has passed through.

Command Format

ping hostname

ping domain name

ping IP address

Common Network Commands for Low Voltage Applications
As shown in the image, using the ping command to check connectivity to the computer at IP address 192.168.1.1 shows a normal connection. Four test data packets were sent, and all four packets were correctly received.

Basic Applications of the ping Command

In general, users can use a series of ping commands to locate where the problem lies or to check the operational status of the network.
Below is a typical detection sequence and corresponding possible faults:

① 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 is unsuccessful, it indicates that there is a problem with the installation or settings of TCP/IP.

② ping local IP address

If the test is unsuccessful, it indicates that there is a problem with the local configuration or installation, and the network devices and communication media should be tested, checked, and ruled out.

③ ping other IPs in the local area network

If the test is successful, it indicates that the network card and carrier in the local network are operating correctly. However, if 0 echo responses are received, it indicates that the subnet mask is incorrect, the network card configuration is wrong, or there is a problem with the cabling system.

④ 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 problems with the ISP’s DNS).

⑥ ping localhost

Localhost is the system’s reserved name for the network; it is an alias for 127.0.0.1, and every computer should be able to resolve this name to that address. Otherwise, there is a problem with the host file (/Windows/host).

⑦ ping http://www.baidu.com (a well-known website domain)

Executing the ping command on this domain requires the computer to first resolve the domain name to an IP address, usually through a DNS server. If there is a failure here, it indicates that the local DNS server’s IP address configuration is incorrect, or that the DNS server being accessed has issues.
If all the ping commands listed above can run normally, then the computer generally has no issues with local and remote communication. However, the success of these commands does not mean that all your network configurations are problem-free; for example, certain incorrect subnet masks may not be detectable with these methods.

Common Options for the ping Command

**ping IP -t:** Continuously execute the ping command to the IP address until interrupted by the user with Ctrl+C.

**ping IP -l 2000:** Specify a specific data length (in this case, 2000 bytes) for the ping command instead of the default 32 bytes.

**ping IP -n 20:** Execute the ping command a specified number of times (in this case, 20).

Note: With the widespread use of firewall functionality in networks, when you ping other hosts or other hosts ping your host, and it shows that the host is unreachable, do not jump to conclusions. It is best to compare the ping results with a “well-configured” host.

2. ipconfig Command

If the computer and the local area network use DHCP, using the ipconfig command can help you understand whether your computer has successfully leased an IP address. If it has been leased, you can find out what address it currently has, including IP address, subnet mask, and default gateway network configuration information.
Below are the most commonly used options:
(1) ipconfig: When using the ipconfig command without any parameter options, it displays the IP address, subnet mask, and default gateway values for each configured interface.
(2) ipconfig /all: When using the all option, ipconfig can display all configured and used additional information for DNS and WINS servers, and it can show the physical address (MAC) built into the local network card. If the IP address is leased from a DHCP server, ipconfig will display the IP address assigned by the DHCP server and the expected expiration date of the leased address. The image shows the result window after running the ipconfig /all command.
Common Network Commands for Low Voltage Applications

(3) ipconfig /release and ipconfig /renew: These two additional options can only be used on computers that lease IP addresses from a DHCP server. If you enter ipconfig /release, all leased IP addresses for all interfaces are returned to the DHCP server (returned IP addresses).

If the user enters ipconfig /renew, the local computer attempts to contact the DHCP server and lease an IP address. In most cases, the network card will be re-assigned the same IP address as before.

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 the 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 physical addresses/IP addresses, which can help reduce the amount of information on the network by statically configuring commonly used hosts such as default gateways and local servers.
By default, the items in the ARP cache are dynamic; whenever data is sent to a specified location and the current item does not exist in the cache, ARP will automatically add that item.

Common Command Options:

① arp –a: Used to view all items in the cache.

Common Network Commands for Low Voltage Applications

② arp -a IP: If there are multiple network cards, using arp -a followed by the interface’s IP address will only display the ARP cache items related to that interface.

③ arp -s IP physical_address: Manually input a static item into the ARP cache. This item will remain valid during the computer’s boot process, or in case of errors, the manually configured physical address will automatically update this item.

④ arp -d IP: This command can manually delete a static item.

4. traceroute Command

Mastering the use of the traceroute command to measure routing conditions is essential, as it is used to display the path that data 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.
Common Network Commands for Low Voltage Applications

The output has 5 columns:

The first column describes the number of the nth hop along the path, which is the router number along that path;

The second column shows the first round-trip delay;

The third column shows the second round-trip delay;

The fourth column shows the third round-trip delay;

The fifth column shows the router’s name and its input port’s IP address.

If the source receives fewer than 3 packets from any given router (due to packet loss in the network), traceroute places an asterisk after that router number and reports less than 3 round-trip times to that router.
Additionally, the tracert command can be used to see the steps the network takes when connecting to a site or what route it takes. If there is a network failure, this command can help identify where the issue lies.

Considerations [Testing Routing in Large Networks]:

(1) Try the “ping www.sina.com.cn” operation multiple times and compare the IP addresses obtained for Sina. If the two ping results yield different IP addresses, consider the reasons (e.g., load balancing). Then, for these different IP addresses, execute the “tracert ip_address” command and observe whether there are differences in the output results.

(2) Conduct a traceroute test on a site in a large network, recording the test results. Observe whether there are instances where the nth hop’s delay is less than the n-1 hop’s delay. Try to analyze the reasons (hint: consider the roles of various components of delay in the total delay).

(3) At different times of the day, use the traceroute program to test the route from a fixed host to a remote fixed IP address multiple times. Try to analyze and compare the measurement data, observing whether the route changes? If so, how frequent is that change?

5. route Command

Most hosts generally reside in a subnet connected to only one router. Since there is only one router, there is no issue of which router to use to send packets to remote computers; the router’s IP address can serve as the default gateway for all computers in that subnet.
However, when there are two or more routers on the network, users may not want to rely solely on the default gateway. They might want certain remote IP addresses to be routed through a specific router, while other remote IPs go 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 tables 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; the output results for a single router subnet are shown in the image.
Common Network Commands for Low Voltage Applications

(2) route add: This command can 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 must pass through 5 router subnets, first passing through a local network router with an IP of 202.96.123.5 and a subnet mask of 255.255.255.224, the user should enter 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 modify the data transmission route; however, the user cannot use this command to change the destination of the data. The following example changes the previous route to one that includes a path of 3 subnets:

route add 209.99.32.33 mask 255.255.255.224 202.96.123.250 metric 3

(4) route delete: This command can remove routes from the routing table. For example: route delete 209.99.32.33

6. nslookup Command

The nslookup command is used to query the IP address of any machine and its corresponding domain name. It typically requires a domain name server to provide the domain name. If the user has set up a domain name server, they can use this command to view the IP addresses corresponding to different hosts.
(1) Use the nslookup command on the local machine to view the machine’s IP and domain name server address.
Simply type the command, and the system will return the server name (full name with domain) and IP address of the local machine, entering a command line state with “>” as the prompt; typing “?” will query detailed command parameters; to exit, type exit.
Common Network Commands for Low Voltage Applications

(2) View the IP of http://www.baidu.com. Simply enter the IP address or domain name you want to query at the prompt and press enter.

Common Network Commands for Low Voltage Applications

7. nbtstat Command

Using the nbtstat command can reveal some network configuration information on the computer. This command can also be used to find some private information on other computers.
If you want to view network information on your own computer, you can run nbtstat -n to get your workgroup, computer name, and network card address, etc.; to view the situation of other computers on the network, run nbtstat -a*… where …* is replaced with the IP address to return some information from that host.

8. netstat Command

Learn to use the netstat command to understand the current state of the network.
The netstat command can display active TCP connections, ports the computer is listening on, Ethernet statistics, IP routing tables, IPv4 statistics (for IP, ICMP, TCP, and UDP protocols), and IPv6 statistics (for IPv6, ICMPv6, TCP over IPv6, and UDP protocols). If used without parameters, netstat displays active TCP connections.
Common Network Commands for Low Voltage Applications

Below are some common options for netstat:

① netstat –a: The -a option displays a list of all valid connection information, including established connections (ESTABLISHED) and those connections that are listening for connection requests (LISTENING).

② netstat –n: Lists IP addresses in dot-decimal format instead of symbolic hostnames and network names.

Common Network Commands for Low Voltage Applications

③ netstat -e: The -e option displays statistics about Ethernet. It lists items including the total number of bytes sent, errors, drops, number of packets, and broadcasts. These statistics include both sent and received packet counts. This option can be used to assess basic network traffic.

④ netstat -r: The -r option displays information about the routing table, similar to what is seen with the route print command. In addition to displaying valid routes, it also shows current valid connections.

Common Network Commands for Low Voltage Applications
The above image shows a routing table where: Network Destination indicates the destination network; 0.0.0.0 indicates an unknown network, which is automatically generated by the system after setting the default gateway; 127.0.0.0 indicates the local network address used for testing; 224.0.0.0 indicates the multicast address; 255.255.255.255 indicates the limited broadcast address; Netmask indicates the network mask, Gateway indicates the gateway, Interface indicates the interface address, Metric indicates the number of hops in the route.

⑤ netstat -s: The -s option can display statistics for each protocol separately. This allows you to see which connections exist on the network and the details of packet sending and receiving, etc. If applications (like web browsers) are running slowly or cannot display web pages, this option can be used to check the displayed information. Carefully review the statistics in each row to find the keywords indicating errors, thus determining the problem.

Common Network Commands for Low Voltage Applications

9. net Command

Understand the functions of Net services and learn to use Net service commands to solve network-related issues.
Type net help command at the command line to get syntax help for net commands. For example, to get help information about the net accounts command, type “net help accounts”.
All net commands can use /y and /n command line options. For example, the net stop server command prompts the user to confirm stopping all dependent server services, while net stop server/y confirms stopping and shutting down server services.

The table below lists basic NET commands and their functions:

Common Network Commands for Low Voltage Applications
NET commands can provide all information in one place and can redirect the results to a printer or a standard text file.
Many of the network commands used by services start with net, and these net commands have some common properties. To see a list of all available net commands, you can type net/? in the command prompt window.

Disclaimer: Quality content is valuable for sharing with everyone. Some content is sourced from the internet; if there is any infringement, please inform us, and we will address it promptly. For collaboration and communication, please add WeChat ID:18821279660.

Leave a Comment