1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-04 23:58:01 +00:00

Add Forward Multiple Ports Over SSH as a unix til

This commit is contained in:
jbranchaud
2018-02-02 14:30:51 -06:00
parent d00f405a04
commit 13e8a7fa42
2 changed files with 22 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
# Forward Multiple Ports Over SSH
I sometimes find myself doing web app development on another machine via an SSH
connection. If I have the server running on port 3000, then I like to use
SSH's port forwarding feature so that I can access `localhost:3000` on my
physical machine.
```bash
$ ssh dev@server.com -L 3000:localhost:3000
```
What if I have two different servers running? I'd like to port forward both
of them -- that way I can access both.
SSH allows you to forward as many ports as you need. The trick is to specify
a `-L` for each.
```bash
$ ssh dev@server.com -L 3000:localhost:3000 -L 9009:localhost:9009
```