简介

TCP端口转发工具,需注意不支持UDP,配置文件路径/etc/rinetd.conf

安装

rpm包

下载rpm

rpm -ivh rinetd-0.62-9.el7.nux.x86_64.rpm

YUM安装(未验证,可能失效)

1
2
3
4
5
6
7
8
$ sudo vim /etc/yum.repos.d/nux-misc.repo

[nux-misc]
name=Nux Misc
baseurl=http://li.nux.ro/download/nux/misc/el6/x86_64/
enabled=0
gpgcheck=1
gpgkey=http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro

sudo yum --enablerepo=nux-misc install rinetd

配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# example configuration file for rinetd
#
#

# to forward connections to port 80 on 10.10.10.2 to port 80 on 192.168.0.2
# 6 10.10.10.2 80 192.168.0.2 80

# to forward connections to port 80 on all addresses to port 80 on 192.168.0.2
# 8 80 192.168.0.2 80

# access controls can be set with allow and deny rules
# allow and deny before the first forwarding rule are global
# 10 allow and deny after a specific rule apply to it only

# this rule allows hosts from 172.16.32.0/24 netblock
# 12 allow 172.16.32.*

# this rule denies the host 192.168.32.12
# 14 deny 192.168.32.12

# rinetd supports logging - to enable, uncomment the following
# 16 logfile /data/rinetd.log

# by default, logs are in a tab-delimited format. Web common-log format
# 18 is available by uncommenting the following
# logcommon
# 20 将本地索引ip445端口转发到10.109.50.206的445端口
0.0.0.0 445 10.109.50.206 445
#0.0.0.0 139 10.109.50.206 139

运行

1
2
systemctl start  rinetd
systemctl status rinetd

但是不支持systemctl enable rinetd,自启动需要用chconfig命令
/sbin/chkconfig rinetd on