Thursday, September 22, 2016

use socat for port forwarding

1- diagram





pc1  --\>
              server  (23)
pc2  -->

pc1: 192.168.56.1
pc2: 192.168.56.23
server:192.168.56.2

pc1 is not able to access server on port 23, and pc2 could, so we can setup socat on pc2 to do port forwarding, hence the pc1 will use pc2 to access server on port 23


2- install socat on pc
$ sudo apt-get install socat

3- forwarding port 10023 on pc2 to server on port 23
$ socat TCP-LISTEN:10023,fork TCP4:192.168.56.2:23

4- on pc1 use telnet to port 10023 on pc2 to access port 23 on server
$ telnet 192.168.56.23 10023

- snapshot of access denied to server, and access granted with port forwarding on pc2



No comments:

Post a Comment