LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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
 
LinkBack Search this Thread
Old 05-14-2006, 11:12 AM   #1
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Rep: Reputation: 42
ssh to 2 PCs on my network remotely?


I have 2 Linux PC's at home. But I want to be able to ssh to either of them remotely. Right now I can ssh to one PC remotely by the hostname, I can only ssh into the 2nd PC through my local network. I have changed the default ssh port on the 2nd PC(ssh_config and sshd_config) to another port and opened that port on my router for the local IP but it still wont connect via ssh remotely, only locally. I have also set the default port to 22 and opened a port on my router for port 22 for the local IP.

The hostname on the first PC is one I bought, the hostname on the 2nd PC is one through dyndns.org.

What changes do I need to make so I can ssh into either of these PCs remotely?

I'm using Slackware 10.2 for both PCs.
Router is Linksys
 
Old 05-14-2006, 11:48 AM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,697

Rep: Reputation: 61
You would not need to change the default ports on the sshd servers on either machine. You just need to define say port 23 on the outsdie to portforward to port 22 on IP of the machine.

external IP [or hostanme] port 22 to machine 1 - internal IP port 22
external IP [or hostname] port 23 to machine 2 - internal IP port 22

Whether you use the bought one or the DYNdns one I assume they both point to the same external IP

Brian1
 
Old 05-16-2006, 06:51 AM   #3
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Original Poster
Rep: Reputation: 42
Thanks for the response.

But I must be an idiot, I still can't get this.

Where do I do this?


external IP [or hostanme] port 22 to machine 1 - internal IP port 22
external IP [or hostname] port 23 to machine 2 - internal IP port 22


I tried forwarding ports on my router in all different configurations. Ive seen some ssh commands such as

ssh -L 9999:mailserver:110 shellserver
from http://www.securityfocus.com/infocus/1816

and also
http://net-ssh.rubyforge.org/chapter-6.html

but again I'm lost as to put what where. Any other advice?

Thanks!
 
Old 05-16-2006, 08:39 AM   #4
dimis
LQ Newbie
 
Registered: May 2006
Posts: 20

Rep: Reputation: 0
You could just configure your router to forward port 23 to your 2nd linux box at port 22

So it would be like ExternalIP:23 -> 2ndPC:22

So as mentioned earlier, no need to change the port sshd is running.

So when you ssh blabla.dyndns.org:23 you'll get to your 2nd pc

and

when you ssh blabla.dyndns.org:22 you'll get to your 1rst pc.

Last edited by dimis; 05-16-2006 at 08:40 AM.
 
Old 05-16-2006, 12:17 PM   #5
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Original Poster
Rep: Reputation: 42
dimis

Ok I set it up like that on my router. Since I'm on a windows machine I used putty, put the hostname in and changed the ssh port to 23, it connected to my 2nd PC but almost as soon as it connected it disconnected and killed my session to PC1. Now I can't get connected to either PC. Maybe some conflict somewhere?

Oh I and I have telnet port disabled on my router.
 
Old 05-16-2006, 02:06 PM   #6
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Original Poster
Rep: Reputation: 42
ok.. I fixed it. just changed the default port in sshd and ssh config files and opened an used port on my router and it works.

Thanks again for the help.
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I run wine remotely via ssh? jon_k Linux - Software 1 06-04-2005 04:57 AM
Remotely connecting to MySQL using SSH Teleute Linux - Security 19 03-25-2005 10:51 PM
difficulty using ssh to connect to X11 remotely shortname Linux - Networking 6 03-05-2005 12:53 PM
Problems with SSH and connecting remotely username17 Linux - Networking 13 08-06-2004 06:57 PM
ssh to my box on ADSL remotely? yocompia Linux - Networking 5 09-07-2003 08:01 PM


All times are GMT -5. The time now is 05:28 AM.

Main Menu
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