Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have developed an embedded application running linux to do remote I/O control. The application open a socket connection to my server to communicate, periodically, the state of the I/O and getting command to execute locally. For debug purposes I would like to be able to connect to the ssh server running on the embedded system. I cannot update the router configuration to establish a port forwarding. Whai I need is to be able to use the socket established by the embedded system to reach its ssh server. I have no idea if it is possible and how to do it. Can someone give me a suggestion ? Thank you in advance. Marco

share|improve this question

1 Answer 1

It is not possible to use an existing socket for a different purpose. It'd be like driving a train down the highway - it just isn't going to work (or not without first digging up the highway and laying rails).

So what are your options?

Well, there's a few.

One would be to run a VPN server on your server to which your embedded system connects. This will effectively punch through your router and create a new network connecting your embedded system and your server together. You can then ssh through that new network. I often use vtun1 for this as it's light weight, has many many different configuration options (including virtual Ethernet which is really nice2).

You could have your embedded system retrieve commands from your server through its existing channel and if it gets the right command it then opens an SSH connection to your server, including SSH port forwarding. This would open an unbound TCP connection between the embedded system and your server which you could then do what you like with. It could, for instance, connect a local socket on the server to an SSH daemon running on the embedded system, so you would then ssh to the localhost but on a different port number and it would forward that connection through to the embedded system.

My favourite would be to use the VPN though, as it opens up a whole new world of possibilities, not just a single SSH tunnel.


1vtun is available in the standard Debian / Ubuntu / etc apt repositories.

2I have both my desktop and my laptop connected to my two servers, which are also connected to each other, using vtun with virtual ethernet (tap) and TCP connections, plus quagga for BGP routing. My laptop can talk to my desktop when I am out and about using my phone for internet access as if they were in the same room. Oh, and it is all encrypted as well.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.