# Local Port Forwards

![](https://308507326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6twoQL4uXTWwvk3lNMue%2Fuploads%2FSL9nbpN7xkzCaIbKoRYp%2F1.png?alt=media\&token=9a5f7c4c-1a9d-4462-92e7-21fdcc75946e)

```shell
# Local Port Forwarding (using rinetd)

# Target Machine // 10.0.0.1
Python -m SimpleHTTPServer 80

# Gateway Machine
apt-get install rinetd
nano /etc/rinetd.conf
    localhost    localport    remotehost    remoteport     
    127.0.0.1    53            10.0.0.1    80

# Kali Machine // http://gatway:53 → http://10.0.0.1:80
```

```shell
# Local Port Forwarding (using netcat)

# Target Machine // 10.0.0.1
nc -lnvp 22

# Gateway Machine
mknod relaynode p
nc -lvnp 1111 0<relaynode | nc 10.0.0.1 22 1>relaynode

# Kali Machine
nc gateway 1111
```

```shell
# Local Port Forwarding (using SSH)

# Target Machine // 10.0.0.1
Python -m SimpleHTTPServer 80

# Gateway Machine
nano /etc/ssh/sshd_config
    Port 53

# Kali Machine
// Now we will connect to the gateway through ssh on port 53, then we will connect
// port 8080 on the internal machine with port 80 on the web server machine. 
ssh user@gateway -p 53 -L 127.0.0.1:8080:10.0.0.1:80
// Now browse to http://127.0.0.1:8080 -> http://10.0.0.1:80
```
