LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 04-13-2010, 02:20 PM   #1
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Rep: Reputation: 39
How to ssh to computers on LAN from a proxy that has public IP


I have a PC which has a Public IP.It is a webserver but it is not a proxy server.I want to be able to do an ssh to the machines which are behind this webserver on LAN in one step.

Right now I do an SSH to this webserver and then do an SSH to any other machine on my LAN how can I do it in one step.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 04-13-2010, 02:35 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
You'll likely want to setup some kind of port forwarding pseudo-proxying. Check out this article, its a bit old but generally relevant.

http://tldp.org/HOWTO/IP-Masquerade-...orwarders.html
 
Old 04-13-2010, 04:38 PM   #3
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
You could make a script that first connects via SSH to the webserver in the background, with port forwarding configured to make connections to the interior machine's SSH port. Then it would start a 2nd SSH towards the forwarded port on the local host, which will get carried through the first SSH's forwarding and connect to the interior machine. If there are many interior machines, this can get more complicated. I have something similar set up, in reverse (connections come out to let me go in), done through cron jobs.
 
Old 04-14-2010, 12:07 AM   #4
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Original Poster
Rep: Reputation: 39
Thank you all for your support.I found this article useful
http://www.debian-administration.org/articles/73
Ya portforwarding via IPTABLES is required.
and this post was also helpful after I got a clue to forward ports
http://www.linuxforums.org/forum/lin...orwarding.html

If some one comes for the same problem here
It should be some thing like this
Code:
iptables -A PREROUTING -i eth1 -p tcp -m tcp --dport 3000 -j DNAT --to-destination 192.168.1.9:22
iptables -A INPUT -i eth1 -p tcp -m tcp --dport 3000 -j ACCEPT
iptables -A FORWARD -i eth1 -p tcp -m tcp --dport 3000 -j ACCEPT
The destination and ports will change according to your internal setup.The above IPTABLE rule will be used on the machine that is your router or Gateway.To forward a request coming on port 3000 on router to a machine internal 192.168.1.9 at port 22 where SSH runs.
192.168.1.9 is the IP of internal machine which I want to access from internet via outside.I have used port 3000 you can use any from 1024 onwards.
Suppose you are at a coffee shop outside and you want to access your machine behind the router
you will do
Code:
ssh Public IP of router:3000 -lusername
The following article is also useful
Code:
http://www.hackorama.com/network/portfwd.shtml

Last edited by tkmsr; 04-18-2010 at 11:26 AM.
 
2 members found this post helpful.
  


Reply



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
Trying to send system notifications via SSH to computers on LAN. uncertain Programming 13 08-15-2009 04:56 PM
What's can you do with public computers? baldurpet Linux - Newbie 6 03-05-2009 03:13 PM
Linux Proxy: Public to LAN eliufoo Linux - Server 3 04-26-2008 05:20 AM
Two computers behind router, how do I ssh from outside the LAN? kdnewton Linux - Networking 13 08-30-2006 01:38 AM
KDE Lan Browser doesn't display available LAN computers dance2die Linux - Newbie 2 01-16-2005 08:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:22 PM.

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
Open Source Consulting | Domain Registration