大漠知秋的加油站

  • 首页
大漠知秋的加油站
你就当我的烂笔头吧
  1. 首页
  2. Linux
  3. 正文

轻量级 TCP 端口转发工具:rinetd

2021年2月5日 603点热度 0人点赞 0条评论

  TCP 端口转发的工具太多了,如:SSH、iptables、firewall、ncat、socat、portmap 等,为什么要说 rinetd,因为它使用很简单,对于简单的小服务来说非常的友好。

  • 安装
$ wget https://pencil.file.lynchj.com/rpm/rinetd-0.62-9.el7.nux.x86_64.rpm
--2021-02-05 15:02:21--  https://pencil.file.lynchj.com/rpm/rinetd-0.62-9.el7.nux.x86_64.rpm
正在解析主机 pencil.file.lynchj.com (pencil.file.lynchj.com)... 222.222.88.88, 222.222.88.14, 222.222.88.16, ...
正在连接 pencil.file.lynchj.com (pencil.file.lynchj.com)|222.222.88.88|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:25984 (25K) [application/x-rpm]
正在保存至: “rinetd-0.62-9.el7.nux.x86_64.rpm”

rinetd-0.62-9.el7.nux.x86_64.rpm                           100%[========================================================================================================================================>]  25.38K  --.-KB/s  用时 0.01s

2021-02-05 15:02:21 (2.11 MB/s) - 已保存 “rinetd-0.62-9.el7.nux.x86_64.rpm” [25984/25984])

$ rpm -ivh rinetd-0.62-9.el7.nux.x86_64.rpm
警告:rinetd-0.62-9.el7.nux.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID 85c6cd8a: NOKEY
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...
   1:rinetd-0.62-9.el7.nux            ################################# [100%]

$ systemctl status rinetd
● rinetd.service - SYSV: rinetd is a TCP redirection server
   Loaded: loaded (/etc/rc.d/init.d/rinetd; generated)
   Active: inactive (dead)
     Docs: man:systemd-sysv-generator(8)

  后续可以通过 systemctl 命令来管理。下面配置转发规则:

$ vim /etc/rinetd.conf
# 源地址(即当前服务器IP),源服务端口,目标地址,目标服务端口
10.8.0.13 10202 192.168.16.15 10202
10.8.0.13 15672 192.168.16.15 15672
10.8.0.13 3306 192.168.16.15 3306

  保存重启生效,就是这么简单。

标签: Linux Rinetd
最后更新:2021年2月5日

大漠知秋

唯黄昏而思烛明,唯覆雪始念日暖,唯放手方知情真,今困苦而怀峥嵘,今飘零而涌乡愁,今孑然而徒唏嘘,唏嘘成愁。

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2023 大漠知秋的加油站. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

豫ICP备16029200号-2