Difference between revisions of "Socat"

From wikieduonline
Jump to navigation Jump to search
 
(32 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{lc}}
 +
[[wikipedia:socat]] (2009)
 +
* http://www.dest-unreach.org/socat/
 +
* Alpine: https://hub.docker.com/r/alpine/socat
 +
* <code>[[brew install socat]]</code>
 +
* <code>[[socat -h]]</code>
  
 +
'''Forward''' port 80 to localhost:8090 <ref>https://unix.stackexchange.com/a/293308</ref>
 +
* <code>socat [[TCP-LISTEN]]:80,fork TCP:127.0.0.1:[[8090]]</code>
 +
* <code>socat TCP-LISTEN:80,fork,reuseaddr TCP:127.0.0.1:8090</code>
  
'''Forward''' port 80 to localhost:8090
+
Debugging:  
* <code>socat TCP-LISTEN:80,fork TCP:127.0.0.1:8090</code>
+
* <code>[[socat -d]] -d TCP-LISTEN:80,fork TCP:127.0.0.1:8090</code>
 +
Logs connections (<code>-d -d</code>):
 +
2019/05/13 04:24:30 socat[15433] N listening on AF=2 0.0.0.0:XX
 +
2019/05/13 04:24:43 socat[15433] N accepting connection from AF=2 xx.99.12.xxx:62833 on AF=2 xxx.xxx.xxx.xxx:2244
 +
2019/05/13 04:24:43 socat[15433] N forked off child process 15438
 +
2019/05/13 04:24:43 socat[15433] N listening on AF=2 0.0.0.0:XX
 +
2019/05/13 04:24:43 socat[15438] N '''opening connection to''' AF=2 1xx.253.51.xx:XX
 +
2019/05/13 04:24:44 socat[15438] N successfully connected from local address AF=2 xxx.xxx.xxx.xxx:46596
 +
2019/05/13 04:24:44 socat[15438] N starting data transfer loop with FDs [6,6] and [5,5]
  
  
 +
 +
== Errors ==
 +
socat TCP-LISTEN:8043,fork TCP:10.10.10.xx:443
 +
2020/08/10 19:24:54 socat[1587199] E bind(5, {AF=2 0.0.0.0:8043}, 16): Address already in use
 +
 +
socat TCP-LISTEN:192.168.10.1:80,fork TCP:127.0.0.1:8090
 +
2021/02/07 11:43:49 socat[26463] E TCP-LISTEN: wrong number of parameters (2 instead of 1)
 +
 +
== Options ==
 +
* <code>[[nodelay]]</code> Turns off the [[Nagle]] algorithm for measuring the [[RTT]] (round trip time).
 +
* [[unix-listen]]
 +
 +
== Related terms ==
 +
* <code>[[logger]]</code>, <code>[[systemd-cat]]</code>
 +
* [[Port forwarding]]
 +
* [[Santiago Zanella-Beguelin]] and [[Microsoft Vulnerability Research]]
 +
* <code>[[unix-listen]]</code>
  
 
== See also ==
 
== See also ==
 
* {{netcat}}
 
* {{netcat}}
 +
* {{socat}}
 +
 +
[[Category:Networking]]

Latest revision as of 13:46, 10 January 2023

wikipedia:socat (2009)

Forward port 80 to localhost:8090 [1]

  • socat TCP-LISTEN:80,fork TCP:127.0.0.1:8090
  • socat TCP-LISTEN:80,fork,reuseaddr TCP:127.0.0.1:8090

Debugging:

  • socat -d -d TCP-LISTEN:80,fork TCP:127.0.0.1:8090

Logs connections (-d -d):

2019/05/13 04:24:30 socat[15433] N listening on AF=2 0.0.0.0:XX
2019/05/13 04:24:43 socat[15433] N accepting connection from AF=2 xx.99.12.xxx:62833 on AF=2 xxx.xxx.xxx.xxx:2244
2019/05/13 04:24:43 socat[15433] N forked off child process 15438
2019/05/13 04:24:43 socat[15433] N listening on AF=2 0.0.0.0:XX
2019/05/13 04:24:43 socat[15438] N opening connection to AF=2 1xx.253.51.xx:XX
2019/05/13 04:24:44 socat[15438] N successfully connected from local address AF=2 xxx.xxx.xxx.xxx:46596
2019/05/13 04:24:44 socat[15438] N starting data transfer loop with FDs [6,6] and [5,5]


Errors[edit]

socat TCP-LISTEN:8043,fork TCP:10.10.10.xx:443
2020/08/10 19:24:54 socat[1587199] E bind(5, {AF=2 0.0.0.0:8043}, 16): Address already in use
socat TCP-LISTEN:192.168.10.1:80,fork TCP:127.0.0.1:8090
2021/02/07 11:43:49 socat[26463] E TCP-LISTEN: wrong number of parameters (2 instead of 1)

Options[edit]

Related terms[edit]

See also[edit]

  • https://unix.stackexchange.com/a/293308
  • Advertising: