Say I have a machine A acting as a router with two NICs and the following IP addresses:

eth0: (LAN)
eth1: (WAN)

And I have another machine B on IP address that I want to be able to temporarily reach into a device on machine A's subnet with IP address

This would need to handle multiple connections over the same port (like an HTTP session), rather than just a one off. I know of how to do this with SSH but I was wondering if there was a simpler alternative because in this scenario I'm already logged into machine A.

This is the SSH template I use for a similar scenario, when I'm not already logged in:

ssh -R 0:lanhost:lanport username@wanhost

The closest I've been able to get is this with netcat:

nc -s -l -p 50000 -e /tmp/srv.sh


nc 80

But that only handles a single connection and creating the shell script is clunky.

NOTE: I'd rather not mess with the IP tables of machine A if possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.