LinuxQuestions.org
Visit Jeremy's Blog.
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 11-23-2012, 11:30 AM   #31
suicidaleggroll
Senior Member
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 3,197

Rep: Reputation: 1135Reputation: 1135Reputation: 1135Reputation: 1135Reputation: 1135Reputation: 1135Reputation: 1135Reputation: 1135Reputation: 1135

It should be either
Code:
a=$(ps -ef | grep 19999 | grep -v grep)
or
Code:
a=`ps -ef | grep 19999 | grep -v grep`
I don't know what they're trying to accomplish by putting the whole thing inside backticks inside parenthesis.

Last edited by suicidaleggroll; 11-23-2012 at 11:31 AM.
 
1 members found this post helpful.
Old 11-23-2012, 04:19 PM   #32
\/4A
Member
 
Registered: Aug 2012
Posts: 114

Original Poster
Rep: Reputation: Disabled
Thanks. Now the cronjob executes the script file OK and I can see this in webmin (on the inside machine) listed in 'running process'. However, when I'm trying to ssh into the inside machine using
Code:
ssh openemr@xxx.175.xx.251 -p 19999
(where xxx.175.xx.251 is the IP of the middle machine - xx's shown here to hide actual IP number), I just get the error:
Code:
ssh: connect to host xxx.175.xx.251 port 19999: Connection refused
Surprising at what stage of the connection, there's a block.

I've checked both firewalls on the inside as well as on the middle machines, and both are set to accept all traffic. I even tried changing from port 19999 to 465 but the same issue. Even on the router to which the inside machine is connected, I've enabled port forwarding for 19999 (pls see attached snapshot)

OK, in the running processes of the inside machine, I can see
Code:
ID      CPU   	Started   	Command   
4469	0.0 %	Nov23	        ssh -fN -R 19999:localhost:22 root@xxx.175.xx.251
Is there a way I could see on the middle machine, a reflection of this?
Attached Images
File Type: gif portforwarding.gif (27.0 KB, 11 views)
 
Old 11-23-2012, 06:22 PM   #33
descendant_command
Member
 
Registered: Mar 2012
Posts: 856

Rep: Reputation: 191Reputation: 191
So that port forwarding page is on the router that connects the target server to the internet?

Simply change the "local port" to 22 then from your home,
Code:
ssh user@target.public.ip -p 19999
No?
 
1 members found this post helpful.
Old 11-28-2012, 08:13 AM   #34
\/4A
Member
 
Registered: Aug 2012
Posts: 114

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by descendant_command View Post
So that port forwarding page is on the router that connects the target server to the internet?

Simply change the "local port" to 22 then from your home,
Code:
ssh user@target.public.ip -p 19999
No?
I did the modifications you suggested(pls see attached snapshot - taken after modifying), rebooted the whole system and tried using the command
Code:
ssh openemr@xxx.175.xx.251 -p 19999
where openemr is the username on the target machine (inside machine) and xxx.175.xx.251 is the IP number of the middle machine,but still just end up with
Code:
ssh: connect to host xxx.175.xx.251 port 19999: Connection refused
Attached Images
File Type: gif portforwarding.gif (26.5 KB, 11 views)
 
Old 11-28-2012, 02:40 PM   #35
descendant_command
Member
 
Registered: Mar 2012
Posts: 856

Rep: Reputation: 191Reputation: 191
Well you still haven't said, but if that port forwarding page is on the router that connects the target server to the internet, then you don't need a 'middle machine' or a reverse tunnel.
Just ssh directly to port 19999 on the target public ip.

Last edited by descendant_command; 11-28-2012 at 02:43 PM.
 
Old 11-29-2012, 04:29 AM   #36
\/4A
Member
 
Registered: Aug 2012
Posts: 114

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by descendant_command View Post
Well you still haven't said, but if that port forwarding page is on the router that connects the target server to the internet, then you don't need a 'middle machine' or a reverse tunnel.
Just ssh directly to port 19999 on the target public ip.
Sorry about this. I've now attached a diagram (based on what's shown at http://wiki.fabelier.org/index.php?t..._SSH_Tunneling) which shows the router on the inside - this is the router that connects to the internet and is behind the ISP's NAT and is the reason why I'm having to go the reverse ssh way.

It is this router whose port forwarding settings I've attached to my previous posts.
Attached Images
File Type: jpg portforwarding.jpg (25.3 KB, 10 views)
 
Old 11-29-2012, 05:12 AM   #37
descendant_command
Member
 
Registered: Mar 2012
Posts: 856

Rep: Reputation: 191Reputation: 191
Well in that case there is no point buggering about with port forwarding, as you won't ever be getting any incoming connections, and it has nothing whatsoever to do with outgoing connections.

edit: are you really sure that is the case? what is the external ip of the router?

Last edited by descendant_command; 11-29-2012 at 05:18 AM.
 
1 members found this post helpful.
Old 11-29-2012, 05:57 AM   #38
\/4A
Member
 
Registered: Aug 2012
Posts: 114

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by descendant_command View Post
edit: are you really sure that is the case? what is the external ip of the router?
yep, that is the case and the ISP put's nearly all it's customers behind their NAT, so all I know is, the router's IP is 192.168.0.1 and have no idea what the external IP is.
 
Old 11-29-2012, 06:23 AM   #39
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
just go to whatismyip.com to find that. or google it. https://www.google.co.uk/search?q=what+is+my+ip
 
1 members found this post helpful.
Old 11-29-2012, 02:12 PM   #40
descendant_command
Member
 
Registered: Mar 2012
Posts: 856

Rep: Reputation: 191Reputation: 191
Quote:
Originally Posted by \/4A View Post
yep, that is the case and the ISP put's nearly all it's customers behind their NAT, so all I know is, the router's IP is 192.168.0.1 and have no idea what the external IP is.
That is the internal ip.
Look at the settings for it's external interface.
 
Old 11-29-2012, 02:16 PM   #41
\/4A
Member
 
Registered: Aug 2012
Posts: 114

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by acid_kewpie View Post
just go to whatismyip.com to find that. or google it. https://www.google.co.uk/search?q=what+is+my+ip
I've done it and the public IP keeps changing - that's how ISP's connect here, giving dynamic IP numbers, plus under each such dynamic IP, there's lots and lots of their users like me connected at any one time.
 
Old 01-09-2013, 02:09 PM   #42
\/4A
Member
 
Registered: Aug 2012
Posts: 114

Original Poster
Rep: Reputation: Disabled
I'm still struggling on this and can't get it to work.

Googling around for similar solutions brought me to http://www.alexonlinux.com/reverse-s...ind-nat-router
and I tried it and it works well.
However, the issue I'm facing there is, it's not making a permanent connection from "inside machine" to "middle machine" and since the machine I'll be having as the "inside machine" will be a non-attended PC with no Keyboard, Video or Mouse, I need it to be permanently connected to the "middle machine".

Just a reminder, both "my machine" and "inside machine" are behind ISP's NAT firwalls and somehow using the method described at http://wiki.fabelier.org/index.php?t..._SSH_Tunneling
results in a "connection refused".
For the record, I've also added "GatewayPorts yes" on the "inside machine".
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] accessing server from remote host ridoy Programming 1 03-02-2011 08:35 AM
SLOW Accessing Home Web Server on LAN cyngallery Linux - General 9 08-19-2006 10:15 PM
accessing a host from a remote server onlynimal Linux - Networking 5 04-20-2006 08:37 AM
Accessing a remote X server from a Windows machine escordeiro Linux - Software 1 03-23-2005 10:24 PM
accessing mail server from remote tushar_mahakul Linux - Networking 1 09-14-2004 05:40 AM


All times are GMT -5. The time now is 07:42 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration