socat Single-Port TCP/UDP Traffic Forwarding

Installing socat

centos

yum install -y socat

ubuntu or debian

apt-get update
apt-get install -y socat

Using socat

1. Forward TCP

Description:
TCP4-LISTEN:10000 listens on IPv4 TCP port 30000. Change 30000 to the port you want to forward
fork TCP4:1.1.1.1:30000 forwards to port 30000 on 1.1.1.1. Modify the IP and port as needed
nohup runs in the background. You can put this command into /etc/rc.local to start it automatically on boot.

nohup socat TCP4-LISTEN:30000,reuseaddr,fork TCP4:1.1.1.1:30000 >> socat.log 2>&1 &

2. Forward UDP

nohup socat -T 600 UDP4-LISTEN:30000,reuseaddr,fork UDP4:1.1.1.1:30000 >> socat.log 2>&1&


Enter the two commands to enable TCP+UDP forwarding

Leave a Comment

Your email address will not be published. Required fields are marked *

中文 EN
🚀

RedGate VPN

免费节点太挤太慢?
升级高速稳定专线

立即体验 →

告别卡顿

RedGate VPN
全球高速节点

免费下载 →
Scroll to Top