Network/IP Commands for Windows Users

Here is a list of interesting/useful network/IP commands for Windows. Most of these commands must be run from the CMD app. To do this Open Command Prompt: In the search bar, type cmd and press Enter, or press Win + R to open the Run dialog.

Administrative Privileges: In some cases you will need to run them from the CMD with Administrative privileges. To ensure the Command Prompt is run as an administrator right-click on cmd.exe and select Run as Administrator.

arp – Display the local ARP cache containing resolved MAC Addresses

The arp command in Windows is a utility used to view and manipulate the Address Resolution Protocol (ARP) cache, which stores mappings between IP addresses and MAC (Media Access Control) addresses.

Basic Syntax
arp [options]
1. -a
arp -a [inet_addr] [-N if_addr]
  • Displays the ARP cache for the specified IP address (or all interfaces if no IP is specified).
  • Example: arp -a
  • Useful for:
    • Viewing the current ARP cache entries.
    • Verifying if an IP-to-MAC mapping exists in the ARP cache.
  • Options:
    • inet_addr: Displays the ARP entry for the specified IP address.
    • -N if_addr: Displays the ARP entries for a specific interface.
2. -d
arp -d inet_addr [if_addr]
  • Deletes a specific ARP cache entry.
  • Example: arp -d 192.168.1.1
  • Useful for:
    • Clearing outdated or incorrect IP-to-MAC mappings that might cause connectivity issues.
    • Forcing the system to re-resolve the MAC address for a specific IP.
3. -s
arp -s inet_addr eth_addr [if_addr]
  • Adds a static entry to the ARP cache (requires administrative privileges).
  • Example: arp -s 192.168.1.1 00-14-22-01-23-45
  • Useful for:
    • Manually defining an IP-to-MAC address mapping to override default resolution.
    • Ensuring specific traffic is routed to a specific device.

ping

The ping command in Windows is a network diagnostic tool used to test connectivity between your computer and another network device, server, or website. It works by sending ICMP (Internet Control Message Protocol) echo request packets and waiting for a response.

Basic Syntax
ping [options] destination
  • destination: The target hostname, domain name, or IP address.
1. Without Arguments
ping destination
  • Sends four ICMP packets to the specified destination and displays the round-trip time (RTT) for each response.
  • Useful for basic connectivity checks.
2. -t
ping -t destination
  • Continuously pings the destination until manually stopped (Ctrl+C).
  • Useful for real-time monitoring of network stability.
3. -n count
ping -n count destination
  • Specifies the number of ICMP echo requests to send.
  • Useful for custom-length tests, e.g., to collect more data for latency analysis.
4. -l size
ping -l size destination
  • Sets the size of the ICMP echo request payload in bytes (default is 32 bytes).
  • Useful for testing the handling of large packets (e.g., to detect MTU issues).
5. -f
ping -f destination
  • Sets the “Don’t Fragment” flag in packets to test the maximum transmission unit (MTU) of a path.
  • Helps diagnose fragmentation-related issues.
6. -i TTL
ping -i TTL destination
  • Sets the time-to-live (TTL) value for packets (default is 128).
  • Useful for tracing how far packets travel before being discarded (e.g., in routing tests).
7. -v TOS (Deprecated in most systems)
ping -v TOS destination
  • Specifies the Type of Service (TOS) value in packets. This option is rarely used and often unsupported.
8. -r count
ping -r count destination
  • Records the route taken by packets for up to 9 hops (requires administrator privileges).
  • Useful for tracing the path to a destination.
9. -s count
ping -s count destination
  • Specifies the number of timestamps to record in packets for up to 4 hops.
  • Useful for measuring inter-hop latency (requires administrator privileges).
10. -w timeout
ping -w timeout destination
  • Sets the timeout in milliseconds to wait for a reply (default is 4000ms).
  • Useful for slow networks or fine-tuning latency thresholds.
11. -4
ping -4 destination
  • Forces the use of IPv4 for the test.
  • Useful when both IPv4 and IPv6 are available, but only IPv4 needs to be tested.
