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

相關文章
相關標籤/搜索