centos 防火牆設定

2021-08-14 21:04:55 字數 1087 閱讀 7258

1、關閉firewall:

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall開機啟動

firewall-cmd --state #檢視預設防火牆狀態(關閉後顯示notrunning,開啟後顯示running)

2、iptables防火牆(這裡iptables已經安裝,下面進行配置)

vi/etc/sysconfig/iptables #編輯防火牆配置檔案

# sampleconfiguration for iptables service

# you can edit thismanually or use system-config-firewall

# please do not askus to add additional ports/services to this default configuration

*filter

:input accept [0:0]

:forward accept[0:0]

:output accept[0:0]

-a input -m state--state related,established -j accept

-a input -p icmp -jaccept

-a input -i lo -jaccept

-a input -p tcp -mstate --state new -m tcp --dport 22 -j accept

-a input -p tcp -m state --state new -m tcp --dport 80 -jaccept

-a input -p tcp -m state --state new -m tcp --dport 8080-j accept

-a input -j reject--reject-with icmp-host-prohibited

-a forward -jreject --reject-with icmp-host-prohibited

commit

:wq! #儲存退出

CentOS防火牆設定

開啟防火牆 service iptables start 關閉防火牆 service iptables sop 重啟防火牆 service iptables restart 永久關閉防火牆 chkconfig iptables off 永久關閉後開啟防火牆 chkconfig iptables on...

筆記 CentOS設定防火牆

一 jeuxs在啟動後可能會出現啟動jexus成功,但是訪問失敗。但是在伺服器內部訪問沒問題。列出所有埠 netstat ntlp檢視已經開放的埠 firewall cmd list ports開啟埠 firewall cmd zone public add port 80 tcp permanen...

防火牆設定

目錄導航 一 iptables防火牆 二 firewall防火牆 centos7 的防火牆配置跟以前版本有很大區別,centos7這個版本的防火牆預設使用的是firewall,與之前的版本centos 6.x使用iptables不一樣 目錄導航 一 iptables防火牆 1 基本操作 servic...