1.工具说明

  在防火墙部署中,经常会遇到防火墙接收到了数据包,但并未进行转发。可以通过diagnose debug flow 命令来对数据包的处理过程进行跟踪,可以清晰查看数据包再各个功能模块内的处理过程,判断出数据包如何被转发或者丢弃。

2.命令介绍

  diagnose debug enable              开启debug功能

  diagnose debug flow show console enable  开始flow的输出

  diagnose debug flow filter add 119.253.62.131     定制过滤器,支持多种过滤;可以添加多个组合的过滤器

  diagnose debug flow trace start 6    定义所要跟踪数据包的数量

  diagnose debug flow filter         查看过滤器的配置

3.过滤参数

  FGT# diagnose debug flow filter

  addr      IP address.                        // ip地址

  clear     Clear filter.                         // 清除过滤器

  daddr     Destination IP address.     // 目的地址

  dport     Destination port.           //目的端口

  negate    Inverse filter.             //反向过滤

  port      port                        // 接口, 如port1

  proto     Protocol number.  // 协议,  如6,tcp协议, 17 udp, 1 icmp

  saddr     Source IP address.          //源地址

  sport     Source port.                // 源端口

  vd        Index of virtual domain.     //vdom

4.分析示例

1)

  FGT# id=36871 trace_id=1 msg="vd-root received a packet(proto=6, 192.168.1.110:51661->119.253.62.131:80) from internal."id=36871 trace_id=1 msg="allocate a new session-00016920"

  //internal口收到数据,建立新会话

  id=36871 trace_id=1 msg="find a route: gw-192.168.118.1 via wan1"             //查找到路由表

  id=36871 trace_id=1 msg="find SNAT: IP-192.168.118.28, port-43333"                     //检测存在NAT配置

  id=36871 trace_id=1 msg="Allowed by Policy-1: SNAT"                       // 匹配策略,ID1

  id=36871 trace_id=1 msg="SNAT 192.168.1.110->192.168.118.28:43333"          //做NAT

  id=36871 trace_id=3 msg="vd-root received a packet(proto=6, 119.253.62.131:80->192.168.118.28:43333) from wan1."                                                           // Wan1口收到返回数据包

  id=36871 trace_id=3 msg="Find an existing session, id-00016920, reply direction"                //数据包匹配会话id-0001692

  id=36871 trace_id=3 msg="DNAT 192.168.118.28:43333->192.168.1.110:51661"

  /做反向的DNAT

  id=36871 trace_id=3 msg="find a route: gw-192.168.1.110 via internal"                                //查找路由,发送到internal口

  id=36871 trace_id=5 msg="vd-root received a packet(proto=6, 192.168.1.110:51661->119.253.62.131:80) from internal."                                      //internal口收到后续数据包

  id=36871 trace_id=5 msg="Find an existing session, id-00016920, original direction"               //匹配会话id-0001692

  id=36871 trace_id=5 msg="enter fast path"        //直接转发

  id=36871 trace_id=5 msg="SNAT 192.168.1.110->192.168.118.28:43333"                 //NAT

  2)策略拒绝访问

  FGT# id=36871 trace_id=23 msg="vd-root received a packet(proto=6, 192.168.1.110:51768->119.253.62.131:80) from internal."

  id=36871 trace_id=23 msg="allocate a new session-00017537"

  id=36871 trace_id=23 msg="find a route: gw-192.168.118.1 via wan1"

  id=36871 trace_id=23 msg="Denied by forward policy check"       //直接被策略拒绝,检查策略配置问题

  3)常见debug flow结果

  msg="iprope_in_check() check failed, drop"

  没有该项策略,或策略不匹配,数据包被丢弃

  msg="Denied by forward policy check"

  策略动作拒绝,或命中隐含策略, 数据包被拒绝

  msg="reverse path check fail, drop"

  反向路径,即源路由检查失败,丢弃数据包

  会话经由 session-helper 处理

  msg="run helper-ftp(dir=original)"

posted on 2018-12-09 14:46  星痕1216  阅读(1200)  评论(0编辑  收藏  举报