Chinaunix

标题: 求iptables各链区别的详细资料。。。。 [打印本页]

作者: 驱魔圣手    时间: 2014-08-25 17:00
标题: 求iptables各链区别的详细资料。。。。
各位大神。。。最近在看iptables,但是对3个表中的重合链的区别分的不是很清楚,比如说filter中的output链和nat中的output链的区别。。。能给出点例子说明一下吗?麻烦懂的讲解一下哈。。。。
作者: q1208c    时间: 2014-08-25 17:26
man iptables
  1. TABLES
  2.        There are currently three independent tables (which tables are present at any time depends on the kernel configuration options and which modules are present).

  3.        -t, --table table
  4.               This option specifies the packet matching table which the command should operate on.  If the kernel is configured with automatic module loading, an attempt will be made  to
  5.               load the appropriate module for that table if it is not already there.

  6.               The tables are as follows:

  7.               filter:
  8.                   This  is the default table (if no -t option is passed). It contains the built-in chains INPUT (for packets destined to local sockets), FORWARD (for packets being routed
  9.                   through the box), and OUTPUT (for locally-generated packets).

  10.               nat:
  11.                   This table is consulted when a packet that creates a new connection is encountered.  It consists of three built-ins: PREROUTING (for altering packets as  soon  as  they
  12.                   come in), OUTPUT (for altering locally-generated packets before routing), and POSTROUTING (for altering packets as they are about to go out).

  13.               mangle:
  14.                   This  table  is  used  for specialized packet alteration.  Until kernel 2.4.17 it had two built-in chains: PREROUTING (for altering incoming packets before routing) and
  15.                   OUTPUT (for altering locally-generated packets before routing).  Since kernel 2.4.18, three other built-in chains are also supported: INPUT (for packets coming into the
  16.                   box itself), FORWARD (for altering packets being routed through the box), and POSTROUTING (for altering packets as they are about to go out).

  17.               raw:
  18.                   This  table  is used mainly for configuring exemptions from connection tracking in combination with the NOTRACK target.  It registers at the netfilter hooks with higher
  19.                   priority and is thus called before ip_conntrack, or any other IP tables.  It provides the following built-in chains: PREROUTING (for packets arriving  via  any  network
  20.                   interface) OUTPUT (for packets generated by local processes)
复制代码

作者: 驱魔圣手    时间: 2014-08-26 11:05
老大,能给点详细的例子不。。。回复 2# q1208c


   
作者: q1208c    时间: 2014-08-26 11:09
本帖最后由 q1208c 于 2014-08-26 11:09 编辑

回复 3# 驱魔圣手

上面的 man 中 已经说明的很明白了.

我不是很常用 iptables. 也没有很多现成的例子.

下面的图出自 http://en.wikipedia.org/wiki/Netfilter, 可以参考一下.



   




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2