60 votes

Forward local port or socket file to remote socket file

Altough in the time, when the question was asked, it was really impossible, but it is possible nowadays. You can to both: UNIX => TCP and UNIX => UNIX forwarding. For example (LOCAL PORT TO ...
Igor Chubin's user avatar
31 votes
Accepted

How to ssh to a server which I can not directly reach?

You can use the following command to set up an SSH tunnel from the remote server to your local machine: $ ssh -f -N -R 1234:localhost:22 user@your_machine_ip When the tunnel is set up, you can ...
Khaled's user avatar
  • 36.9k
25 votes

How to forward port 80 to another port on the samemachine?

Just found myself in this question and couldn't find an easy way. Don't want to install Nginx in my machine to do this simple port forwarding. Rinetd didn't work for me, no working package for my ...
alfetopito's user avatar
25 votes

How to add local forward setting to my ssh config file?

I think, you have differently defined command and config. In command, you are using localhost and in config, IP address (12.34.56.78). This should works for you: Host myhost User myuser ...
dorinand's user avatar
  • 359
24 votes
Accepted

nginx proxy_pass using subfolder

Since you tagged this as a reverse proxy question, I assume you mean that you want to proxy the request so that user only sees http://aaa.bbb.ccc.ddd/app2 URL in her browser. You can change your ...
Tero Kilkanen's user avatar
23 votes
Accepted

How to temporarily disable local forwards

There is ClearAllForwardings option in ssh_config, which does exactly what you need: ClearAllForwardings Specifies that all local, remote, and dynamic port forwardings specified in the ...
Jakuje's user avatar
  • 10k
18 votes

How can I port forward with iptables?

The accepted solution works when the destination host and the gateway are on the same subnet (like is in your case, both are on eth0 192.168.1.0/24). Below is a generic solution for when the gateway, ...
rustyx's user avatar
  • 1,757
18 votes

Forward SSH through SSH tunnel

As of OpenSSH 7.3 (late 2016) the easiest way is the ProxyJump setting. In your ~/.ssh/config: Host B ProxyJump A Or on the command line, -J B.
arantius's user avatar
  • 311
17 votes

Can't SSH into a Vagrant Virtual Machine

It's old but as there is no answer, I'll provide one. Command: vagrant ssh Is the equivalent of ssh vagrant@localhost -p 2222 -i .vagrant/machines/default/virtualbox/private_key This is default ...
stefwhite's user avatar
  • 171
15 votes
Accepted

Iptables forward all traffic to a specified port, to another device

This rule will forward 80 port to 192.168.42.10 iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.42.10:80 but this is not enough If you want to get back traffic then ...
stambata's user avatar
  • 1,718
15 votes
Accepted

SSH: What's the difference between -L and -R?

It's right there, in the man page: -L Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port, or Unix socket, on the ...
Gerald Schneider's user avatar
13 votes
Accepted

Accessing to a remote PostgreSQL server using port forwarding to another machine

This command: ssh -L 54320:Server_A:5432 user@Server_B looks good, but then when doing this: psql -p 54320 -d db_name -U user the ssh tunnel is not used, because by default on Unix, psql connects ...
Daniel Vérité's user avatar
12 votes
Accepted

Set up public ip on server

Presenting a service to the Internet definitely should not be done unless you know what you're doing. Fortunately it's mostly a matter of not being naïve, but you definitely should have passed a ...
Mikael H's user avatar
  • 5,089
11 votes

Can I use ufw to setup a port forward?

Since ufw 0.34 ufw supports forward rules. example: sudo ufw route allow in on eth0 out on eth1 to 10.0.0.0/8 port 8080 from 192.168.0.0/16 port 80 You also need to make sure you have the ...
Bryan Larsen's user avatar
11 votes
Accepted

iptables port forwarding to server with different port

Damn it. I fixed it like a min after posting this. Solution: echo 1 > /proc/sys/net/ipv4/ip_forward
Wundark's user avatar
  • 169
11 votes

Port Forwarding puzzle

Seem like to me you forgot to add a default gateway in that PLC.
yagmoth555's user avatar
  • 17.1k
11 votes
Accepted

How to add local forward setting to my ssh config file?

The syntax of the ssh_config file was correct - so the error had to be somewhere else. The command line which worked was: ssh 12.34.56.78 -L 8888:localhost:8000 but in the LocalForward directive, you ...
Martin's user avatar
  • 2,384
10 votes
Accepted

ssh remote port forwarding: connection refused

tcp 0 0 127.0.0.1:1234 0.0.0.0:* LISTEN 14460/1 Problem can be very well seen in the output of netstat. Your remote machine is listening on 127.0.0.1:1234, which is ...
Arjun sharma's user avatar
9 votes

Forward local port or socket file to remote socket file

No more socat is needed since ssh 6.7. You can forward unix domain sockets directly like: ssh -nNT -L $(pwd)/docker.sock:/var/run/docker.sock user@someremote More info: https://medium.com/@dperny/...
CMCDragonkai's user avatar
9 votes
Accepted

Using iptables port redirection with docker

A possible modification to the iptables rules is to remove both and replace with: iptables -t nat -A PREROUTING -p tcp -m tcp -i eth0 --dport 80 -j REDIRECT --to-ports 8080 This will ensure that, ...
davidA's user avatar
  • 393
9 votes
Accepted

RDP equivalent to SSH port forwarding?

No, it is not possible with RDP. You can install an SSH server on windows and continue to use SSH. Alternatively, you can use netsh to do TCP forwarding as described in this answer on SO: netsh ...
Gerald Schneider's user avatar
8 votes
Accepted

host port forward with qemu through libvirt in user-mode networking

the missing part from your configuration is described here: https://www.linux-kvm.org/page/Networking. You have to add another netdev with new address like so: <domain type='kvm' xmlns:qemu='http:/...
mihais's user avatar
  • 96
8 votes
Accepted

How to port forward only on a single host IP address

A firewalld zone can be specified either by interface or by source address, but you want to filter by destination address. You'll need a rich rule to handle this particular situation. Such a rich ...
Michael Hampton's user avatar
8 votes
Accepted

How to redirect port 80 to 8080 while keeping 8080 closed to the Internet?

This schematic should help you understand how packet handling is done: The filter/INPUT rules see only packets after they were NATed in nat/PREROUTING, so by default can't tell the difference between ...
A.B's user avatar
  • 12.7k
8 votes
Accepted

Double port forwarding kubernetes + docker

I think there are two possible solutions that may help in your case: You can add the --address argument to the kubectl port-forward command with the IP address of the container running this command. ...
matt_j's user avatar
  • 420
7 votes

Port forwarding test possible within LAN? Mikrotik Router

Mikrotik RouterOS based on the Linux kernel and has inherited most of the conceptions of networking. So, I'll describe the setup of the port forwarding in the Mikrotik routers. And I'll try to ...
Anton Danilov's user avatar
7 votes

Is there a speed and performance difference between VPNs (L2TP, etc.) vs. port forwarding?

Port forwarding would be quicker, but it would be less secure, in the sense that there is no confidentiality, or integrity. If you don't care then it is not a problem. Any VPN or tunnelling will add ...
SlyOne's user avatar
  • 363
7 votes
Accepted

Port forwarding with wireguard

Since you're using UFW, first make sure the UFW rule for port 56000 that you added is not a regular input rule, but instead a "route" (aka forwarding) rule, like this (assuming it's for a ...
Justin Ludwig's user avatar
6 votes

lxd container: port forwarding like docker

Four years later, the prediction given in this answer was fortunately too pesimisitc. Port forwarding has been implementented in LXD in the meantime as is documented here. To forward port 80 on the ...
mat's user avatar
  • 548

Only top scored, non community-wiki answers of a minimum length are eligible