LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-24-2005, 02:50 PM   #1
true_atlantis
Member
 
Registered: Oct 2003
Distribution: fedora cor 5 x86_64
Posts: 639

Rep: Reputation: 30
accessing my router from a different computer


i have a machine that i cannot physically access, but i can ssh to it. there is a router connected to that machine that i need to access (http://192.168.1.1). is it possible to do this from a different location?
 
Old 12-24-2005, 03:17 PM   #2
pnellesen
Member
 
Registered: Oct 2004
Location: Missouri, USA
Distribution: Slackware 12.2, Xubuntu 9.10
Posts: 371

Rep: Reputation: 31
Any chance you can start up a VNC server instance on that machine via SSH? If not, maybe try one of the various text-based browsers? (Hopefully someone reading this has some better ideas [Edit - like the reply below me, for instance ] )

Last edited by pnellesen; 12-24-2005 at 03:31 PM.
 
Old 12-24-2005, 03:24 PM   #3
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
Originally Posted by true_atlantis
i have a machine that i cannot physically access, but i can ssh to it. there is a router connected to that machine that i need to access (http://192.168.1.1). is it possible to do this from a different location?
You want to access the router using http, correct?

From your client computer, run the following ssh command:

ssh -L8999:192.168.1.1:80 server_ip_address

Enter your login/password so you have an established ssh connection between the client and server. What you have done is setup ssh port forwarding between localhost:8999 and 192.168.1.1:80 using your server as the intermediate.

[edit]
p.s. If your client is a Windows computer and you're using Putty as the ssh client program, it supports port forwarding too. Just browse through the GUI based configuration of Putty and you'll find it somewhere.
[/edit]

Fire up the web browser on your client, and enter the following URL:

http://localhost:8999

That should put you in to your router (on port 80). That "8999" is a local port on your client computer. It doesn't have to be 8999, just any port that is available. Generally chose some port above 1025 because you may not be able to use ports below this, depending on your permissions on the client computer.

Last edited by haertig; 12-24-2005 at 03:44 PM.
 
Old 12-24-2005, 09:02 PM   #4
true_atlantis
Member
 
Registered: Oct 2003
Distribution: fedora cor 5 x86_64
Posts: 639

Original Poster
Rep: Reputation: 30
i am using putty, but i cannot get it to work... here is how i have it set up...

source port: 80
destination: localhost:8999

then i connecto to my ip, and it gives me a 'connection refused' when i try to opeh http://localhost:8999

there are some othe roptions, but im not sure which to select...
'local ports accept connections from other hosts'
'remote ports do the same'

then under destination i have options
'local' 'remote' or 'dynamic'
and
'auto' 'IPv4' or 'IPv6'

am i doing something wrong?
 
Old 12-24-2005, 10:13 PM   #5
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
Originally Posted by true_atlantis
i am using putty, but i cannot get it to work... here is how i have it set up...

source port: 80
destination: localhost:8999
You have it backwards.

For SOURCE PORT, put 8999
For DESTINATION, put 192.168.1.1:80

The SOURCE PORT, according to Putty, is the port on your client that you will be connecting to. Thus you would point the web browser on your client to http://localhost:8999 for this example. Your client computer is connecting to ITSELF, thus the "localhost" in the URL.

The DESTINATION is where the connection will ultimately end up. In this example, your router. Thus you specify your router's IP address and port in the DESTINATION field. Note that the IP address in the DESTINATION does not have to be accessible from the client computer. It needs to be accessible from the ssh server computer. That's the whole point in what we're trying to do here. Your client computer cannot contact your router directly, but your ssh server can, so we set up a tunnel from the client to the router via the ssh server.

I'll try to draw what's happening as viewed from your client computer:

localhost:8999 ---> ssh_server_ip_address:22 ---> 192.168.1.1:80

Your client computer's web browser thinks its talking to port 8999 on its own local self (actually, it IS). But ssh is encrypting the data, sending it to your ssh server, then unencrypting it, and finally sending it on to 192.168.1.1:80. Note that it's entirely possible that your client computer can also talk to something at 192.168.1.1, but it's a totally different thing than the 192.168.1.1 that your ssh_server can talk to. The DESTINATION is specified relative to your ssh_server, not your client.

Now if THAT wasn't confusing, I don't know what is!!!

[edit]
Sorry, I forgot the other part of your question before posting last time.

In Putty, fill in your SOURCE PORT and your DESTINATION. Leave everything else at it's default. Then click the ADD button. You may also want to go back to the "Session" area of the config and click SAVE so that your port forwarding comes up automatically next time as well.
[/edit]

Last edited by haertig; 12-24-2005 at 10:17 PM.
 
  


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
Computer accessing lan but not dsl on it suman_rath Linux - Networking 3 06-28-2005 06:36 PM
Can my linux computer be a router AND a regular computer? DJOtaku Linux - Wireless Networking 4 06-09-2005 07:22 AM
Computers behind router behind computer behind router remi Linux - Networking 1 05-05-2005 05:08 PM
Accessing a computer behind NAT Menestrel Linux - Networking 1 01-16-2005 06:07 AM
accessing my computer remotely paul44 Linux - Newbie 3 05-06-2004 08:17 AM

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

All times are GMT -5. The time now is 09:36 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
Open Source Consulting | Domain Registration