日常工作有端口转发的需求,除了使用 iptables、nginx 之外,还可以使用 rinted
工具进行处理。
yum -y install gcc gcc-c++ make automake
git https://gitee.com/mirrors/rinetd.git
cd rinetd
./bootstrap
./configure
make && make install
# 编译安装后要把文件拷贝的指定目录,否则开不起来
cp rinetd /usr/bin/
cp rinetd.conf /etc/
apt-get install rinetd
转发的时候会在本地起一个监听端口,确认服务器没有使用到该端口。
以下内容分别为:
本机监听IP, 本机监听端口, 转发目标地址, 转发目标端口, 额外参数信息
# 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]
如果发现进程存在,端口不存在,基本上就是配置文件配置异常
/usr/bin/rinetd -c /etc/rinetd.conf
ps -aux|grep -v grep|grep rinetd.conf
[root@rinetd]# netstat -nltp|grep rinetd
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 4720/rinetd
这是关闭软件服务、如果有多个转发,需要进行删减的话,需要重新进行开启
pkill rinetd
/var/log/rinetd.log
[root@rinetd]# man rinetd
END
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。