一、概述
Rinetd是为在一个Unix以及Linux操作系统中为重定向传输节制协定连接的一个工具。将 TCP 连接从一个 IP 地址以及端口重定向到另外一个。它处理文件中/etc/rinetd.conf指定的地址/端口的任意数量的连接。因为 rinetd 使用非梗阻 I/O 作为单个过程运行,因而它能够重定向大量连接而不会对机器造成严重影响。这使得假装在防火墙内的机器上运行 TCP 服务变得切实可行。rinetd不重定向 FTP,由于 FTP 需要多个套接字。
二、安装部署
2.1 安装进程
1、下载软件文章源自微观生活(93wg.com)微观生活-https://93wg.com/4927.html
目前的最新版本是0.73文章源自微观生活(93wg.com)微观生活-https://93wg.com/4927.html
https://github.com/samhocevar/rinetd/releases
2、编译安装文章源自微观生活(93wg.com)微观生活-https://93wg.com/4927.html
./bootstrap
./configure --prefix=/data/rinetd
make&& make install
3、编辑配置文件文章源自微观生活(93wg.com)微观生活-https://93wg.com/4927.html
0.0.0.0 33060 192.168.209.128 3306vim /data/rinetd/etc/rinetd.conf文章源自微观生活(93wg.com)微观生活-https://93wg.com/4927.html
把发往本机的33060的端口转到 192.168.209.128的3306端口文章源自微观生活(93wg.com)微观生活-https://93wg.com/4927.html
4、启动服务文章源自微观生活(93wg.com)微观生活-https://93wg.com/4927.html
rinetd -c /data/rinetd/etc/rinetd.conf
2.2 配置文件详解
转发规则
0.0.0.0 33060 192.168.209.128 3306[root@192_168_209_128 etc] bindadress bindport connectaddress connectport options...
::1 80 192.168.1.2 80
127.0.0.1 4000 127.0.0.1 3000
127.0.0.1 8000/udp 192.168.1.2 8000/udp [src=192.168.1.2,timeout=1200]文章源自微观生活(93wg.com)微观生活-https://93wg.com/4927.html
转发规则的格式如下:文章源自微观生活(93wg.com)微观生活-https://93wg.com/4927.html
bindadress bindport connectaddress connectport options
例如:文章源自微观生活(93wg.com)微观生活-https://93wg.com/4927.html
0.0.0.0 23 10.1.1.2 23
对于分配给服务器的所有 IP 地址,会将所有连接重定向到端口 23。也能够指定服务名称而不是端口号。在大多数系统上,服务名称在文件 /etc/services 中有定义。
允许以及谢绝规则
配置文件还可以包括允许以及谢绝规则。
rinetd支撑通过规则进行走访的节制,同时支撑通配符匹配。
日志记录
rinetd 能够生成两种格式之一的日志文件:制表符分隔格式以及 Web 服务器样式的&34;。
默许生成的是制表符分隔格式:
logco妹妹on
2.3 创立systemd服务
1、创立systemd服务
[Service] [Install] systemctl daemon-reload && systemctl start rinetdvim /etc/systemd/system/rinetd.service
[Unit]
Description=Rinetd
After=network.target
Type=forking
ExecStart=/data/rinetd/sbin/rinetd -c /data/rinetd/etc/rinetd.conf
WantedBy=multi-user.target
2、设置开机启动
systemctl enable rinetd
以上就是微观生活(93wg.com)关于“简单端口映照、转发、重定向工具-Rinetd”的详细内容,希望对大家有所帮助!
评论