Find the answer to your Linux question:
Results 1 to 8 of 8
Like Tree5Likes
  • 1 Post By mizzle
  • 1 Post By SeanGee
  • 1 Post By danielcolon
  • 1 Post By nskim2010
  • 1 Post By jimbudler
Hi all, I have a home server running Debian Squeeze. This server is behind a router with a static IP. To access the apache server, in the router I have ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2012
    Posts
    12

    Question Access server from outside LAN via SSH


    Hi all,
    I have a home server running Debian Squeeze. This server is behind a router with a static IP.
    To access the apache server, in the router I have redirected port 8888 (public) to port 80 (private) so when I type xxx.xxx.xxx.xxx:8888 (where the x's represent the router's static ip address) in a web browser from outside the LAN, it displays a home page. That works just fine.
    Now I would like to access the ssh server from outside the LAN. To accomplish this, in the router I redirected port 1982 to the server's (private) port 22, but I keep getting a "Connection timed out" message in Putty while trying to connect to the server.
    Some things to consider:
    1) the sshd daemon is running on the server.
    2) Iptables is not blocking any incoming connections (just to test, it's configured with an ACCEPT ALL policy).
    3) The Putty connection is xxx.xxx.xxx.xxx:1982 (where the x's represent the same IP address as above).
    4) I already checked linuxquestions.org/questions/linux-newbie-8/ssh-access-from-outside-the-lan-176986/ where a suggestion is given but I am not quite sure as how to implement it.
    I hope I have asked this question the smart way. Any suggestions / ideas are more than welcome!

  2. #2
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    890
    Shot in the dark here, but maybe try a higher port number, such as 8889.
    Also, you can try to telnet to that IP and port with telnet. You should get a connection. This will tell you if it's your putty settings, etc.

    Other settings: Make sure you sshd_config file doesn't have a white list, as this will disallow all other connections. Also check hosts.allow file.

  3. #3
    Just Joined!
    Join Date
    May 2007
    Posts
    16
    Quote Originally Posted by gacanepa View Post
    Hi all,
    I have a home server running Debian Squeeze. This server is behind a router with a static IP.
    ...
    I hope I have asked this question the smart way. Any suggestions / ideas are more than welcome!
    At the risk of sounding like an unhelpful geek have you checked the logs on your router and server?
    gacanepa likes this.

  4. #4
    Just Joined!
    Join Date
    Feb 2012
    Posts
    2
    Hi.

    there is a configuration where you can specify that the connection incoming become from a redirection port.

    you can find this configuration from the man page's, just type in a terminal "man ssh" I don't remember exactly what configuration's file is.

    cheers.
    gacanepa likes this.

  5. #5
    Just Joined!
    Join Date
    Dec 2011
    Location
    Seattle, WA
    Posts
    8
    Make sure you can connect from a local network to the ssh port first.

    Since you can connect the web port without any problem, it doesn't sound like a port-forward issue at least.
    gacanepa likes this.

  6. #6
    Just Joined!
    Join Date
    Apr 2006
    Location
    San Jose, CA, USA
    Posts
    6
    It is possible the problem is network rules where you are trying to connect from. My company, for example doesn't allow outbound connections to ports above 1024.
    gacanepa likes this.

  7. #7
    Just Joined!
    Join Date
    Feb 2012
    Posts
    12
    I forgot to mention that ssh within the LAN works just fine.
    Yesterday when I got home I changed the public port to 22 (which is forwarded by the router to private port 22) and it worked! There must have been something wrong with public port 1982 I guess - it was open in the router but it was not forwarding traffic to the LAN.
    Any ideas why? The router is a Dlink-600. Anyway, I'll mark this as solved, but additional insights are always welcome, so feel free to keep 'em coming.

  8. #8
    Just Joined!
    Join Date
    Feb 2012
    Posts
    12
    Also, thank you all guys for taking the time to write and provide some very helpful ideas!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •