如何修复 OpenWRT 故障安全模式 SSH 端口 22: Connection refused
问题:
你正在尝试使用 SSH 通过 ssh 192.168.1.1 连接到故障安全模式下的 OpenWRT 路由器,但你看到此错误消息:
output.txt
ssh: connect to host 192.168.1.1 port 22: Connection refused解决方案
首先,检查你是否有正确的 IP 配置:
- 确保你的计算机只连接到连接到 OpenWRT 的以太网接口
- 确保你已将以太网端口设置为静态 IP 192.168.1.1,子网掩码 255.255.255.0(前缀长度 24),网关 none 或 192.168.1.1
Ping 192.168.1.1 以验证你的 IP 配置:
ping.sh
ping 192.168.1.1示例输出:
ping_output.txt
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然后,尝试再次使用 SSH 连接:
ssh_connect.sh
如果你仍然得到
output.txt
ssh: connect to host 192.168.1.1 port 22: Connection refused你运行的是旧版 OpenWRT。故障安全模式下的 SSH 仅从 OpenWRT 15.05 开始支持。对于旧版本,使用 telnet 连接:
telnet.sh
telnet 192.168.1.1你应该看到 root shell:
telnet_output.txt
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):/#Check out similar posts by category:
Networking
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow