Search code examples
interfacelocalhostsocat

make socat open port only on localhost interface


I use this line to open a connection to a server through a socks proxy:

socat -v TCP4-LISTEN:77,fork SOCKS4A:44.44.44.44:33.33.33.33:99,socksport=9898

it works great but I noticed it also opens the port 77 externally (like: 192.168.1.100:77). I would like it to only open it on 127.0.0.1:77.

PS. I do not want to have to configure firewall to block the port


Solution

  • I think what you want is

    socat -v TCP4-LISTEN:77,fork,bind=127.0.0.1 SOCKS4A:44.44.44.44:33.33.33.33:99,socksport=9898