詳細講解Linux系統Iptables規則執行順序

來源:互聯網
上載者:User

  預備知識(轉): iptable有三種隊列(表)規則,mangle queue, filter queue, nat queue。

  1。The first is the mangle table which is responsible for the alteration of quality of service bits in the TCP header.

  2。The second table is the filter queue which is responsible for packet filtering.

  * Forward chain: Filters packets to servers protected by the firewall.

  * Input chain: Filters packets destined for the firewall.

  * Output chain: Filters packets originating from the firewall.

  3。The third table is the nat queue which is responsible for network address translation. It has two built-in chains; these are:

  * Pre-routing chain: NATs packets when the destination address of the packet needs to be changed.

  * Post-routing chain: NATs packets when the source address of the packet needs to be changed

  個人總結:

  iptables執行規則時,是從從規則表中從上至下順序執行的,如果沒遇到匹配的規則,就一條一條往下執行,如果遇到匹配的規則後,那麼就執行本規則,執行後根據本規則的動作(accept, reject, log等),決定下一步執行的情況,後續執行一般有三種情況。

  1。一種是繼續執行當前規則隊列內的下一條規則。比如執行過Filter隊列內的LOG後,還會執行Filter隊列內的下一條規則。

  2。一種是中止當前規則隊列的執行,轉到下一條規則隊列。比如從執行過accept後就中斷Filter隊列內其它規則,跳到nat隊列規則去執行

  3。一種是中止所有規則隊列的執行。



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.