A-A+

linux端口映射转发工具rinetd

2015年09月16日 Linux, VPS 暂无评论 阅读 浏览:999 次

方法一
iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -t nat -A PREROUTING -d 本机IP -p tcp --dport 3389 -j DNAT --to-destination 目的IP:3389
service iptables save
service iptables restart

方法二
centos6编译安装
cd ~
wget http://www.boutell.com/rinetd/http/rinetd.tar.gz
tar zxvf rinetd.tar.gz
cd rinetd

sed -i 's/65536/65535/g' rinetd.c
mkdir /usr/man/
make && make install

make
make install
复制代码

如果提示错误安装gcc,yum -y install gcc
nano /etc/rinetd.conf
内容如下
allow *.*.*.*
0.0.0.0 9999 195.154.xxx.xxx 3389
复制代码

ctrl+x Y保存
0.0.0.0本机地址
9999 本机将打开的端口
195.154.xxx.xxx 转发的IP
3389 转发的端口
vi /etc/rinetd.conf
0.0.0.0 8080 172.19.94.3 8080
0.0.0.0 2222 192.168.0.103 3389
1.2.3.4 80 192.168.0.10 80
[Source Address] [Source Port] [Destination Address] [Destination Port]

pkill rinetd

打开转发&启动程序
echo 1 > /proc/sys/net/ipv4/ip_forward
rinetd -c /etc/rinetd.conf
复制代码
后续工作:
将9999端口设置通过防火墙
将 echo 1 > /proc/sys/net/ipv4/ip_forward写入 /etc/rc.local 实现开机启动
将 rinetd -c /etc/rinetd.conf 写入 /etc/rc.local 实现开机启动

连接新的3389
metsc
vpsIP:9999

这些在我的美国vps centos6上测试通过

如果你的vps是windows,用以下命令转发

netsh interface ipv6 install
netsh interface portproxy add v4tov4 listenaddress=本机IP listenport=9999 connectaddress=远程IP connectport=3389
复制代码

同样将9999通过防火墙..

http://iblog.daobidao.com/linux-simple-port-mapping-forwarding-redirection-tool-rinetd.DaoBiDao
http://blog.csdn.net/paulluo0739/article/details/7023711
http://blog.csdn.net/wang7dao/article/details/8498530

标签:

给我留言

Copyright © 龙网博客 保留所有权利.   Theme  Ality

用户登录