Operations 16 min read

Essential Windows CMD Network Commands and How to Use Them

This guide presents a concise reference of common Windows command‑line networking tools—including arp, getmac, hostname, ipconfig, netstat, ping, route, telnet and tracert—explaining their purpose, key options, typical usage syntax and practical examples to help administrators troubleshoot and manage network connectivity.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Essential Windows CMD Network Commands and How to Use Them

1. arp – Display/Modify ARP cache

The arp command shows or changes the Address Resolution Protocol (ARP) table that maps IP addresses to physical (MAC) addresses. Basic usage to view the table is: arp -a Key options: -a [inet_addr] [-N if_addr] [-v] – Show ARP entries; optional inet_addr limits output to a specific host, -N selects an interface, -v enables verbose mode. -d inet_addr [if_addr] – Delete the specified ARP entry; inet_addr may be a wildcard ( *) to delete all entries. -s inet_addr eth_addr [if_addr] – Add a static ARP entry, binding an IP address to a MAC address (six‑byte hex separated by hyphens).

Example: arp -s 157.55.85.212 00-aa-00-62-c6-09 This adds a permanent static mapping for the given IP.

2. getmac – Show MAC addresses

getmac

displays the MAC addresses of network adapters on the local or a remote system. getmac /? Important switches: /S system – Target a remote computer. /U [domain\]user – Run under a specific user context. /P [password] – Supply the password for the user (prompted if omitted). /FO format – Output format: TABLE, LIST or CSV. /NH – Omit column headers (valid for TABLE and CSV). /V – Verbose output.

Example commands:

GETMAC /?</code>
<code>GETMAC /FO csv</code>
<code>GETMAC /S server01 /U admin /P secret /FO list /V

3. hostname – Show the computer name

Running hostname simply prints the local machine’s host name.

hostname

4. ipconfig – Display TCP/IP configuration

The ipconfig utility provides IP address, subnet mask, default gateway and other TCP/IP settings for each adapter. Basic usage: ipconfig Common options: /all – Show full configuration, including DNS servers and DHCP details. /release – Release the IPv4 address of the specified adapter (or all adapters if omitted). /renew – Renew the IPv4 lease. /release6 and /renew6 – Same operations for IPv6. /flushdns – Clear the DNS resolver cache. /registerdns – Refresh DHCP leases and re‑register DNS names. /displaydns – Show the contents of the DNS cache. /showclassid / /setclassid – View or modify DHCP class IDs for IPv4. /showclassid6 / /setclassid6 – Same for IPv6.

Examples:

ipconfig /all</code>
<code>ipconfig /renew</code>
<code>ipconfig /release *</code>
<code>ipconfig /allcompartments

5. netstat – Display network connections and statistics

netstat

reports active TCP/UDP connections, listening ports, protocol statistics and routing information. netstat /? Frequently used switches: -a – Show all connections and listening ports. -b – Display the executable responsible for each connection (requires elevated rights). -e – Show Ethernet statistics. -f – Show fully qualified domain names for foreign addresses. -n – Show addresses and ports numerically. -o – Include the owning process ID (PID) for each connection. -p proto – Show connections for a specific protocol (TCP, UDP, TCPv6, UDPv6, etc.). -r – Display the routing table. -s – Show per‑protocol statistics. -t – Show TCP connection template information. -x – Show Network Direct connections. -y – Show TCP connection templates (cannot be combined with other options). interval – Re‑display statistics every interval seconds; press Ctrl+C to stop.

Example:

netstat -ano

6. ping – Test network reachability

The ping command sends ICMP echo requests to a host to verify connectivity and measure round‑trip time. ping baidu.com Key options: -t – Ping continuously until stopped (Ctrl+C). -a – Resolve the address to a host name. -n count – Number of echo requests to send. -l size – Size of the send buffer. -f – Set the “Don’t Fragment” flag (IPv4 only). -i TTL – Set the Time‑To‑Live. -w timeout – Timeout in milliseconds to wait for each reply. -R – Use routing header for reverse route testing (IPv6, deprecated). -S srcaddr – Specify source address (IPv6). -4 / -6 – Force IPv4 or IPv6.

Example:

ping -n 5 -l 1024 www.example.com

7. route – View and modify the routing table

The route utility manipulates the IP routing table. route PRINT -4 Important switches: -f – Clear all gateway entries before adding new routes. -p – Make a route persistent across reboots (used with ADD). -4 / -6 – Force IPv4 or IPv6. PRINT – Display the routing table.

ADD destination MASK netmask gateway [METRIC metric] [IF interface]

– Add a new route. DELETE destination – Remove a route.

CHANGE destination MASK netmask gateway [METRIC metric] [IF interface]

– Modify an existing route.

Examples:

route PRINT</code>
<code>route ADD 157.0.0.0 MASK 255.0.0.0 157.55.80.1 METRIC 3 IF 2</code>
<code>route DELETE 157.0.0.0

8. telnet – Test remote service ports

When the Telnet client is enabled, telnet host port can be used to check whether a specific TCP service (e.g., MySQL on port 3306) is reachable.

telnet 192.168.0.12 3306

9. tracert – Trace the route to a destination

tracert

shows the sequence of hops that packets take to reach a target host. tracert -d www.baidu.com Key options: -d – Do not resolve IP addresses to host names. -h maximum_hops – Set the maximum number of hops to search. -j host-list – Loose source routing (IPv4 only). -w timeout – Timeout in milliseconds for each reply. -R – Trace round‑trip path (IPv6 only). -S srcaddr – Source address for IPv6. -4 / -6 – Force IPv4 or IPv6.

Example:

tracert -d www.baidu.com
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

networkpingcmdnetstatARPtelnetroutetracertipconfig
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.