centos上转发
yum install -y socat
ubuntuapt-get update apt-get install -y socat
socat的使用1、转发TCP nohup socat TCP4-LISTEN:30000,reuseaddr,fork TCP4:1.1.1.1:30000 >> socat.log 2>&1 & 2、转发UDP nohup socat -T 600 UDP4-LISTEN:10000,reuseaddr,fork UDP4:1.1.1.1:10000 >> socat.log 2>&1 &
nginx tcp转发user nobody;
worker_processes auto;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
stream {
server {
listen 3000;
proxy_pass 127.0.0.1:3306;
4# 也支持socket
4# proxy_pass unix:/var/lib/mysql/mysql.socket;
}
}
nginx udp 转发
user nobody;
worker_processes auto;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
stream {
server {
listen 3000 udp;
proxy_pass 127.0.0.1:3001;
}
}
windows 工具转发
netsh interface portproxy add v4tov4 listenaddress=172.16.0.4 listenport=8080 connectaddress=104.104.104.104 connectport=9999