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

推荐订阅源

S
Secure Thoughts
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Securelist
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
SegmentFault 最新的问题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
K
Kaspersky official blog
WordPress大学
WordPress大学
I
Intezer
L
Lohrmann on Cybersecurity
V
Vulnerabilities – Threatpost
C
Check Point Blog
A
About on SuperTechFans
AWS News Blog
AWS News Blog
Latest news
Latest news
宝玉的分享
宝玉的分享
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
Cyber Attacks, Cyber Crime and Cyber Security
SecWiki News
SecWiki News
Recorded Future
Recorded Future
Last Week in AI
Last Week in AI
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Register - Security
The Register - Security
A
Arctic Wolf
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
V
V2EX
Scott Helme
Scott Helme
I
InfoQ
Project Zero
Project Zero
Security Archives - TechRepublic
Security Archives - TechRepublic
Recent Announcements
Recent Announcements
Spread Privacy
Spread Privacy
Attack and Defense Labs
Attack and Defense Labs
大猫的无限游戏
大猫的无限游戏
Webroot Blog
Webroot Blog
N
News and Events Feed by Topic
博客园 - 司徒正美
Microsoft Security Blog
Microsoft Security Blog
The GitHub Blog
The GitHub Blog
NISL@THU
NISL@THU
L
LangChain Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

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个机房按小时计费,支持支付宝,【点击查看】。