SSH & PowerShell Commands for Routers — Beginner to Expert

Every command you need to get into your router, find your way around, diagnose problems and do serious network work. From your very first SSH connection all the way to enterprise-level diagnostics. Every command explained.

Contents
  1. PowerShell basics — before you SSH anywhere
  2. Connecting to your router via SSH
  3. Beginner — getting around
  4. Intermediate — managing packages and services
  5. Network tools — diagnosing connections
  6. OpenWrt-specific commands
  7. Expert — advanced diagnostics and monitoring
  8. Quick reference cheatsheet

1. PowerShell basics — before you SSH anywhere

Complete Beginner

PowerShell is the command line built into Windows 10 and 11. Press the Windows key, type PowerShell, press Enter. You will see a dark window with a flashing cursor. That is your starting point for everything in this guide.

A few PowerShell basics worth knowing before you start SSHing into routers:

# Find your own computer's IP address — useful to know your network range ipconfig # Look for "IPv4 Address" under your active adapter # e.g. 192.168.1.50 — your router is likely at 192.168.1.1 # Clear the PowerShell screen (like cls in old DOS) cls # or Clear-Host # Check if SSH is available ssh -V # Should show: OpenSSH_for_Windows_8.x # If not found, enable it: Settings > Apps > Optional Features > Add: OpenSSH Client # Ping your router to check it is reachable ping 192.168.1.1 # Should show replies — if not, check your network cable or WiFi connection

2. Connecting to your router via SSH

Beginner
# Basic SSH connection to your router ssh root@192.168.1.1 # Type your password when asked — you will not see it appear as you type, that is normal # First time connecting: type yes when asked about the fingerprint # If you get WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED ssh-keygen -R 192.168.1.1 # Then try ssh again — clears the old saved key # Connect to a non-standard port (some routers use port 65222) ssh root@192.168.1.1 -p 65222 # Connect with verbose output — useful for diagnosing connection problems ssh -v root@192.168.1.1 # Exit SSH cleanly exit # or press Ctrl+D
VPN users — read this first

If you have a VPN running, turn it off before SSH-ing into your router. VPNs route all traffic including local network traffic through an exit node somewhere else. Your router at 192.168.1.1 is on your local network — unreachable through a VPN tunnel. Turn VPN off, SSH in, turn VPN back on when done.

3. Beginner — getting around

Beginner

Once you are connected via SSH you are inside your router's Linux system. These are the commands that let you find your way around.

# Where am I? Show current directory pwd # Output: /root — you start in the root user's home directory # List files and folders in current location ls # List with details — size, permissions, dates ls -la # Move to a different folder cd /etc # Go back up one level cd .. # Go straight to root home from anywhere cd ~ # Print the contents of a file to the screen cat /etc/opkg/distfeeds.conf # Show just the first 20 lines of a file head -20 /etc/config/network # Show just the last 20 lines of a file tail -20 /var/log/messages # Search inside a file for a word grep "password" /etc/config/wireless # Clear the screen clear # or press Ctrl+L — does the same thing instantly # Show router hardware and firmware info ubus call system board # Show how long the router has been running uptime # Show memory usage free -m # Show disk/flash usage df -h # Reboot the router reboot # Change the root password passwd

4. Intermediate — managing packages and services

Intermediate
## PACKAGE MANAGEMENT (opkg) # Update the list of available packages opkg update # Install a package opkg install htop # Remove a package opkg remove htop # List all installed packages opkg list-installed # Search for a package by name opkg list | grep -i "ttyd" # Show files installed by a package opkg files luci-app-ttyd ## SERVICES # List all available init scripts (services) ls /etc/init.d/ # Start a service /etc/init.d/network start # Stop a service /etc/init.d/network stop # Restart a service /etc/init.d/network restart # Enable a service to start at boot /etc/init.d/ttyd enable # Reload LuCI (web interface) /etc/init.d/rpcd restart && /etc/init.d/uhttpd restart ## UCI — OpenWrt's configuration system # Show all network configuration uci show network # Show wireless configuration uci show wireless # Get a specific value uci get network.wan.proto # Set a value uci set system.@system[0].hostname='MyRouter' # Save and apply changes uci commit /etc/init.d/network reload

5. Network tools — diagnosing connections

Intermediate
## CONNECTIVITY TESTING # Ping a host to test connectivity (press Ctrl+C to stop) ping 8.8.8.8 # Ping with limited count ping -c 4 google.com # Trace the route packets take to a destination traceroute google.com # If traceroute not available: tracepath google.com # DNS lookup — find the IP for a domain name nslookup google.com # Using a specific DNS server nslookup google.com 1.1.1.1 ## NETWORK INTERFACES # Show all network interfaces and their IP addresses ip addr # Short form ip a # Show routing table ip route # Short form ip r # Show interface statistics — traffic, errors ip -s link # Bring an interface up or down ip link set eth0 up ip link set eth0 down # Show ARP table — who is on your network arp -n # Modern version: ip neigh ## ACTIVE CONNECTIONS # Show active network connections netstat -an # Show which process is using which port netstat -tlnp # Download a file — test internet connectivity and speed curl -o /dev/null https://speed.cloudflare.com/__down?bytes=10000000 2>&1 | tail -3 # Downloads 10MB and reports speed — quick bandwidth test