12. -6
ping -6 destination
  • Forces the use of IPv6 for the test.
  • Useful for troubleshooting IPv6-specific issues.

route

The route command in Windows is a powerful tool for managing and troubleshooting the routing table on a system. It allows you to view, add, delete, and modify routes for IP traffic.

Basic Syntax
route [command] [destination] [mask subnet_mask] [gateway] [metric] [if interface]
  • command: The action to perform (e.g., add, delete, change, etc.).
  • destination: The target network or host.
  • mask subnet_mask: The subnet mask for the destination (default is 255.255.255.255 for a single host).
  • gateway: The next-hop IP address or gateway.
  • metric: (Optional) Specifies the cost of the route (lower values are preferred).
  • if interface: (Optional) Specifies the network interface index to use.
Common Commands and Options

1. route print

bashCopy coderoute print
  • Use Case: Displays the current routing table.
  • Useful for checking existing routes and troubleshooting routing issues.
2. route add
route add destination mask subnet_mask gateway [metric] [if interface]
  • Adds a new static route to the routing table.
  • Example: route add 192.168.2.0 mask 255.255.255.0 192.168.1.1
  • Useful for:
    • Directing traffic to a specific subnet or host through a custom gateway.
    • Configuring routes in multi-network setups.
3. route delete
route delete destination
  • Deletes a route from the routing table.
  • Example: route delete 192.168.2.0
  • Useful for removing incorrect or obsolete routes.
4. route change
route change destination mask subnet_mask gateway [metric] [if interface]
  • Modifies an existing route in the routing table.
  • Example: route change 192.168.2.0 mask 255.255.255.0 192.168.1.2
  • Useful for adjusting gateways, metrics, or interfaces for an existing route.
5. -p (Persistent Routes)
route -p add destination mask subnet_mask gateway [metric] [if interface]
  • Makes the route persistent, surviving system reboots.
  • Example: route -p add 192.168.2.0 mask 255.255.255.0 192.168.1.1
  • Useful for permanent custom routing rules.
6. route /?
route /?
  • Displays help information about the route command.
  • Useful for quick reference to syntax and options.

netstat

The netstat command in Windows is a comprehensive tool for monitoring and diagnosing network activity. It provides detailed information about network connections, routing tables, interface statistics, and more.

Basic Syntax
netstat [options]
1. No Options
netstat
  • Displays all active TCP connections.
  • Useful for a quick overview of established network connections and their states.
2. -a
netstat -a
  • Shows all active connections and listening ports (both TCP and UDP).
  • Useful for identifying open ports and applications waiting for incoming connections.
3. -n
netstat -n
  • Displays addresses and port numbers in numerical form instead of resolving them to names.
  • Speeds up the output and avoids potential delays caused by DNS lookups.
4. -o
netstat -o
  • Displays the process ID (PID) for each connection.
  • Useful for determining which process or application is using a specific port.
5. -b
netstat -b
  • Displays the executable or binary responsible for each connection or listening port (requires administrative privileges).
  • Useful for identifying the application directly linked to a specific connection.
6. -e
netstat -e
  • Displays Ethernet statistics, such as sent and received packets, errors, and discards.
  • Useful for diagnosing issues with a network interface.
7. -s
netstat -s
  • Displays statistics for all protocols, including TCP, UDP, ICMP, and IP.
  • Useful for monitoring protocol-specific traffic and troubleshooting network issues.
8. -p [protocol]
netstat -p [tcp|udp|icmp|ip]
  • Filters output by the specified protocol.
  • Example: netstat -p tcp
  • Useful for focusing on a specific type of network traffic.
9. -r
netstat -r
  • Displays the routing table (similar to route print).
  • Useful for checking routing configurations and verifying gateway assignments.
10. -x
netstat -x
  • Displays NetworkDirect connections.
  • Relevant in high-performance or specialized networking scenarios.
11. interval
netstat [options] interval
  • Repeats the netstat output at the specified interval (in seconds) until interrupted (Ctrl+C).
  • Example: netstat -a 5
  • Useful for monitoring network activity in real-time.

ipconfig

The ipconfig command in Windows is a powerful utility for managing and troubleshooting network configurations. Below is a detailed overview of its options and use cases:

