Free tech learning for everyone, from basics to pro

Network FundamentalsNetworking SecurityBeginner

Windows networking and security commands

In short: A quick reference of the Windows commands network and security engineers use most, grouped by task. Commands only.

Commands only. Replace values in angle brackets such as <ip> with your own. Only run commands on systems you own or are authorised to manage.

IP configuration

CommandPurpose
ipconfigShow IP address, mask and default gateway
ipconfig /allFull details: MAC, DHCP server, DNS servers, lease times
ipconfig /releaseRelease the DHCP address
ipconfig /renewRequest a new DHCP address
ipconfig /flushdnsClear the local DNS cache
ipconfig /displaydnsShow the local DNS cache
Get-NetIPConfigurationPowerShell: IP, gateway and DNS per adapter

Connectivity and path testing

CommandPurpose
ping <ip>Test reachability with ICMP echo
ping -t <ip>Ping continuously until Ctrl+C
ping -n 10 -l 1400 <ip>Send 10 pings of 1400 bytes
tracert <ip>Show each router hop to a destination
tracert -d <ip>Trace without resolving names (faster)
pathping <ip>Trace plus loss statistics per hop
Test-NetConnection <host> -Port 443PowerShell: test whether a TCP port is open

DNS and name resolution

CommandPurpose
nslookup <name>Resolve a name with the default DNS server
nslookup <name> <dns-server>Resolve using a specific DNS server
nslookup -type=mx <domain>Look up mail servers
Resolve-DnsName <name> -Type APowerShell DNS lookup
hostnameShow this computer’s name

Connections, ARP and routing

CommandPurpose
netstat -anoAll connections and listening ports with process ID
netstat -bShow the program behind each connection (run as administrator)
arp -aShow the ARP cache (IP to MAC)
arp -d *Clear the ARP cache
route printShow the routing table
route add <network> mask <mask> <gateway>Add a temporary static route
Get-NetTCPConnection -State ListenPowerShell: listening TCP ports

Firewall

CommandPurpose
netsh advfirewall show allprofilesShow firewall state for domain, private and public profiles
netsh advfirewall set allprofiles state onTurn the firewall on for all profiles
netsh advfirewall firewall add rule name="Allow SSH" dir=in action=allow protocol=TCP localport=22Allow inbound TCP 22
netsh advfirewall firewall delete rule name="Allow SSH"Remove a rule by name
Get-NetFirewallProfilePowerShell: firewall profile settings
New-NetFirewallRule -DisplayName "Block Telnet" -Direction Inbound -Protocol TCP -LocalPort 23 -Action BlockPowerShell: block inbound Telnet

Users, policy and system checks

CommandPurpose
whoami /allCurrent user, groups and privileges
net userList local user accounts
net localgroup administratorsList local administrators
gpupdate /forceRe-apply Group Policy now
gpresult /rShow which Group Policies applied
systeminfoOS version, patches (hotfixes) and hardware summary
sfc /scannowCheck and repair system files

Real-world example: a hospital PC that could not open the records system

A Windows troubleshooting orderipconfig /alladdress,gateway, DNSping gatewaylocal networkping 8.8.8.8internet by IPnslookupnameresolutiontracertwhere it stops
Figure 1. A simple order for using Windows networking commands: check your own settings first, then test outward one step at a time.

A ward PC in a hospital could not open the patient records web application, although email worked. The desktop support engineer worked outwards with the commands on this page. ipconfig /all showed a correct address, gateway and DNS servers. Pinging the gateway and the records server's IP address both succeeded, so the network path was fine. nslookup for the application's name, however, returned an old address.

The PC had a stale entry in its hosts file, added years earlier during a server migration. The engineer removed the entry, ran ipconfig /flushdns, and the application loaded at once. Following the same order every time, from the PC outwards, avoided a pointless escalation to the network team.

Key takeaways

  • ipconfig, ping, tracert and nslookup cover most first-line troubleshooting.
  • netstat -ano links open ports to process IDs.
  • netsh advfirewall and the NetSecurity PowerShell cmdlets manage the firewall.
  • whoami /all and net localgroup administrators show who has privileges.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.