As a Windows administrator, it’s important to be familiar with the various networking commands which can be used for network troubleshooting.
Networking commands are an essential part of any network administrator’s toolkit and can help to solving networking issues, manage network settings, and much more.
In this guide, we’ll highlight the 12 essential networking commands that every Windows admin should be familiar with. These range from basic networking utilities to more advanced tools.
Using the Windows Key + R keyboard combination to open the Run dialogue box is the quickest way to get to the command prompt in Windows 10. To open the command prompt, type “cmd” and hit Enter.
1- Ping
The ping
command is a networking utility used to test the reachability of a host on an Internet Protocol (IP) network. It can be used to determine whether a specific IP address is accessible, and also measures the round-trip time for messages sent from the localhost to a remote host. In addition, Ping can provide information about the network routes and the amount of time required to traverse them.
In Windows 11, Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP, the ping command is available via the Command Prompt. It’s also compatible with older Windows versions like Windows 98 and 95.
How to use the Ping command:
- Open the Command Prompt or Terminal.
- Type “ping” followed by the IP address or hostname of the destination.
- Press Enter.
The remote host will respond to the ping with four packets if no network problems or firewalls prevent the ping from being completed. Receiving these packets shows that the two hosts have a valid and functional network path.
Ping Command Options
With the Ping command, a user has a number of options that they can use with this command.
Ping Command Syntax
ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [-w timeout] [-R] [-S srcaddr] [-p] [-4] [-6] target [/?]
Options | Description |
target | This is the IP address or hostname that the user wants to ping. |
-a | Resolves the hostname of an IP address target. |
-t | Ping command option that will ping the target until you stop it by pressing Ctrl-C. |
-n count | This option lets you choose between 1 and 4294967295 ICMP Echo Requests to send. The ping command will return 4 by default if -n is not supplied. |
-l size | This option is used to set the size, in bytes, of the echo-request packet from 32 to 65,527. If the -l option is not specified, the ping command will send a 32-byte echo request. |
-s count | This option is used to record the time each echo request is received and an echo reply is sent in the Internet Timestamp format. Only the first four hops can be time stamped because the maximum count number is four. |
-r count | This command uses the ping command option to specify the number of hops between the source computer and the target computer. The maximum count value is 9; the Tracert command can also be used if the user wants to view all the hops between two devices. |
-i TTL | This ping command option sets the Time to Live (TTL) value; the maximum value is 255. |
-f | Use this ping command option to prevent ICMP Echo Requests from being fragmented by routers between the source and the target. The -f option is often used to troubleshoot Path Maximum Transmission Unit (PMTU) issues. |
-w timeout | This ping command requires a timeout value to be provided. The amount of time is adjusted in milliseconds. If the -w option is not used, the default timeout value of 4000 (four seconds) is used. |
-p | To ping a Hyper-V Network Virtualization provider address. |
-S srcaddr | Used to specify the source address. |
2 – NetStat
NetStat
is a networking utility that can be used to display all active network connections and their status. It can be used to identify which applications are using which ports and can be helpful in troubleshooting networking issues.
Most Windows, Linux, UNIX, and other operating systems include Netstat as a Common TCP – IP networking command-line method.
To use the NetStat command, open the Command Prompt and type “netstat” followed by any desired options.
NetStat Command Options
Option | Description |
-a | Displays all connection and ports |
-b | Displays the executable involved in each connection or hearing port |
-e | This will combine with the -sand display the ethernet statistics |
-n | Displays the address and the port number in the form of numerical |
-o | Displays the ID of each connection for the ownership process. |
-r | Displays the routing table |
-v | When used in combination with -b, the link or hearing port sequence for every executable is shown. |
3 – NbtStat
NbtStat
is a networking utility in Windows that helps users troubleshoot NetBIOS over TCP/IP problems. It can be used to display a variety of information about the current state of the NetBIOS over TCP/IP protocol on both local and remote computers.
To use NbtStat, open the Command Prompt (click Start, then type cmd in the Search box). At the command prompt, type nbtstat followed by any of the following parameters:
Option | Description |
-a <name> | Displays NetBIOS name cache entries for all computers. |
-A <IP address> | Displays NetBIOS name table entries for all computers. |
-c | Displays NetBIOS name table entries for all computers. |
-n | Displays NetBIOS localNames table. |
-r | Purges and reloads the remote cache name table. |
-R | Purges and reloads the NetBIOS name cache. |
-RR | Resets NetBIOS over TCP/IP. |
-s <name> | Displays sessions table for all computers |
-S | Purges the sessions table |
-t <name> | Displays the status of NetBIOS over TCP/IP on a specified computer. |
4 – Ip Config
IP Config is a command-line tool that is used to display the current IP address configuration of a Windows machine. This includes the IP address, subnet mask, and default gateway. Additionally, IP Config can be used to release and renew DHCP leases.
This command is particularly useful for troubleshooting networking issues. For example, if a machine is not receiving an IP address from a DHCP server, this can be easily checked using the IP Config command.
To use the IP Config tool, simply open the Command Prompt and type “ipconfig” followed by Enter. This will display the current IP address configuration of the machine.
Additional options can be used such as…
Option | Description |
/all | Displays all IP address information for all adapters. |
/release | Releases the DHCP lease |
/renew | Renews the DHCP lease |
/flushdns | Flushes the DNS resolver cache |
5 – Hostname
If you know which switch to use with the command, NbtStat
can provide you with the host name that has been assigned to a Windows device, as discussed earlier in this piece.
If you’re only searching for a quick and easy way to verify a computer’s name, the Hostname command is a good option. The local machine name is returned by typing Hostname at the command prompt.
How to Find Out Your Computer’s Name
Open a terminal window and type the following command.
hostname
This command will give you the name of your computer.
The first section of the result is a computer’s name, and the second part is the domain’s name.
Run the following command to get only the computer name:
hostname -s
This will give you the localhost. If you want to find out which domain system is running, use this command.
hostname -d
Retrieve the IP address for the hostname by using the following command.
hostname -i
The aliases for the computer can be found out by using this command given below.
hostname -a
6 – ARP
The Address Resolution Protocol, or ARP, is a networking utility used for mapping network addresses to physical addresses.
ARP
is essential for networking communications, as it allows devices on a network to communicate with each other by translating IP addresses into physical addressess.
Although IP addresses are commonly used in network communications, packet delivery is ultimately determined by media access control (MAC). The mechanism for address resolution kicks in at this point.
If you’re having trouble communicating with a particular host, you can use the arp -a command to include the remote host IP address.
Address, Flags, Mask, IFace, Hardware Type, Hardware Address, and so on are all provided by the ARP command.
7 – Nslookup
Nslookup
is a command-line networking tool used for querying Domain Name System (DNS) to obtain domain name or IP address mapping, or other DNS records. Nslookup has two modes: interactive and non-interactive.
The Windows version of Nslookup is available as part of the Microsoft networking tools. To use Nslookup on Windows, open the Command Prompt and type “nslookup” followed by the domain name or IP address you want to query.
For example, to find the IP address of www.example.com, you would type:
nslookup www.example.com
Nslookup can also be used to find the name of a machine with a given IP address. For example, to find the name of the machine with the IP address 10.0.0.1, you would type:
nslookup 10.0.0.1
8 – Tracert
The tracert
command is a Command Prompt command that displays the network packets being sent and received, as well as the number of hops required for them to reach their destination.
A traceroute is another name for this command. It gives a lot of information about how a packet gets from the source to the designated destination.
At all Windows operating systems, the tracert command is available in the Command Prompt.
To use the Tracert utility, open the command prompt and type “tracert” followed by the address of the host you wish to trace the route to.
Other Tracert Options
Option | Description |
target | This is the destination, either an IP address or hostname. |
-d | Prevents Tracert from resolving IP addresses to hostnames to get faster results. |
-h MaxHops | This Tracert option specifies the maximum number of hops in the search for the target. If the MaxHops option is not specified the target has not been found by 30 hops, then the tracert command will stop looking. |
-w timeout | This ping command requires a timeout value to be provided. The amount of time is adjusted in milliseconds. |
9 – PingPath
PingPath commands have a lot of similarities with Tracert. The pathping command combines the finest features of Tracert and Ping into one command.
This command collects statistics for 300 seconds before returning more detailed reports on latency and packet loss statistics at intermediate hops between the source and the target than the Ping or Tracert commands.
PathPing is a networking utility that allows you to test the connectivity of a network route. This command-line tool uses ICMP packets to test the connection between two nodes on a network.
To use PathPing, open the Command Prompt and type “pathping” followed by the IP address or hostname of the destination node.
Option | Description |
N | Stops the path ping functioning from attempting to resolve routers’ IP addresses to their names. |
-h MaxHops | This tracert option specifies the maximum number of hops in the search for the target. If the MaxHops option is not specified the target has not been found by 30 hops then the tracert command will stop looking. |
-w timeout | A timeout value must be specified while executing this ping command. It adjusts the amount of time in milliseconds. |
-ip <IPaddress> | Indicates the source address. |
target | This is the destination IP address or a hostname user want to ping. |
10 – GetMac
The MAC address is a unique identifier for every network capable device on the internet. The number is assigned during the manufacturing process and is stored in the device’s hardware.
The Getmac command is used to display the MAC addresses of all networking adapters on a Windows system. This information can be useful for troubleshooting networking issues or for identifying a specific networking device.
To use the Getmac command, open the Command Prompt and type “getmac” followed by the Enter key. The Getmac command will then display the MAC address, the network adapter name, and the type of networking for each adapter.
The Getmac command can also be used with various switches to provide additional information or to modify the way that the information is displayed.
11 – Route
The Route networking command is one of the most essential networking commands for Windows administrators. This command can be used to view and modify the network routing table. The route command can also be used to add or remove static routes from the routing table.
Routing tables are used to direct packets from one subnet to another. By using the route command, administrators can change the way network traffic is routed. This can be useful for troubleshooting networking issues or for implementing security measures.
The Route networking command can be executed from the Command Prompt or from PowerShell.
To view the current routing table, use the following syntax:
route print
To add a static route to the network routing table, use the following syntax:
route add <destination> mask <subnet mask> <gateway>
To remove a static route from the networking routing table, use the following syntax:
route delete <destination>
12 – NetDiag
NetDiag is a networking diagnostic tool that is included with the Windows operating system. This command-line utility can be used to troubleshoot various networking issues, such as connectivity problems or DNS resolution issues.
To use the NetDiag utility, simply open a Command Prompt window and type “netdiag” followed by any desired options. Some useful options include “/debug” which will provide detailed output, and “/fix” which will attempt to automatically fix any identified networking problems.