给出的文件在Linux上的netstat -s中意味着什么

Ami*_*mar 2 linux ip networking icmp linux-kernel

我正在分析输出,netstat -s并想知道"输入ICMP消息失败"是什么意思.以下是输出netstat -s,

Icmp: 
      643 ICMP messages received 
      0 input ICMP message failed. 
      ICMP input histogram:
        destination unreachable: 450 
        echo requests: 9 
        echo replies: 2 
      102 ICMP messages sent 
      0 ICMP messages failed 
      ICMP output histogram: 
        destination unreachable: 84 
        echo request: 9 
        echo replies: 9

 Icmp:
    648 ICMP messages received
    0 input ICMP message failed.
    ICMP input histogram:
      destination unreachable: 450
      echo requests: 14
      echo replies: 2
    107 ICMP messages sent
    0 ICMP messages failed
    ICMP output histogram:
      destination unreachable: 84
      echo request: 9
      echo replies: 14

如何将值0分配给"输入ICMP消息失败"以及将除零以外的条件值分配给该字段?

hek*_*mgl 5

它在RFC 4293中定义 - 用于Internet协议(IP)的管理信息库(MIB) :(第82页)

icmpStatsInErrors:实体(主机)收到但确定为具有ICMP特定错误(错误的ICMP校验和,错误长度等)的ICMP消息数.


我是怎么发现的?

netstat将从内核获取它的信息/proc/net/snmp.它只是格式化它.你可以在源代码中netstat看到.

所以我查看了写入/ proc文件的相关内核代码.它是:net/ipv4/proc.c(第338行)您可以看到该常量ICMP_MIB_INERRORS用于告诉我,内核正在为SNMP目的实现ICMP MIB.

我已经用Google搜索了MIB并找到了RFC 4293.在页82上,您将找到有icmpStatsInErrors问题的值的定义.

开源规则!;)