LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 10-01-2008, 02:14 PM   #1
rlinuxr
Member
 
Registered: Jul 2003
Posts: 35

Rep: Reputation: 15
Accesing Linux Server Behind The Router At Home


Hi All,

I have a home network setup using Netgear MR814 router (wired option).
My network consists of three Windows XP machines and one Linux (Redhat 5) server. Each machine's IP is fixed via router.

I want to be able to access the Linux server from anywhere outside when I am traveling. I tried setting port forwarding in the Netgear router to forward incoming requests to the Linux server at port 22. However, when I try to use puTTY from an external machine (external to my home network), I get 'Network error: Connection refused' message.

If I use puTTY to connect to the Linux server from any of the Windows XP machines on the same network, I am able to connect using port 22. (ssh daemon is running on the Linux server).

How can I make this work?

puTTY version used is 0.60.

Thanks.
 
Old 10-01-2008, 02:30 PM   #2
timnp
Member
 
Registered: Feb 2008
Location: London
Distribution: FC8, FC9, Centos 4, Centos 5, Knoppix
Posts: 52

Rep: Reputation: 16
Hi,

Firstly, double check you have forwarded the ports correctly. Are your machines on your network on static IP addresses or are they dynamic. If dynamic, it's possible your Linux box has a different IP now compared with when you set up the port forwarding.

Another alternative is that perhaps your Linux box has a firewall that disallows connections from the wider net and only allows connections from its own local network.

Something else to check would be other ports, if you have apache installed on the box, or if you can install apache on the box, then you could forward port 80 to it. That way you should be able to see the apache test page. If you can see the apache test page then this is probably an SSH issue, if you can't see the apache test page then it's probably a routing/firewall issue.
 
Old 10-01-2008, 09:47 PM   #3
kirtimaan_bkn
Member
 
Registered: Aug 2004
Location: INDIA
Distribution: Various Distros
Posts: 203

Rep: Reputation: 31
You can use http://www.canyouseeme.org site to find if your port forwarding is correct.
 
Old 10-01-2008, 11:41 PM   #4
jgallo
Member
 
Registered: Sep 2008
Posts: 39

Rep: Reputation: 15
im guessing it's dhcp, you will need to set your internal IP addresses to static and the port forwarding should work.

Linux Archive

Last edited by jgallo; 10-12-2008 at 02:57 AM.
 
Old 10-02-2008, 12:36 AM   #5
rlinuxr
Member
 
Registered: Jul 2003
Posts: 35

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by timnp View Post
Hi,

Firstly, double check you have forwarded the ports correctly. Are your machines on your network on static IP addresses or are they dynamic. If dynamic, it's possible your Linux box has a different IP now compared with when you set up the port forwarding.

Another alternative is that perhaps your Linux box has a firewall that disallows connections from the wider net and only allows connections from its own local network.

Something else to check would be other ports, if you have apache installed on the box, or if you can install apache on the box, then you could forward port 80 to it. That way you should be able to see the apache test page. If you can see the apache test page then this is probably an SSH issue, if you can't see the apache test page then it's probably a routing/firewall issue.
1) All machines on my network have static IPs (fixed via router).
2) I have a static IP from my internet service provider.
3) There is no firewall on the Linux server.
 
Old 10-02-2008, 12:38 AM   #6
rlinuxr
Member
 
Registered: Jul 2003
Posts: 35

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by kirtimaan_bkn View Post
You can use http://www.canyouseeme.org site to find if your port forwarding is correct.
According to this site, everything is okay.


"Success: I can see your service on xx.xx.xxx.xxx on port (22)
Your ISP is not blocking port 22"
 
Old 10-02-2008, 05:39 AM   #7
timnp
Member
 
Registered: Feb 2008
Location: London
Distribution: FC8, FC9, Centos 4, Centos 5, Knoppix
Posts: 52

Rep: Reputation: 16
Is there anything in your sshd log?
 
Old 10-04-2008, 01:48 AM   #8
rlinuxr
Member
 
Registered: Jul 2003
Posts: 35

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by timnp View Post
Is there anything in your sshd log?
Where do I look for sshd log? There are several files under /var/log but I am not sure which one to look at.
 
Old 10-04-2008, 01:52 AM   #9
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
Typically /var/log/secure or /var/log/authlog. The command:

sudo grep -l sshd /var/log/*

will tell you.
 
Old 10-04-2008, 01:56 AM   #10
WorldIsNotFair
Member
 
Registered: Jun 2008
Location: Jakarta
Distribution: CentOS 5
Posts: 89

Rep: Reputation: 17
tcpwrapper maybe ?

edit /etc/hosts.allow
sshd : ALL
 
Old 10-04-2008, 02:05 AM   #11
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
Quote:
Originally Posted by WorldIsNotFair View Post
tcpwrapper maybe ?

edit /etc/hosts.allow
sshd : ALL
Generally, not by default, but should be checked.

"Connection refused" indicates an attempt to connect the socket was positively denied. Things to ensure:

1) router port forward is active and correct
2) sshd is listening on all relevant interfaces/port
3) iptables is not blocking connection attempts
4) SELinux / AppArmor is not interfering
5) tcpwrappers is not restricting access
6) your client is actually on the WAN (and not a LAN client attempting to connect to the WAN IP)

Last edited by Mr. C.; 10-04-2008 at 02:07 AM.
 
  


Reply

Tags
access, forwarding, port, remote, router


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
server behind home router. security concern? taiwf Linux - Security 4 06-09-2006 12:24 AM
Setting up home networking through server or router? Fice Linux - Networking 4 01-12-2006 03:08 AM
server at home, behind router zippo85 Linux - Networking 15 07-17-2005 06:22 PM
Home Network Setup Help Linux Server running Windoze XP clients + ADSL router BeaverusIV Linux - Networking 10 04-22-2005 05:07 PM
Home network using linksys router -- DHCP server? GoinEasy9 Linux - General 12 04-02-2004 12:32 AM


All times are GMT -5. The time now is 04:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration