There are several cmd network troubleshooting commands available in networking that can be used to verify the connectivity of networking devices. These procedures are also necessary for troubleshooting devices. We will talk about a few networking commands like ping, ipconfig , ipconfig/all , nslookup , tracert, netstat, getmac, hostname, systeminfo, telnet commands. There are many different tools and techniques that can be used for network troubleshooting.
Commands
-
First press windows+R button.
-
In the search option write cmd . Then your command prompt will get open.
1. Ping Command
Ping (or ping) is the most commonly known network troubleshooting command and is available for all operating systems with networking capabilities.
To use the ping command, go to the command prompt and enter ‘ping’ followed by the IP address or the URL.
Run This Command as:
ping www.google.com -t or ping 8.8.8.8 -t
Test the network connection with a remote IP address
ping-t [IP or host] ping-l 1024 [IP or host]
The -t option to ping continuously until Ctrl-C is pressed.
If you specify the -t option you can always get statistics without interrupting pings by pressing Ctrl + Break
Ping utilizes an IP network to transmit an ICMP echo request to a host computer. If the host can be reached, it responds with an ICMP echo reply, reporting the time it took to connect as well as additional information like faults or packet loss.
2. IpConfig Command
This command gives you information such as an IPv4 address, a subnet mask, or the default gateway.
The boundaries of our internet connection is represented by the subnet mask.
The default gateway is the router’s address that our computer accesses initially when attempting to connect to a device that is not on our local network.
The device we are now working on’s IP address settings can be viewed in detail using the IPCONFIG network command. This command tells us the physical address of our device.
The primary command that targets particular system settings or data also offers us some variations through the IPConfig command, which are:
- IPConfig/all – Provides primary output with additional information about network adapters.
- IPConfig/renew – Used to renew the system’s IP address.
- IPConfig/release – Removes the system’s current IP address.
Command to enter in Prompt – ipconfig
3.nslookup Command
nslookup is a command-line utility used to query Domain Name System (DNS) servers to learn about domain names and IP addresses. The majority of operating systems, including Windows, macOS, and Linux, support it. Nslookup can be used for a number of DNS-related tasks, including debugging DNS-related problems and examining the DNS records (A, CNAME, MX, etc.) connected to a domain.
To use nslookup, follow these steps:
Open a command prompt or terminal window on your computer.
Type nslookup followed by the domain name or IP address you want to query.
Run this command as,
nslookup www.google.com
nslookup www.youtube.com
4. Tracert Command
On Windows OS the tracert command is a network diagnostic tool. It enables you to track the route that packets follow in order to get to a certain host or IP address. Tracert can be used to diagnose network connectivity problems and discover the path that data packets take when traveling across the Internet or a local network. This command will give tracing route with maximum 30 hopes
5. Netstat command
To display a list of active network connections with their local and remote addresses and port numbers use: netstat -an
To display network statistics, including the number of bytes sent and received use : netstat -s
To view active network connections with the associated process IDs (PIDs) use : netstat -ano
To show the routing table use : netstat -r
netstat provides valuable information for network troubleshooting and monitoring.
You can use it to check which ports are in use, identify active network connections, view routing information. In netstat command there are various subcommands such as netstat -n, netstat -a, netstat -b, netstat -f.-a Displays all connections and listening ports
-e Displays Ethernet statistics. Can be combined with the -s option.
-n Displays addresses and port numbers in numerical form.
-p proto Shows connections for the protocol specified by proto, proto
may be TCP or UDP.
-r Displays the contents of the routing table.
-s Displays statistics by protocol. By default, statistics on TCP, UDP and IP are displayed
6. Getmac command
The getmac
command is useful for identifying the MAC addresses of network adapters on your Windows computer, which can be helpful in various networking and troubleshooting. This command will display a list of MAC addresses associated with network adapters on your computer. The list typically includes both physical network adapters (such as Ethernet cards) and virtual adapters (such as VPN or virtual machine network adapters).
To use the getmac
command, follow these steps:
- Open a Command Prompt window. You can do this by searching for “cmd” or “Command Prompt” in the Start menu.
- In the Command Prompt window, type the following command: getmac
7. Hostname command
This command is used for getting current hostname of computer or laptop in network. Command to enter in cmd is hostname and then enter you will get hostname of your device. Displays the name of the machine.
Run Command in CMD as:
hostname
8. systeminfo command
Using the SYSTEMINFO command, we will get the system’s hardware and software details, such as processor data, bios version details, network data, Windows version, etc.
Command to enter in Prompt –
systeminfo
9. Telnet command
This command is used to check port is open or not. Telnet is a client-server protocol predating the TCP protocol. Defaults telnet is disable in windows environment. We have to enable it using below steps as:
Step 1: Enable Telnet using GUI in Win 10 or Win 11
1. Open the Programs and Features options in Control Panel
2. Click the Turn Windows features on or off
3. Search the Telnet Client option on the list, select it and click OK to install the feature:
4. After successful activated click Close.
5. Now Open the command prompt and run telnet to open the Microsoft Telnet Client:
Step 2: Enable Telnet Using Command Prompt
To activate the Telnet client from the command prompt:
1. In the command prompt, run:
pkgmgr /iu:"TelnetClient"
2. Restart the command prompt and run telnet
to open the Microsoft Telnet Client.
3. Run quit
to exit the client:
The Telnet syntax for testing open ports is:
telnet <address> <port number>
After running the command, one of the following three options happen:
1. The command throws an error, indicating the port is not available for connection:
2. The command goes to a blank screen, indicating the port is available.
3. Running the command on an open port 23 displays the screen of the telnet host, confirming an established Telnet connection:
10.pathping Command
Pathping, a tool that combines the functions of ping and tracert, is used to locate routers that might be interfering with your network. Only Windows systems can use the tool, which was created by Microsoft.
In order to report the latency and packet loss for each hop, Pathping sends packets to the destination and the routers in its path. To use the command, just enter pathping in the command prompt followed by the URL or IP address, exactly like with tracert or ping.
For instance, pathping -h 20 causes the command to terminate after 20 hops. If a host is unavailable on the first try, the command can also use pathping -w 200 to try again in 200 milliseconds.
Thanks for useful commands
Very useful CLI command network troubleshooting.