惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Help Net Security
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
N
News | PayPal Newsroom
V2EX - 技术
V2EX - 技术
博客园 - 【当耐特】
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
有赞技术团队
有赞技术团队
S
Schneier on Security
S
SegmentFault 最新的问题
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
Schneier on Security
Schneier on Security
PCI Perspectives
PCI Perspectives
IT之家
IT之家
Project Zero
Project Zero
博客园 - 司徒正美
P
Privacy International News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Security Latest
Security Latest
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity

Rat's Blog - 端口转发

Socat一键安装脚本,可转发TCP和UDP流量 - Rat's Blog Linux安装rinetd实现TCP端口转发,可加速网站 - Rat's Blog 使用iptables进行端口转发 - Rat's Blog Haproxy安装及端口转发配置 - Rat's Blog
使用socat进行单个端口的转发,同时支持tcp和udp - Rat's Blog
博主: Rat's · 2016-07-26 · via Rat's Blog - 端口转发

说明:由于用iptables经常不成功。所以只能寻求另一种办法,就是用socat工具来完成端口转发,如果你只有少数几个端口要转发的话,那么socat就是比较好的选择了。socat唯一麻烦的地方就是好像我没找到如何转发端口段,只能一个命令一个端口。不过如果只是自用转发少量端口的话还是蛮好用的。

socat安装

使用命令:

#CentOS系统
yum install -y socat

#Ubuntu或Debian系统
apt-get update
apt-get install -y socat

socat的使用

1、转发TCP

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

说明:

TCP4-LISTEN:10000监听ipv4的10000TCP端口。10000改成你自己需要转发的端口
fork TCP4:1.1.1.1:10000`转发到1.1.1.1的10000端口,根据需求修改自行修改ip和端口
nohup后台运行。可以把这个命令写到/etc/rc.local里面开机启动启动。

2、转发UDP

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

很方便吧!把tcp改成udp就是转发udp了。说明如上。也可以直接写到/etc/local里面开机自动启动。


版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!

本文链接:https://www.moerats.com/archives/97/

如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。

Vultr新用户注册送100美元/16个机房按小时计费,支持支付宝,【点击查看】。