firewalld學習-zone

原文地址:http://www.excelib.com/article/290/showhtml

firewalld默認提供了九個zone配置文件:ssh

block.xml、dmz.xml、drop.xml、external.xml、home.xml、internal.xml、public.xml、trusted.xml、work.xml,excel

他們都保存在「/usr/lib/firewalld/zones/」目錄下。這些zone之間是什麼關係?他們分別適用用哪些場景呢?xml

防火牆就至關於一個門衛,門衛對具體某個來訪的人判斷是否應該放行是依靠規則來判斷的,htm

zone其實就是一套規則集,或者說是一套判斷的方案。blog

上面的九個zone其實就是九種方案,並且起決定做用的實際上是每一個xml文件的內容,文件結構以下:ip

public.xmlutf-8

<?xml version="1.0" encoding="utf-8"?>
<zone>
  <short>Public</short>
  <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. 
   Only selected incoming connections are accepted.</description> <service name="ssh"/> <service name="dhcpv6-client"/> </zone>

trusted.xmlget

<?xml version="1.0" encoding="utf-8"?>
<zone target="ACCEPT">
  <short>Trusted</short>
  <description>All network connections are accepted.</description>
</zone>

trusted這個zone會信任全部的數據包,也就是說全部數據包都會放行,io

public這個zone只會放行其中所配置的服務,其餘的一概不予放行,

要特別注意trusted.xml中zone的target,就是由於他設置爲了ACCEPT,因此纔會放行全部的數據包,而public.xml中的zone沒有target屬性,這樣就會默認拒絕經過,因此public這個zone(這種方案)只有其中配置過的服務才能夠經過。

相關文章
相關標籤/搜索