How to fix OpenWRT Failsafe mode SSH port 22: Connection refused

Problem:

You are trying to connect to your OpenWRT router in failsafe mode using SSH using ssh 192.168.1.1, but you see this error message:

ssh: connect to host 192.168.1.1 port 22: Connection refused

Solution:

First, check if you have the correct IP configuration:

  • Ensure your computer is ONLY connected to the Ethernet interface connected to OpenWRT
  • Ensure you have set the Ethernet port to the static IP 192.168.1.1 , netmask 255.255.255.0 (prefix length 24), gateway none or 192.168.1.1

Ping 192.168.1.1 to verify your IP configuration:

ping 192.168.1.1

Example output:

uli@uli-computer:~$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=63 time=1.20 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=63 time=1.35 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=63 time=1.14 ms

Then, try connecting again using SSH:

ssh [email protected]

If you’re still getting a

ssh: connect to host 192.168.1.1 port 22: Connection refused

you are running an old OpenWRT version. SSH in failsafe mode is only supported since OpenWRT 15.05. For older versions, use telnet to connect:

telnet 192.168.1.1

and you should see a root shell:

elnet 192.168.1.1
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.

 === IMPORTANT ============================
  Use 'passwd' to set your login password
  this will disable telnet and enable SSH
 ------------------------------------------


BusyBox v1.19.4 (2013-03-14 11:28:31 UTC) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 ATTITUDE ADJUSTMENT (12.09, r36088)
 -----------------------------------------------------
  * 1/4 oz Vodka      Pour all ingredients into mixing
  * 1/4 oz Gin        tin with ice, strain into glass.
  * 1/4 oz Amaretto
  * 1/4 oz Triple sec
  * 1/4 oz Peach schnapps
  * 1/4 oz Sour mix
  * 1 splash Cranberry juice
 -----------------------------------------------------
root@(none):/#