zoukankan      html  css  js  c++  java
  • 防火墙(一)主机型防火墙

    默认防火墙规则

    拒绝与禁止一个数据包

    IP防火墙的数据包传输

      在IP防火墙中,有三个内建的过滤规则链被使用。所有到达接口的数据包都按照输入规则链被过滤。如果数据包被接受,它会被送到路由模块。路由功能决定数据包是被送到本地还是转发到另一个出站接口。

      如果被转发,数据包会由转发规则链进行第二次过滤。如果数据包被接受,它会被送到输出规则链。

      本地产生的出站数据包和将被转发的数据包都要经过输出规则链。如果数据包被接受,它会被送出接口。

      回环路径包括两个规则链,每一个回环数据包在出回环接口之前需要通过输出链规则,在那里它会被送到回环的输入接口,然后输入规则链被应用。

      iptables:

      Iptables<option><chain><matching criteria><target>

      后面跟一个或多个选项、一个规则链、一个匹配标准级和一个目标或部署。

      filter表

        iptables -L -n --line

        

        #!/bin/bash
        2 #防火墙过滤脚本(主机型防火墙)
        3 iptables -t filter -P INPUT ACCEPT
        4 iptables -t filter -P OUTPUT ACCEPT
        5 iptables -F INPUT
        6 iptables -F OUTPUT
        7 iptables -h INPUT -p tcp -m multiport --dport 22,80,25,21,110,143 -j ACCEP T
        8 iptables -h INPUT -P udp --dport 53 -j ACCEPT
        9 iptables -A INPUT -p icmp --icmp-type 8 -j DROP
        10 iptables -A INPUT -p icmp --icmp-type 0 -j ACCEPT
        11 iptables -A INPUT -p icmp --icmp-type 3 -j DROP
        12 iptables -t filter -P INPUT DROP
        13
        14 iptables -h OUTPUT -p udp --sport 53 -j ACCEPT
        15 iptables -h OUTPUT -p tcp -m multiport --sport 22,80,25,21,110,143 -j ACCE PT
        16 iptables -A OUTPUT -p icmp --icmp-type 8 -j ACCEPT
        17 iptables -A OUTPUT -p icmp --icmp-type 0 -j ACCEPT
        18 iptables -A OUTPUT -p icmp --icmp-type 3 -j ACCEPT
        19 iptables -t filter -P OUTPUT DROP

        上面脚本还是有问题,-h是经过-I修改过来的

        https://blog.csdn.net/u012012240/article/details/73799956  //这个是防火墙重启失败需要修改的东西

        https://www.cnblogs.com/xcxc/archive/2013/03/25/2980131.html  //详细的防火墙

  • 相关阅读:
    Unobtrusive Ajax
    Asp.Net Web API 2(入门)第一课
    c# in depth之泛型的实现
    ASP.NET MVC 單元測試系列
    菜单栏
    【C++ 中文手册】即将完成
    AspNet MVC3中过滤器 + 实例
    虚拟机安装Linux中常见异常及解决办法
    webbrowser打开新窗口事件+=
    Java Bad version
  • 原文地址:https://www.cnblogs.com/6262lonely/p/9832336.html
Copyright © 2011-2022 走看看