Search code examples
raspberry-piportforwardingdebian-jessie

port forwarding in raspberry pi on debian


enter image description here

I want to forward incomings from 192.168.1.50:5007 to 10.1.1.117:5007 on raspberry pi debian installed . I do not want to make a bridge between two networks. How can I achieve this?


Solution

  • You can use ssh: ssh -L 192.168.1.50:5007:10.1.1.117:5007 -N localhost

    this assumes that your server is the machine at 192.168.1.50. if not, you're going to need to give me the IPs of all the machines involved and tell me which is which.

    You'll need sshd running but you should already have that with Raspbian.

    After you run it, you'll need to authenticate. No forwarding will occur until then.

    Once you've logged in, it will look like it's hung, but it's not; it just doesn't have any output to show you.

    At this point the forwarding is active.

    You can kill it with ctrl-c when you're done.

    If you'd rather keep it running in the background instead of having an empty window sitting around, you can use ctrl-z (which will pause its execution) followed by bg which will resume the process in the background.

    To stop the forwarding from a backgrounded job, you're going to have to find the pid in ps and kill it.

    Run netstat -ano --tcp |grep 5007 to see your server listening for connections on 192.168.1.50:5007, remote computers making connections to 192.168.1.50:5007, and new connections from your server to 10.1.1.117:5007