【port forwarding】socat
們將啟動一個詳細模式的(-ddd) Socat 進程。
它將在 TCP 埠 2345 上監聽(TCP-LISTEN:2345),在收到連接時分叉為一個新的子進程(fork)
,而不是在單個連接後死亡,
然後將收到的所有流量轉發到 PGDATABASE01 的 TCP 埠 5432(TCP:10.4.50.215:5432)。
# socat -ddd TCP-LISTEN:{src_port},fork TCP:{dist_ip}:{dist_port}
confluence@confluence01$ socat -ddd TCP-LISTEN:2345,fork TCP:10.4.50.215:5432
<ocat -ddd TCP-LISTEN:2345,fork TCP:10.4.50.215:5432
2022/08/18 10:12:01 socat[46589] I socat by Gerhard Rieger and contributors - see www.dest-unreach.org
2022/08/18 10:12:01 socat[46589] I This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)
2022/08/18 10:12:01 socat[46589] I This product includes software written by Tim Hudson (tjh@cryptsoft.com)
2022/08/18 10:12:01 socat[46589] I setting option "fork" to 1
2022/08/18 10:12:01 socat[46589] I socket(2, 1, 6) -> 5
2022/08/18 10:12:01 socat[46589] I starting accept loop
2022/08/18 10:12:01 socat[46589] N listening on AF=2 0.0.0.0:2345