1. Without Arguments
ipconfig
  • Displays the basic network configuration, including IP address, subnet mask, and default gateway for all active network adapters.
2. /all
ipconfig /all
  • Provides detailed information for all network adapters, including:
    • DHCP status
    • Physical (MAC) address
    • DNS servers
    • Lease information (if using DHCP)
  • Useful for troubleshooting and gathering detailed network settings. Run ipconfig or ipconfig /all to understand the network setup and diagnose potential configuration issues.
3. /release and /release6
ipconfig /release
ipconfig /release6
  • Releases the current DHCP-assigned IP address for a network adapter.
  • /release is for IPv4, /release 6 is for IPv6
  • Used in troubleshooting IP conflicts or when transitioning to a new network. Use ipconfig /release followed by ipconfig /renew to obtain a new IP address.
4. /renew and /renew6
ipconfig /renew
ip[config /renew6
  • Renews the DHCP lease to get a new IP address for a network adapter.
  • /renew is for IPv4, /renew6 is for IPv6
  • Useful for resolving connectivity issues or after releasing an IP address.
5. /flushdns
ipconfig /flushdns
  • Clears the DNS resolver cache.
  • Helps resolve issues caused by stale or incorrect DNS records.
6. /displaydns
ipconfig /displaydns
  • Displays the contents of the DNS resolver cache.
  • Useful for verifying cached DNS entries.
7. /registerdns
ipconfig /registerdns
  • Forces dynamic registration of DNS records for the computer.
  • Useful for resolving issues with DNS record updates in Active Directory environments. Use ipconfig /registerdns to re-register the DNS records if automatic registration fails.
8. /showclassid and /showclassid6
ipconfig /showclassid [adapter]
ipconfig /showclassid6 [adapter]
  • Displays DHCP class IDs allowed for a network adapter.
  • /showclassid is for IPv4, /showclassid6 is for IPv6
  • Helps manage and troubleshoot custom DHCP configurations.
9. /setclassid
ipconfig /setclassid [adapter] [classid]
  • Sets a DHCP class ID for a specific adapter.
  • Useful for advanced network configurations where DHCP options are differentiated by class IDs.
  • Use ipconfig /showclassid and ipconfig /setclassid to configure and verify DHCP class IDs for network segmentation.
10. /allcompartments
ipconfig /allcompartments
  • Use Case: Displays detailed network information across all network compartments.
  • Relevant in multi-compartment network setups, such as those involving Hyper-V.

tracert – Trace the number of hops and path to an IP Address

The tracert command in Windows is used to trace the route packets take to reach a network destination. It shows each hop (intermediate router or device) along the path, including the time taken for each hop.

tracert [options] <destination>
  • Replace <destination> with the target’s IP address or hostname.
Examples:
  1. Trace Route to a Hostname: tracert www.google.com This will show the route to Google’s servers.
  2. Trace Route to an IP Address: tracert 8.8.8.8 This traces the route to the IP address 8.8.8.8 (Google’s public DNS server).
Options:
  • -d
    Prevents the command from resolving IP addresses to hostnames (faster output).
    Example: tracert -d www.google.com
  • -h <max_hops>
    Specifies the maximum number of hops to search for the target. Default is 30.
    Example: tracert -h 15 www.google.com
  • -w <timeout>
    Specifies the timeout (in milliseconds) for each reply.
    Example: tracert -w 500 www.google.com
  • -4 or -6
    Forces the command to use IPv4 or IPv6, respectively.
    Example: tracert -4 www.google.com
Interpreting the Output:
  • Hop Number: Indicates the sequence of hops from the source to the destination.
  • Response Times: Three response times in milliseconds for each hop.
  • Hostname/IP Address: Displays the hostname and/or IP address of the hop.

If a hop times out, you will see:

Request timed out.

This could indicate a firewall, network congestion, or a device that doesn’t respond to ICMP packets.


nbtstat – displays a list of NetBIOS computer names that have been resolved to IP Addresses:

The nbtstat command is a Windows utility used to display NetBIOS over TCP/IP (NetBT) protocol statistics, NetBIOS name tables, and the NetBIOS name cache.

nbtstat [options]
  • -a [RemoteName]
    Displays the NetBIOS name table of a remote computer. Replace [RemoteName] with the computer’s name.
    Example: nbtstat -a remote-pc-name
  • -A [IP address]
    Displays the NetBIOS name table of a remote computer based on its IP address.
    Example: nbtstat -A 192.168.1.1
  • -n
    Displays the NetBIOS name table of the local computer.
    Example: nbtstat -n
  • -c
    Displays the contents of the NetBIOS name cache, which lists resolved names.
    Example: nbtstat -c
  • -R
    Purges and reloads the remote NetBIOS name cache.
    Example: nbtstat -R
  • -r
    Displays the count of NetBIOS names resolved by broadcast and via a WINS server.
    Example: nbtstat -r
  • -S
    Lists the current NetBIOS sessions and their status, along with IP addresses.
    Example: nbtstat -S
  • -s
    Similar to -S, but resolves IP addresses to hostnames.
    Example: nbtstat -s
Example Use Case:

If you want to check the NetBIOS name table for a computer with an IP of 192.168.0.10: nbtstat -A 192.168.0.10


ncpa.cpl

ncpa.cpl is the Control Panel applet in Windows for managing Network Connections. It provides a graphical interface to view, configure, enable, disable, or troubleshoot network adapters and connections.

How to Access ncpa.cpl

You can access ncpa.cpl through several methods:

  1. Using the Run Dialog:
    • Press Win + R to open the Run dialog box.
    • Type ncpa.cpl and press Enter.
  2. Using Command Prompt or PowerShell:
    • Open Command Prompt or PowerShell.
    • Type ncpa.cpl and press Enter.
  3. From Control Panel:
    • Open the Control Panel.
    • Navigate to:
      • Network and Internet → Network and Sharing Center → Change adapter settings.
Features of ncpa.cpl

The Network Connections window allows you to manage the following:

  1. View All Network Adapters
    • Displays all installed network adapters (Ethernet, Wi-Fi, VPN, virtual adapters, etc.).
  2. Enable or Disable Adapters
    • Right-click a network adapter to enable or disable it.
  3. Configure Adapter Properties
    • Right-click an adapter and select Properties to:
      • Configure IP settings (IPv4/IPv6).
      • Enable/disable specific protocols or features (e.g., QoS, TCP/IP, etc.).
      • Change DNS and gateway settings.
  4. Rename Adapters
    • Rename network adapters for easier identification.
  5. Diagnose Network Issues
    • Right-click an adapter and select Diagnose to troubleshoot connectivity problems.
  6. Bridge Connections
    • Combine multiple network connections into a network bridge.
  7. Create or Manage VPN Connections
    • Add or manage VPN connections linked to physical or virtual adapters.
  8. Advanced Settings
    • Access advanced features such as binding order for network protocols.

control netconnections

The control netconnections command in Windows is a shortcut used to open the Network Connections window in the Control Panel. This is the same interface that is launched when you run ncpa.cpl.

Functionality

The control netconnections command provides access to network adapter management. From this window, you can:

  • View all network adapters (Ethernet, Wi-Fi, VPN, etc.).
  • Enable or disable network adapters.
  • Configure adapter properties (e.g., IP addresses, DNS settings).
  • Diagnose connection issues.
  • Create or delete network bridges.
How to Use the Command
  1. Using the Run Dialog:
    • Press Win + R to open the Run dialog.
    • Type control netconnections and press Enter.
  2. Using Command Prompt or PowerShell:
    • Open Command Prompt or PowerShell.
    • Type: control netconnections
    • Press Enter.

Comments are welcomed below from registered users.  You can also leave comments at our Discord server

If you would like to see more content and articles like this, please support us by clicking the patron link where you will receive free bonus access to courses and more, or simply buying us a cup of coffee!

Contact Us Here


Please verify.
Validation complete :)
Validation failed :(
 
Your contact request has been received. We usually respond within an hour, but please be patient. We will get back to you very soon.
Scroll to Top