Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 2306  / 2 Years ago, wed, july 13, 2022, 2:04:23

I have a server, which can be seen from outside of my small network, sever has domain name and such. And I have a local machine, which can be seen by server, but is not accessible from outside.



So I want to be able to connect to port on the sever, but talk to my local machine instead.



Can I make traffic arriving on one port on the server be relayed to another port on my local machine?


More From » 11.04

 Answers
2

You can simply use openssh to do so: https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding



The commands to look for are -L or -R.



Let's say you want to forward port 4444 on the server to port 5555 on the local machine. On the Server use



ssh -L 4444:local_machine_name:5555 user@local_machine_name 


or on the local machine use



ssh -R 4444:localhost:5555 user@server_machine_name 


(In the first example you could connect to any other machine, no need to connect to local_machine_name, you could just use localhost to connect to the server itself).



Another more complex way is to use the server as a router. See https://help.ubuntu.com/community/Router and especially https://help.ubuntu.com/community/Router#Enable_IP_forwarding_and_Masquerading.
This is what most small cable or DSL home router do.


[#43406] Wednesday, July 13, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kroapathe

Total Points: 445
Total Questions: 117
Total Answers: 99

Location: Botswana
Member since Sun, Sep 19, 2021
3 Years ago
;