rinetd tcp/udp 端口重定向服务
rinetd 支持tcp 以及udp 协议的端口重定向,功能还是比较有用的,比如进行一些流量转发,配置上也是比较方便的,同时支持
一些简单的访问控制处理
构建
git clone https://github.com/samhocevar/rinetd.git
cd rinetd
./bootstrap
./confogure
make
rpm 包
- 命令
fpm -s dir -t rpm -n rinetd --rpm-os linux \
./rinetd=/usr/local/bin/ \
./rinetd.service=/usr/lib/systemd/system/rinetd.service \
./rinetd.conf=/etc/rinetd/rinetd.conf
- 配置
rinetd.service
[Unit]
Description=rinetd
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/bin/rinetd -c /etc/rinetd/rinetd.conf
[Install]
WantedBy=multi-user.target
配置 rinetd.conf
#
# this is the configuration file for rinetd, the internet redirection server
#
# you may specify global allow and deny rules here
# only ip addresses are matched, hostnames cannot be specified here
# the wildcards you may use are * and ?
#
# allow 192.168.2.*
# deny 192.168.2.1?
# allow fe80:*
# deny 2001:618:*:e43f
#
# forwarding rules come here
#
# you may specify allow and deny rules after a specific forwarding rule
# to apply to only that forwarding rule
#
# bindadress bindport connectaddress connectport options...
# 0.0.0.0 80 192.168.1.2 80
# ::1 80 192.168.1.2 80
# 0.0.0.0 80 fe80::1 80
# 127.0.0.1 4000 127.0.0.1 3000
# 127.0.0.1 4000/udp 127.0.0.1 22 [timeout=1200]
# 127.0.0.1 8000/udp 192.168.1.2 8000/udp [src=192.168.1.2,timeout=1200]
# logging information
logfile /var/log/rinetd.log
# uncomment the following line if you want web-server style logfile format
# logcommon
直接基于fpm 构建
说明
rpm 包我已经构建好了,放github 上了,可以支持使用
参考资料
https://github.com/samhocevar/rinetd
https://github.com/rongfengliang/rinetd-rpm