centos7防火牆配置

來源:互聯網
上載者:User

centos7防火牆配置
CentOS7使用的是Linux Kernel 3.10.0的核心版本,新版的Kernel核心已經有了防火牆netfilter,並且firewalld的使用效能更高,穩定性更好。
CentOS7配置防火牆的兩種方法:
一、使用xml設定檔的方式配置;
方法一
cp /usr/lib/firewalld/services/http.xml /etc/firewalld/services/
firewall-cmd --reload
二、使用命令的方式配置;
方法二
##Add
firewall-cmd --permanent --zone=public --add-port=80/tcp
##Remove
firewall-cmd --permanent --zone=public --remove-port=80/tcp
##Reload
firewall-cmd --reload
其中,方法二的配置方式是間接修改/etc/firewalld/zones/public.xml檔案,方案一也需要在public.xml裡面新增,否則http的防火牆規則不會生效,而且兩種配置方式都需要重新載入防火牆。
附:
查看防火牆狀態
systemctl status firewalld.service
啟動防火牆
systemctl start firewalld.service
關閉防火牆
systemctl stop firewalld.service
重新啟動防火牆

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.