1. 程式人生 > >CentOS7使用iptables防火牆開放埠

CentOS7使用iptables防火牆開放埠

背景:在CentOS上面安裝了mysql、svn、tomcat等軟體,發現訪問不了,用telnet命令檢視埠,發現都不通:

telnet IP 埠

CentOS7 預設使用firewalld防火牆,如果想換回iptables防火牆,可關閉firewalld並安裝iptables。

1、關閉firewall:

停止firewall:

systemctl stop firewalld.service

禁止firewall開機啟動

systemctl disable firewalld.service

檢視預設防火牆狀態(關閉後顯示not running,開啟後顯示running)

firewall-cmd --state

2.安裝iptables-services

yum install iptables-services

3.修改防火牆配置檔案

vi /etc/sysconfig/iptables 

新增埠80、8080、3306、3690埠:

這裡寫圖片描述

注意:新增在埠22上面或者下面,不要放在最後,不然不起作用。另外,mac上面insert輸入直接按字母”i”鍵即可。

esc :wq! 退出儲存修改。

4.重啟防火牆使配置生效

systemctl restart iptables.service

設定防火牆開機啟動:
systemctl enable iptables.service

再次嘗試連線,成功了!

5.注意

客戶端連線不了可能原因有多種,比如:

1.伺服器端服務未啟動

2.軟體本身未開通使用者訪問許可權
比如

a.mysql需要針對使用者開放許可權:

mysql授權:

grant all privileges on dbName.* to [email protected]'%' identified by 'dbpassword' with grant option;
flush privileges;

切記:一定要重新整理許可權。

b.svn需要事先建好倉庫並配置使用者、許可權等資訊等。

3.伺服器埠被防火牆封掉。

請先排除1、2可能,綜合處理訪問許可權問題。

相關推薦

linux 下防火牆開放

把firewall 卸掉並裝個iptable的方法 因為預設使用的是firewall作為防火牆,把他停掉裝個iptable systemctl stop firewalld  systemctl mask firewalld yum install -y iptables&nb

centos7防火牆開放等命令

CentOS 7 開放防火牆埠 命令         最近公司新的server要求用CentOS7, 發現以前CentOS 6 系列中的 iptables 相關命令不能用了,查了下,發現Centos 7使用firewalld代替了原來的iptabl

Centos6.5 防火牆開放

0. 說明 centos6.5處於對安全的考慮,嚴格控制網路進去。所以在安裝mysql或者使用tomcat,需要開放埠3306或8080。 通常的解決辦法有兩個。一個是直接關閉防火牆(非常不推薦): service iptables stop 但是這樣相當於把系統完全暴露,會帶來很大的

Centos7.1防火牆開放快速方法

例如安裝Nagios後,要開放5666埠與伺服器連線,命令如下: ? 1 2 3 4 5 6 7 [[email protected] ~]# firewall-cmd --add-port=5666/tcp 即時開啟,這裡也可以是一個埠範圍,如100

centos7防火牆開放,附開放samba特定例項

前言 搭建samba的時候,如果是在內網\測試環境中,可以直接關閉防火牆,但是如果是在外網情況下,需要對防火牆開放某些埠。開放的具體步驟,下面我們來看。 操作步驟 1.新增埠 firewall-cmd --zone=public --add-port=80/tcp

關於Centos7 firewalld防火牆開放後仍不能訪問ftp和nginx的問題解決

我在阿里輕量應用伺服器搭建ftp伺服器這篇部落格中把防火牆換為iptables,因為當時無論我怎麼設定firewalld,就是無法訪問ftp伺服器,今天在翻看其他部落格的時候,突然發現firewalld

CentOS7使用iptables防火牆開放

背景:在CentOS上面安裝了mysql、svn、tomcat等軟體,發現訪問不了,用telnet命令檢視埠,發現都不通: telnet IP 埠 CentOS7 預設使用firewalld防火牆,如果想換回iptables防火牆,可關閉fire

CentOS關閉防火牆啟用iptables、開放

CentOS:關閉防火牆,啟用iptables 參考文件: https://blog.csdn.net/bitterliquor/article/details/70256141 a、關閉firewall: //停止firewall systemctl stop firewalld.se

CentOS7.3 下開放防火牆

CentOS 7.3預設使用的是firewall作為防火牆,這裡改為iptables防火牆。 1:關閉firewall: systemctl stop firewalld.service systemctl disable firewalld.service systemctl mask firewa

CentOS 6、CentOS7 防火牆開放指定

當我們在CentOS伺服器中裝了一些開發環境(如 tomcat、mysql、nginx 等...)時,希望能從外界訪問,就需要配置防火牆對指定埠開放。 CentOS 6.51.開放指定埠/sbin/iptables -I INPUT -p tcp --dport 埠號 -j ACCEPT &nbs

CentOS 7開放和關閉防火牆

開放埠 永久的開放需要的埠 sudo firewall-cmd --zone=public --add-port=3000/tcp --permanent sudo firewall-cmd --reload 之後檢查新的防火牆規則 firewall-cmd --list-all

Centos7防火牆的關閉與開啟,開放

1、首先檢視防火牆的狀態:systemctl status firewalld active(代表防火牆是開啟狀態) 2、關閉防火牆:systemctl stop firewalld 可以看到防火牆已經被關閉了。 3、開啟防火牆:systemctl start

Centos7防火牆用法,centos7開放、關閉

Centos7不再使用iptables而是使用firewall 所以防火牆相關的命令也改了 檢視開放的埠 firewall-cmd --list-ports 開放80埠 firewall-cmd --zone=public --add-port=80/tcp --p

小白學習Red Hat Linux7.0系列七之Redis 5.0.0下載、安裝、防火牆6379開放

下載地址 安裝步驟: 2 解壓到/usr/local目錄下 “tar -zxvf redis-5.0.0.tar.gz -C /usr/local”。 3 進入到/usr/local/redi

CentOS7查詢端口占用,清除端口占用的程式,開放,開啟防火牆

1、根據埠號得到其佔用的程序的詳細資訊 netstat -tlnp|grep 80 tcp        0      0 192.168.33.10:80            0.0.0.0:*                   LISTEN      5014/httpd tcp        0 

CentOS7 firewall 開放和關閉防火牆

CentOS7開放埠,過載防火牆配置 sudo firewall-cmd --zone=public --add-port=6379/tcp --permanent sudo firewall-cmd --reload 檢查防火牆規則命令 firewall-cmd --list-all

Centos7 防火牆相關操作以及 新增開放

1、firewalld的基本使用啟動:        systemctl      start firewalld檢視狀態: systemctl      status firewalld 停止:        systemctl      disable firewalld

Linux學習筆記CentOS 6.5(十)---Mysql防火牆開放3306

防火牆開放3306埠 1、開啟防火牆配置檔案 vi  /etc/sysconfig/iptables   2、增加下面一行 -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT  

centos 重啟防火牆開放80

轉自:https://www.aliyun.com/jiaocheng/140985.html centos6: 1.開啟80埠: /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT 2.儲存設定: /etc/rc.d/init.d/iptab

Windows Server 2008 防火牆開放 Oracle 的1521

在防火牆的入站規則中,新建埠規則。過程如下例圖片所示: 同理可以開放 EM 用的 1158 埠。 執行完後用下面命令測試 telnet SERVER_IP 1521 參考資料 [1] Windows Server 2008防火牆如何配置(5). http://w