LINUX下高效TCP端口转发工具--RINETD

@[TOC]LINUX下高效TCP端口转发工具–RINETD
转自LINUX下高效TCP端口转发工具–RINETD

rinetd 介绍

一个C语言开发的开源TCP端口转发工具,在当前公网IP稀缺的情况下,只能通过NAT来实现内部服务器对外提供服务,该工具除了高效的实现TCP端口转发外,具有对源地址鉴权的安全功能,并且安装方便。
将TCP连接从一个IP地址和端口重定向到另一个IP地址和端口。rinetd是单进程服务,它处理配置文件中指定的地址/端口对的任意数量连接 。rinetd使用非阻塞I / O作为单个进程运行,能够重定向大量连接,同时不会对计算机造成严重影响。
rinetd 不支持重定向FTP,因为FTP需要多个套接字。

程序获取

官方地址:https://boutell.com/rinetd/
直接下载:

# wget https://boutell.com/rinetd/http/rinetd.tar.gz
程序安装
 [root@localhost src]# tar -zxvf rinetd.tar.gz
 [root@localhost src]# cd rinetd
 [root@localhost rinetd]# vim Makefile#修改下Makefile
 CFLAGS=-DLINUX -g

rinetd: rinetd.o match.o
        gcc rinetd.o match.o -o rinetd

install: rinetd
        install -m 700 rinetd /usr/sbin
        install -m 644 rinetd.8 /usr/local/share/man/man8
 [root@localhost rinetd]# make && make install

主程序安装好

[root@YNCOMM4 rinetd]#  rinetd --help
Usage: rinetd [OPTION]
  -c, --conf-file FILE   read configuration from FILE
  -h, --help             display this help
  -v, --version          display version number

Most options are controlled through the
configuration file. See the rinetd(8)
manpage for more information.
配置文件

vi /etc/rinetd.con,添加如下行

0.0.0.0 8888 10.1.1.2 80         #将本机的8888端口转到内网10.1.1.2 的80端口
allow 112.25.222.170             #只允许源地址访问该端口
启动程序
rinetd -c /etc/rinetd.conf
查看端口

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值