rinetd小工具
一、介绍
tcp端口转发工具,针对ip:port的 连接进行转发。重点开源,且配置简单。不支持ftp,因为ftp要使用多个端口。
1、转发规则
[root@master tmp]# cat a.conf #访问本机80端口的服务都会被转发到 本机的22端口
192.168.45.128 80 127.0.0.1 22
0.0.0.0 3306 127.0.0.1 3306
[root@master tmp]# rinetd -c a.conf
2、allow/deny规则
[root@master tmp]# cat a.conf #规则为逐条匹配,没有拒绝则放行
deny 192.168.45.*
192.168.45.128 80 127.0.0.1 22
3、日志
[root@master tmp]# cat a.conf
192.168.45.128 80 127.0.0.1 22
logfile ./rinetd.log
[root@master tmp]# cat rinetd.log
22/Nov/2020:11:45:43 192.168.45.129 192.168.45.128 80 127.0.0.1 22 0 0denied
日志格式:
Date and time
Client address
Listening host
Listening port
Forwarded-to host
Forwarded-to port
Bytes received from client
Bytes sent to client
Result message
二、安装
[root@master rinetd]# wget //github.com/boutell/rinetd/archive/master.zip
[root@master rinetd]# unzip master.zip
[root@master rinetd]# cd rinetd-master/
[root@master rinetd-master]# make
[root@master rinetd-master]# mkdir /usr/man/man8 -p
[root@master rinetd-master]# make install
install -m 700 rinetd /usr/sbin #命令安装位置
install -m 644 rinetd.8 /usr/man/man8 #帮助文档安装位置
[root@master rinetd-master]#
[root@master rinetd-master]# man /usr/man/man8/rinetd.8 #查看帮助信息