Windows Basic Networking

WINDOWS 'Plumbing'

Displays all connections and listening ports '-a' and ... Displays addresses and port numbers in numerical form '-n' and ... Displays TCP connection template for all connections '-y' (table style - Proto - Local Address - Foreign Address - State - Template) find or findstr to filter output

netstat –yan | find “8080” 
netstat –yan | findstr “22” 

Filter and show only TCP protocol

netstat –yanp tcp

Filter and show only UDP protocol

netstat –yanp udp -a

PING ICMP Statistics

netstat -s -p icmp


Test Connection with Powershell:

Test-NetConnection -ComputerName -InformationLevel Detailed

Ping multiple IP using PowerShell

1..99 | % { Test-NetConnection -ComputerName 192.168.1.$_ } | FT -AutoSize

Tracert with PowerShell

Test-NetConnection –TraceRoute

Use PowerShell to check for open port

Test-NetConnection -ComputerName -Port 80

Alternative syntax for port

Test-NetConnection -ComputerName -CommonTCPPort HTTP

NSlookup using PowerShell

Resolve-DnsName -Type MX -Server 

Permanent Route Add/Remove <"route" + "add"/"DELETE" + network ID + "mask" + subnet mask, dotted decimal + gateway ipv4>

route add -p

or route add –p 10.X.X.X mask 255.X.X.X 192.168.X.X or route DELETE –p 10.X.X.X mask 255.X.X.X 192.168.X.X

Show Routing table

route print

Example of basic workflow

1 - Print routing table prior to change
2 - Delete routes
3 - Add routes
4 - Print routing table post delete/add routes
5 - Ping IP address (presumable in newly added range to test)

    route print
    route DELETE -p mask
    route DELETE -p mask
    route ADD -p mask
    route ADD -p mask
    route print

Last updated