firewall 開啓查看關閉端口

ps:firewall是centos7系統自帶的防火牆 ,centos6使用的是iptables(配置文件路徑:/etc/sysconfig/iptables)

查看端口

firewall-cmd --zone=public --query-port=80/tcp

 開啓端口

# --permanent 表示永久有效,沒有這個參數重啓後會失效
firewall-cmd --zone=public --add-port=80/tcp --permanent

刪除端口

# --permanent 表示永久有效,沒有這個參數重啓後會失效
firewall-cmd --zone=public --remove-port=80/tcp --permanent

使firewall修改後生效 

firewall-cmd --reload

firewall在centos7中的配置文件(/etc/firewalld/zones/public.xml)

vi /etc/firewalld/zones/public.xml

firewalld服務

# 查看防火牆服務狀態
systemctl status firewalld

# 啓用防火牆服務
systemctl start firewalld

# 關閉防火牆服務
systemctl stop firewalld

# 重啓防火牆服務
systemctl restart firewalld

# 開機啓動防火牆服務
systemctl enable firewalld

# 關閉開機啓動防火牆服務
systemctl disable firewalld

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章