zoukankan      html  css  js  c++  java
  • iptables(1):iptables 基本概念

    1. 什么是iptables?

     iptables is the userspace command line program used to configure the Linux 2.4.x and later packet filtering ruleset. It is targeted towards system administrators.

    Since Network Address Translation is also configured from the packet filter ruleset, iptables is used for this, too.

    The iptables package also includes ip6tablesip6tables is used for configuring the IPv6 packet filter.

    iptables 是用户空间的命令行程序,作用于内核2.4.x以上版本。像NAT配置也可以通过iptables。

    2. iptables 进程流

    报文的流向:

    1)到本机某进程的报文:PERROUTING-->INPUT

    2)由本机转发的报文: PREROUTING-->FORWARD-->POSTROUTING

    3)由本机的某进程发出报文:OUTPUT-->POSTROUTING

    四表:raw表、mangle表、nat表、filter表 。默认启用filter表

       注:通过查看文件/proc/net/ip_tables_names,可以知道当前的版本支持哪些表 

      filter表: 负责过滤功能,防火墙;内核模块:iptable_filter

      nat 表:  network address translation, 网络地址转换功能;内核模块:iptable_nat

      mangle 表: 拆解报文,做出修改,并重新封装的功能;iptable_mangle

      raw 表: 关闭nat表上启用的连接追踪机制;iptable_raw

    五链:PERROUTING、INPUT、FORWARD、POSTROUTING、OUTPUT链

     3. 表链关系:

     表中存放的是规则,规则可以作用于链,一个链可以有多张表。一个表也可以适用不同的链。

    链的规则存放于哪些表中(从链到表的对应关系):

    PREROUTING 的规则可以存在于: raw表,mangle表,nat表。

    INPUT 的规则可以存在于: mangle表,filter表,nat表。

    FORWARD 的规则可以存在于: raw表,mangle表,nat表,filter表。

    POSTROUTING 的规则可以存在于: mangle表,nat表。

    表中的规则可以被哪些链使用(从表到链的对应关系):

    raw 表中的规则可以被哪些链使用: PREROUTING,OUTPUT

    mangle 表中的规则可以被哪些链使用: PREROUTING, OUTPUT,POSTROUTING, INPUT

    filter 表中的规则可以被哪些链使用: INPUT, FORARD, OUTPUT

  • 相关阅读:
    poj 1837 Balance
    poj 3009 Curling 2.0
    vagrant up 无法加载映像目录
    liunx 查看php 安装的扩展
    树莓派 添加超级管理员身份
    Sublime text追踪函数插件:ctags[转载]
    手动安装m4, autoconf, automake, libtool
    nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"
    如何将编码转为自己想要的编码 -- gbk utf-8
    laravel 增删修改
  • 原文地址:https://www.cnblogs.com/hayden1106/p/8288172.html
Copyright © 2011-2022 走看看