Take the 2-minute tour ×
  • I have a computer at home with ip 192.168.221.xxx

  • I have another computer at work that I can ping and it has 2 ip addresses: 192.168.1.xxx and 192.168.0.xxx. Those last 2 addresses have the same gateway ie .

  • The computer at work is connected to a hub. That hub also has an embedded device connected to it with address 192.168.0.xxx

Now from my home computer I cannot ping this embedded device. How would I connect to it without changing the subnetwork it connects to? I can ping the embedded device from my work computer and I can ping the work computer from my home computer. So I am trying to connect to the embedded device from my home computer through my work computer. Port forwarding? how would I establish that on Ubuntu?

share|improve this question

migrated from stackoverflow.com Nov 4 '09 at 7:34

This question came from our site for professional and enthusiast programmers.

wrong site to ask. move it to Superuser! –  Mauris Nov 4 '09 at 7:32
IMHO more a Serverfault, then a Superuser question. –  Tim Büthe Nov 4 '09 at 8:58
Definitely a Server Fault question. –  CarlF Nov 6 '09 at 1:42
Please note Once a question has incorrectly been migrated it cannot be migrated again. Please don't flag this to be moved. –  Diago Nov 6 '09 at 5:39
Dont you find having a website for each category is a bit overkill? gets really hard to manage after a while –  user16654 Dec 22 '09 at 18:08

4 Answers 4

An easy way is to use SSH forwarding. Run a command like this:

ssh -L 8000:192.168.0.xxx:yyyy user@192.168.1.zzz

Once you authenticate to your work machine, ssh will be listening locally on port 8000. If you connect to localhost:8000, the connection will be forwarded to 192.168.0.xxx:yyyy.

[Edit: answer to below queries]

You are on host A. Using -R makes B listen on a port and forward to C. This might be fine, depending on how wide open your access to B is. Using -L makes A listen on a port, and tunnel the connection through B to C. So, let's say B is and C is, and you want to connect to C via ssh. You run this command:

ssh -L 8000: user@

Now A is listening on port 8000, but connections to it will be tunneled through to, so in a local shell, run this command:

ssh user@

This will make the connection to C (via your open session to B). Substitute other ports for other services, e.g. to connect to a webserver on C:

ssh -L 8000: user@

then point your browser to

share|improve this answer
This pretty much answers the question. For GUI goodness you can also do this in PuTTY. –  Manos Dilaverakis Nov 4 '09 at 9:37
so what you are saying is if i start a ssh session with putty at home and authenticate. then anything I send from home to 192.168.1.zzz will be sent to 192.168.0.xxx:yyyy? I need to connect to 192.168.0.xxx with a program. –  user16654 Dec 22 '09 at 22:50
its not working but at least it sends me on the right track I am thinking UI should use -R remote port forwarding instead of local because I need remote connection to localhost to be forwarded to computer C –  user16654 Dec 23 '09 at 19:25

It could be that the embedded device has no gateway/route to your home PC range 192.168.221.xxx. If you have access to its configuration you may be able to connect without forwarding by just adding an appropriate gateway to its routing table.

share|improve this answer

The question is a little fuzzy (maybe be, first thing in the morning).

I would check your subnet masks, if you are on then the .221, .1 and .0 machine are on completely separate networks.

As for the work and embedded machine, they are on the same network, but if they cannot communicate, my guess would be it is a routing conflict.

If this was me, I would disable the secondary interface on the work machine and make sure you put everything on the same network ( and then use the ips in the same range (192.168.0.x).

If everything is on a subnet of then they are on the same network already, so I would just disable the second interface on the work machine as this could be creating the conflict.

share|improve this answer

Set up B as a router.

If B is a linux machine, do this command:


Unless B is already the default gateway of A, You likely now need to configure A to know about network C, tell it to use B as a gateway to reach C.

route add -network netmask gw ip-of-B
share|improve this answer

Your Answer


