OpenWrt Forum Archive

Topic: how to SSH remotely?

The content of this topic has been archived on 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm new to openwrt, and I've set up an openwrt box at my client's office, but when I try to ssh into it remotely, the connection gets refused.

how do I set it up so it will work?  Do I create hosts.allow/deny files?

Thanks!

Login via Telnet, set a password reboot and login with ssh.

I did that, but what I'm trying to do is ssh into it from an external location, via the wan port.  Is that supposed to be enabled by default?  I'm running the experimental firmware on a WRT54G v2.2

I can do it internally, but I get a connection refused error from my home computer, and another computer in the house.  The box I want to ssh into is on a T1.

Check your firewall rules, by default the openwrt firewall denies all incoming tcp connections on the WAN port.

Add
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
to /etc/init.d/S45firewall

That will enable SSH on all Interfaces

Excellent!  Thank you all for helping me out.  I'm a networking n00b, and a relative Linux noob (I've only recently been able to drop the zeros), so any help is really appreciated!

EDIT:  It doesn't seem to work.  I added it as the last line.  First, I deleted it, copied it over from ROM, and echo'd it into the file.   I tried specifying the ifname (according to nvram get wan_ifname, it's vlan1)

My IP address is x.x.x.134
My gateway is x.x.x.133

SSH'ing in doesn't work for either address.  I'm concerned that the T1 provider might be blocking it?  Does this make sense?

(Last edited by thegnu on 20 May 2005, 18:10)

Nevermind.  Once I read the comments in the S45firewall file, I noticed that I needed to put the suggested line ABOVE the line:

# reject (what to do with anything not allowed earlier)

Thanks again!

The discussion might have continued from here.