centos 7 端口转发

1. 安装rinetdc++

# 若是没有安装gcc 先安装gcc,这里就所有一并安装了
yum -y install gcc+ gcc-c++
yum -y install make
#安装,若是地址失效,去官网查看下载地址便可
wget https://boutell.com/rinetd/http/rinetd.tar.gz
tar -zxf rinetd.tar.gz 
mkdir -p /usr/man/man8
make && make install
# 配置
vim /etc/rinetd.conf
# 一行即为一条转发规则 格式如:[source_address] [source_port] [destination_address] [destination_port]
#[本机IP(若非多网卡直接设为0.0.0.0)] [转发端口] [服务IP] [服务端口]
#我本次转发的端口是hbase的即为
192.168.9.87 16000 172.17.0.2 16000
192.168.9.87 16010 172.17.0.2 16010
#启动
rinetd -c /etc/rinetd.conf
#中止 直接kill 便可
#查看转发
netstat -tanulp|grep rinetd

2.使用iptables 转发vim

这种方式没有试,由于我本身机器,把防火墙关闭了,因此没有使用这种方式。spa

相关文章
相关标签/搜索