?寫在前面:centos 6 與 centos 7 開放埠的配置不一樣 。
檢視防火牆狀態
開啟防火牆
service iptables start
關閉防火牆
service iptables stop
重啟防火牆
service iptables restart
防火牆開放某個埠(1)檢視防火牆當前設定,具體開發的埠號資訊
/etc/init.d/iptables status
(2)配置防火牆策略
vim /etc/sysconfig/iptables
例如我要開22,80埠:
# firewall configuration written by system-config-firewall
# manual customization of this file is not recommended.
*filter
:input accept [0:0]
:forward accept [0:0]
:output accept [0:0]
-a input -m state –state established,related -j accept
-a input -p icmp -j accept
-a input -i lo -j accept
-a input -m state –state new -m tcp -p tcp –dport 22 -j accept
-a input -m state –state new -m tcp -p tcp –dport 80 -j accept
-a input -j reject –reject-with icmp-host-prohibited
-a forward -j reject –reject-with icmp-host-prohibited
commit
儲存退出!!!
重啟防火牆:
service iptables restart
檢視開放的埠號
firewall-cmd --zone=public --list-ports
關閉防火牆
systemctl stop firewalld.service
檢視防火牆狀態
firewall-cmd --state
設定開放的埠號
firewall-cmd --zone=public --add-port=5672/tcp --permanent # 開放5672埠
firewall-cmd --zone=public --remove-port=5672/tcp --permanent #關閉5672埠
firewall-cmd --reload # 配置立即生效
重啟防火牆
firewall-cmd --reload
開啟防火牆
systemctl start firewalld.service
設定CentOS防火牆開放埠
在我們使用centos系統的時候,centos防火牆有時是需要改變設定的。centos防火牆預設是開啟的,設定centos防火牆開放埠方法如下 開啟iptables的配置檔案 vi etc sysconfig iptables 修改centos防火牆時注意 一定要給自己留好後路,留vnc乙個管理埠和...
設定CentOS防火牆開放埠
在我們使用centos系統的時候,centos防火牆有時是需要改變設定的。centos防火牆預設是開啟的,設定centos防火牆開放埠方法如下 開啟iptables的配置檔案 vi etc sysconfig iptables 修改centos防火牆時注意 一定要給自己留好後路,留vnc乙個管理埠和...
設定CentOS防火牆開放埠
設定centos防火牆開放埠 在我們使用centos系統的時候,centos防火牆有時是需要改變設定的。centos防火牆預設是開啟的,設定centos防火牆開放埠方法如下 開啟iptables的配置檔案 vi etc sysconfig iptables 修改centos防火牆時注意 一定要給自己...