中文注册 登录
異次元論壇 返回首页

凤飘飘的个人空间 http://yiciyuan.org/?1 [收藏] [复制] [分享] [RSS]

日志

centos 下端口映射工具RINETD

已有 3224 次阅读2012-4-30 15:15 | 系统, 工具

系统环境:centos 5.X 系统需要gcc组件

yum -y install gcc  安装完毕以后

下载wget http://www.boutell.com/rinetd/http/rinetd.tar.gz

 tar zxvf
make
vi rinetd.c
输入/bindPort >= 65536 查询
输入/connectPort >= 65536查询
将查询到的65536修改为65535  不然在make的时候会提示超出系统最大定义端口

make install

rinetd.c:176: 警告:与内建函数 ‘log’ 类型冲突
rinetd.c: In function ‘log’:
rinetd.c:1395: 警告:‘log’ 的地址总是等价为 ‘true’
gcc rinetd.o match.o -o rinetd
install -m 700 rinetd /usr/sbin
install -m 644 rinetd.8 /usr/man/man8
install: 无法创建一般文件“/usr/man/man8”: 没有那个文件或目录
make: *** [install] 错误 1

在/usr下创建man/这个目录



然后重新make install

make install以后会提示安装以后目录

/usr/sbin

cd /usr/sbin 进入该目录,然后运行,

./rinetd

然后会提示找不到/etc/rinetd.conf

vi /etc/rinetd.conf

源ip 端口  目的ip 端口

然后返回目录cd /usr/sbin

./rinetd -c /etc/rinetd

ok了!

 

第二步
———————————配置 rinetd —————————————————————————
vi /etc/rinetd.conf

"——VI 内容——"

0.0.0.0 88 1.1.1.1 22

本地IP  88 目标端口 22
"——VI 内容——"
————————————————————————————————————————

 

最后 一步 启动 rinetd 服务。
————————————————————————————————————————————————
rinetd -c /etc/rinetd.conf
这个时候 rinetd 只会有错报错,成功 是 没有 提示的。
所以假如没有出现问题那就是启动并转发成功了的。
假如你不放心你可以 再次 rinetd -c /etc/rinetd.conf
如果 出现 rinetd: couldn't bind to address 0.0.0.0 port 2228
那说明已经转发成功了。
最后的 PS:----------------------------------------------------------------------------------------
1.rinetd.conf中绑定的本机端口必须没有被其它程序占用
2.运行rinetd的系统防火墙应该打开绑定的本机端口 
3.把 “rinetd -c /etc/rinetd.conf” 加到/etc/rc.local里面就可以开机自动运行

pkill rinetd  ##关闭进程
rinetd -c /etc/rinetd.conf  ##启动转发

防火墙 
#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT 
#/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT 

然后保存: 
#/etc/rc.d/init.d/iptables save 

再查看是否已经有了: 
[root@vcentos ~]# /etc/init.d/iptables status


路过

鸡蛋

鲜花

握手

雷人

全部作者的其他最新日志

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 中文注册

GMT+8, 2024-4-20 07:07 , Processed in 1.106559 second(s), 15 queries .

© 2010-2015 異次元論壇 Powered by Discuz! 手机版|Archiver|

異次元論壇内容均由道友发表,不代表異次元立场,禁止在发表与国家法律相抵触言论!如侵犯了您的权利请发帖投诉。
返回顶部