Network Command Reference

Essential commands for network troubleshooting and analysis

Network Configuration

View Network Interfaces

Windows:

ipconfig /all
netsh interface show interface

Linux:

ifconfig -a
ip addr show
ip link show

DHCP Operations

Windows:

ipconfig /release
ipconfig /renew
ipconfig /displaydns
ipconfig /flushdns

Linux:

sudo dhclient -r
sudo dhclient
sudo systemctl restart networking

Network Testing

Connectivity Testing

# Basic ping
ping 8.8.8.8
ping -c 4 google.com

# Continuous ping
ping -t 192.168.1.1

# Ping with specific packet size
ping -s 1472 8.8.8.8

Route Tracing

Windows:

tracert google.com
pathping google.com

Linux:

traceroute google.com
mtr google.com

DNS Operations

DNS Lookup

# Basic lookup
nslookup google.com
dig google.com

# Specific record types
dig google.com MX
dig google.com TXT
dig google.com AAAA

# Reverse lookup
dig -x 8.8.8.8

Advanced DNS

# Query specific DNS server
dig @8.8.8.8 google.com

# Trace DNS resolution
dig +trace google.com

# Short output format
dig +short google.com

Port and Service Analysis

Port Scanning

# Basic port scan
nmap 192.168.1.1

# Scan specific ports
nmap -p 80,443,22 192.168.1.1

# Service detection
nmap -sV 192.168.1.1

# Network discovery
nmap -sn 192.168.1.0/24

Active Connections

Windows:

netstat -an
netstat -b
netstat -r

Linux:

netstat -tulpn
ss -tulpn
lsof -i

ARP Operations

ARP Table Management

# View ARP table
arp -a

# Clear ARP cache
arp -d *  # Windows
sudo ip neigh flush all  # Linux

# Add static ARP entry
arp -s 192.168.1.100 00:11:22:33:44:55

Common Troubleshooting Scenarios

No Internet Connectivity

  1. Check physical connection: ip link show
  2. Verify IP configuration: ip addr show
  3. Test local gateway: ping [gateway-ip]
  4. Test DNS resolution: nslookup google.com
  5. Test external connectivity: ping 8.8.8.8

Slow Network Performance

  1. Check interface statistics: ip -s link show
  2. Test bandwidth: iperf3 -c server-ip
  3. Analyze packet loss: ping -c 100 target
  4. Check route path: traceroute target
  5. Monitor with: iftop or nethogs