1. 程式人生 > >阿里雲Centos frp透傳配置

阿里雲Centos frp透傳配置

  • CentOS系統中使用命令開啟埠

Centos7 開啟 , 關閉埠
CentOS7 預設沒有使用iptables , 所以不能通過編輯 iptables 的配置檔案來開啟埠 , CentOS7 採用了 firewalld 防火牆
如要查詢是否開啟3306埠則 :
# firewall-cmd –query-port=3306/tcp
開啟埠 :
# firewall-cmd –zone=public –add-port=3306/tcp –permanent
命令含義 : –zone #作用域 , –add-port=80/tcp #新增埠 , 格式為 : 埠/通訊協議 , –permanent #永久生效 , 沒有此引數重啟後失效
重啟防火牆 :
# firewall-cmd –reload
關閉埠 :
# firewall-cmd –zone=public –remove-port=3306/tcp –permanent

Centos6.X 開啟 , 關閉埠
使用 iptables 開放如下埠 :
# /sbin/iptables -I INPUT -p tcp –dport 3306 -j ACCEPT
儲存 :
# /etc/rc.d/init.d/iptables save
重啟服務 :
# /etc/rc.d/init.d/iptables restart
檢視埠是否開放 :
# /etc/init.d/iptables status
關閉埠 :
# /sbin/iptables -I INPUT -p tcp –dport 3306 -j DROP
- 配置frp
詳見frp文件
- 測試