6. OpenWrt-specific commands

Intermediate
## SYSTEM INFORMATION # Full hardware and firmware details ubus call system board # Show all running processes ps # Interactive process monitor (if htop is installed) htop # Basic version always available: top # Show system log — essential for troubleshooting logread # Last 50 lines only logread | tail -50 # Follow log in real time (Ctrl+C to stop) logread -f # Filter log for specific term logread | grep -i "error" ## WIFI # Scan for nearby WiFi networks iwlist scan 2>/dev/null | grep -E "ESSID|Signal" # Show current WiFi status iwinfo # Detailed info for a specific interface iwinfo phy0 info ## FIREWALL # Show firewall rules iptables -L -n -v # Reload firewall /etc/init.d/firewall restart ## DHCP LEASES — who is connected # Show all current DHCP leases (connected devices) cat /tmp/dhcp.leases # Format: expiry time, MAC address, IP, hostname, client ID ## FILE EDITING # Edit a file with vi (always available on OpenWrt) vi /etc/config/network # vi basics: press i to edit, Esc to stop editing, :wq to save and quit, :q! to quit without saving

7. Expert — advanced diagnostics and monitoring

Expert
## PACKET CAPTURE — see actual network traffic # Capture all traffic on the WAN interface (Ctrl+C to stop) tcpdump -i eth0 # Capture with readable timestamps, no hostname resolution tcpdump -i eth0 -n -tt # Capture only DNS traffic tcpdump -i eth0 port 53 # Capture traffic to/from a specific IP tcpdump -i eth0 host 8.8.8.8 # Save capture to file for analysis in Wireshark tcpdump -i eth0 -w /tmp/capture.pcap ## SYSTEM PERFORMANCE # CPU and memory usage — one snapshot top -bn1 | head -20 # Watch CPU usage in real time watch -n 1 'cat /proc/loadavg' # Show memory details cat /proc/meminfo # Show CPU info cat /proc/cpuinfo # Disk I/O and flash usage df -h && du -sh /overlay ## NETWORK PERFORMANCE # Monitor real-time network interface traffic watch -n 1 'cat /proc/net/dev' # Show network socket statistics ss -tulnp # Check MTU and interface settings ip link show ## KERNEL AND SYSTEM # Show kernel messages — hardware detection, driver errors dmesg # Last 30 kernel messages dmesg | tail -30 # Filter for USB devices (modems) dmesg | grep -i "usb\|tty" # Show kernel modules (drivers) loaded lsmod # Load a kernel module modprobe kmod-usb-serial-option ## USB AND MODEM DIAGNOSTICS # List connected USB devices cat /sys/kernel/debug/usb/devices 2>/dev/null | grep -A3 "Manufacturer\|Product" # List USB serial ports ls /dev/ttyUSB* # Send AT command to modem at-cmd /dev/ttyUSB2 AT+QNWINFO # Interactive AT command terminal picocom -b 115200 /dev/ttyUSB2 # Exit picocom: Ctrl+A then Ctrl+X ## UBUS — OpenWrt's system bus # List all available ubus services ubus list # Show detailed methods for a service ubus -v list network.interface # Get WAN interface status ubus call network.interface.wan status # Get all interface statuses ubus call network.interface dump ## USEFUL ONE-LINERS # Find which process is using the most memory ps | sort -k5 -rn | head -10 # Find a file anywhere on the system find / -name "distfeeds.conf" 2>/dev/null # Count lines in a file wc -l /var/log/messages # Show environment variables env # Run a command every 2 seconds and watch output change watch -n 2 'ip -s link show eth0' # Background a process (add & at end) sh /usr/sbin/modules/quectel_rm500u & # Bring it back to foreground fg # Kill a background job kill %1

8. Quick reference cheatsheet

The commands you will actually use most often, in one place:

Command What it does
ssh root@192.168.1.1Connect to router
ssh-keygen -R 192.168.1.1Fix host key warning
exitDisconnect from SSH
clear / Ctrl+LClear the screen
ubus call system boardRouter model and firmware info
uptimeHow long router has been running
free -mMemory usage in MB
df -hStorage/flash usage
opkg updateRefresh package list
opkg install [name]Install a package
opkg list-installedList installed packages
logread | tail -30Last 30 system log lines
logread -fFollow system log live
ping -c 4 8.8.8.8Test internet connectivity
ip addrShow all IP addresses
ip routeShow routing table
cat /tmp/dhcp.leasesShow connected devices
uci show networkShow network config
uci commit && /etc/init.d/network reloadSave and apply config changes
dmesg | grep -i usbUSB device detection log
ls /dev/ttyUSB*List modem USB ports
at-cmd /dev/ttyUSB2 AT+QNWINFOQuery modem network info
rebootRestart the router
The golden rule of command line work

Before running any command that changes something — backing up config, editing files, installing packages — make sure you know what it does and can reverse it. The uci commit command saves changes permanently. The reboot command restarts the router immediately. There is no undo. When in doubt, read before you run.

← Back to blog Full OpenWrt Guide →

Routers built for people who want control

All Rocket Routers run OpenWrt — SSH in, run any command, configure everything. Your router, your rules.

See our routers