# mib **Repository Path**: springborland/mib ## Basic Information - **Project Name**: mib - **Description**: SNMP MIB - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2026-09-07 - **Last Updated**: 2026-09-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # mib ## MIB ### IF-MIB > 接口管理 > 描述了网络接口层的通用表项,是MIB-II中ifTable的升级版本,也是对RFC1573扩展定义的具体说明; > https://blog.csdn.net/fuhanghang/article/details/104656348 ## 设备识别 > `sysServices` : 是一个`sum`值,通过该值可以知道实体提供ISO哪几层的服务 > |Name|OID|MIB|Syntax|Access|Status|DefVal|Indexes|Descr| |--|--|--|--|--|--|--|--|--| |sysServices|.1.3.6.1.2.1.1.7|RFC1213-MIB|INTEGER (0..127)|read-only|mandatory|||A value which indicates the set of services that this entity primarily offers.The value is a sum. This sum initially takes the value zero, Then, for each layer, L, in the range 1 through 7, that this node performs transactions for, 2 raised to (L - 1) is added to the sum. For example, a node which performs primarily routing functions would have a value of 4 (2^(3-1)). In contrast, a node which is a host offering application services would have a value of 72 (2^(4-1) + 2^(7-1)). Note that in the context of the Internet suite of protocols, values should be calculated accordingly: layer functionality 1 physical (e.g., repeaters) 2 datalink/subnetwork (e.g., bridges) 3 internet (e.g., IP gateways) 4 end-to-end (e.g., IP hosts) 7 applications (e.g., mail relays) For systems including OSI protocols, layers 5 and 6 may also be counted.| > > `sysServices` 值: > |Service|Hex Value|Decimalism Value|Descr|Layers| |--|--|--|--|--| |Physical|0x01|1 = `2^(1-1)`|物理层|1| |DataLink / Subnet|0x02|2 = `2^(2-1)`|数据链路层|2| |Internet|0x04|4 = `2^(3-1)`|网络层|3| |End-to-end|0x08|8 = `2^(4-1)`|传输层|4| |Application|0x40|64 = `2^(7-1)`|应用层|7| > > 假设值为 `66 = 64 + 2` 等价于 `65 = 2^(7-1) + 2^(2-1)`; > 由此可见该设备提供了`L2:数据链路层(DataLink / Subnet = 2)`、`L7:应用层(Application = 64)`上的服务 > 假设值为 `72 = 64 + 8` 等价于 `76 = 2^(7-1) + 2^(4-1)`; > 由此可见该设备提供了`L4:传输层(End-to-end = 8)`、`L7:应用层(Application = 64)`层上的服务 > 假设值为 `76 = 64 + 8 + 4` 等价于 `76 = 2^(7-1) + 2^(4-1) + 2^(3-1)`; > 由此可见该设备提供了 `L3:网络层(Internet = 4)`、`L4:传输层(End-to-end = 8)`、`L7:应用层(Application = 64)`层上的服务 > 假设值为 `78 = 64 + 8 + 4 + 2` 等价于 `78 = 2^(7-1) + 2^(4-1) + 2^(3-1) + 2^(2-1)`; > 由此可见该设备提供了`L2:数据链路层(DataLink / Subnet = 2)`、`L3:网络层(Internet = 4)`、`L4:传输层(End-to-end = 8)`、`L7:应用层(Application = 64)`上的服务 > ### 路由器 > 1.SNMP 查询设备中的`ipAddrEntry`表, 如果没有返回, 则可以初步认定该设备不具备路由功能(不是路由器); > |Name|OID|MIB|Syntax|Access|Status|DefVal|Indexes|Descr| |--|--|--|--|--|--|--|--|--| |ipAddrEntry|.1.3.6.1.2.1.4.20.1|RFC1213-MIB|IpAddrEntry|not-accessible|mandatory||ipAdEntAddr|The addressing information for one of this entity's IP addresses.| > > 2.如果设备有两个或者更多的接口, 且`ipForwarding`节点被设置为`1[ forwarding(1) ]`, 可以认定该设备具备路由功能; > |Name|OID|MIB|Syntax|Access|Status|DefVal|Indexes|Descr| |--|--|--|--|--|--|--|--|--| |ipForwarding|.1.3.6.1.2.1.4.1|RFC1213-MIB|INTEGER{forwarding(1), not-forwarding(2) }|read-write|mandatory|||The indication of whether this entity is acting as an IP gateway in respect to the forwarding of datagrams received by, but not addressed to, this entity. IP gateways forward datagrams. IP hosts do not (except those source-routed via the host). Note that for some managed nodes, this object may take on only a subset of the values possible. Accordingly, it is appropriate for an agent to return a `badValue' response if a management station attempts to change this object to an inappropriate value.| > ### 交换机 > 应该实现`Bridge-MIB`,而且应该实现其中的几个主要节点: > 1.端口的数量节点 > |Name|OID|MIB|Syntax|Access|Status|DefVal|Indexes|Descr| |--|--|--|--|--|--|--|--|--| |dot1dBaseNumPorts|.1.3.6.1.2.1.17.1.2|BRIDGE-MIB|INTEGER32|read-only|current|||The number of ports controlled by this bridging entity.| > > 2.从当前桥节点到根桥节点的路径值 > |Name|OID|MIB|Syntax|Access|Status|DefVal|Indexes|Descr| |--|--|--|--|--|--|--|--|--| |dot1dStpRootCost|.1.3.6.1.2.1.17.2.6|BRIDGE-MIB|INTEGER32|read-only|current|||The cost of the path to the root as seen from this bridge.| > > 3.从点前桥节点到根桥节点的端口数量 > |Name|OID|MIB|Syntax|Access|Status|DefVal|Indexes|Descr| |--|--|--|--|--|--|--|--|--| |dot1dStpRootPort|.1.3.6.1.2.1.17.2.7|BRIDGE-MIB|INTEGER32|read-only|current|||The port number of the port that offers the lowest cost path from this bridge to the root bridge.| > > 如果以上3点都支持, 可以认为是一个交换机; 可以得到交换机的端口列表以及相关的属性: > > 1.端口对应的接口索引值 > |Name|OID|MIB|Syntax|Access|Status|DefVal|Indexes|Descr| |--|--|--|--|--|--|--|--|--| |dot1dBasePortIfIndex|.1.3.6.1.2.1.17.1.4.1.2|BRIDGE-MIB|InterfaceIndex (Integer32) (1..2147483647). Hint: d|read-only|current||dot1dBasePort|The value of the instance of the ifIndex object,defined in IF-MIB, for the interface corresponding to this port.| > > 2.端口的当前状态 > |Name|OID|MIB|Syntax|Access|Status|DefVal|Indexes|Descr| |--|--|--|--|--|--|--|--|--| |dot1dStpPortState|.1.3.6.1.2.1.17.2.15.1.3|BRIDGE-MIB| INTEGER {disabled(1),blocking(2),listening(3),learning(4),forwarding(5),broken(6) }|read-only|current||dot1dStpPort|The port's current state, as defined by application of the Spanning Tree Protocol. This state controls what action a port takes on reception of a frame. If the bridge has detected a port that is malfunctioning, it will place that port into the broken(6) state. For ports that are disabled (see dot1dStpPortEnable), this object will have a value of disabled(1).| > > 3.接口索引 > |Name|OID|MIB|Syntax|Access|Status|DefVal|Indexes|Descr| |--|--|--|--|--|--|--|--|--| |ifIndex|.1.3.6.1.2.1.2.2.1.1|RFC1213-MIB|INTEGER|read-only|mandatory||ifIndex|A unique value for each interface. Its value ranges between 1 and the value of ifNumber. The value for each interface must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.| > > 4.接口描述 > |Name|OID|MIB|Syntax|Access|Status|DefVal|Indexes|Descr| |--|--|--|--|--|--|--|--|--| |ifDescr|.1.3.6.1.2.1.2.2.1.2|RFC1213-MIB|DisplayString (OCTET STRING) (SIZE (0..255))|read-only|mandatory||ifIndex|A textual string containing information about the interface. This string should include the name of the manufacturer, the product name and the version of the hardware interface.| > > 5.接口速度(带宽) > |Name|OID|MIB|Syntax|Access|Status|DefVal|Indexes|Descr| |--|--|--|--|--|--|--|--|--| |ifSpeed|.1.3.6.1.2.1.2.2.1.5|RFC1213-MIB|GAUGE|read-only|mandatory||ifIndex|An estimate of the interface's current bandwidth in bits per second. For interfaces which do not vary in bandwidth or for those where no accurate estimation can be made, this object should contain the nominal bandwidth.| > https://dandelioncloud.cn/article/details/1571082602704760834 1.如何判断 `sysServices`标示设备支持哪一层,`ipForwarding` 标示设备是否具有转发功能 #### 介绍 SNMP MIB #### 软件架构 软件架构说明 #### 安装教程 1. xxxx 2. xxxx 3. xxxx #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) // https://oidref.com/static/mibdepot/ruijie/MY-SMI.mib.txt