[SNMP MIB][protolDirID][protocolDirParameters] 與它的不快樂夥伴
為什麼不快樂,因為寫這東西的人沒有人快樂的起來
首先來介紹一下我在工作上研究了差不多七,八個月的這個東西。它叫簡單網路管理協定(SNMP , Simple Network Management Protocol) 跟網路管理資料庫(MIB , Men In Black(X), Management Information Base(O)),剩下的自己估狗吧,估狗的到我就不講了
今天要講的是protocolDirTable的 Index:
protocolDirID/protocolDirParameters
先來看一下protocolDirID定義吧
protocolDirTable is indexed by these two OID (很難用中文講這句),所以我只好繼續找跟這個table相關的資料,最後找到了這個 https://tools.ietf.org/html/rfc2895#section-3
雖然我不知道cnt是什麼,但是由上圖可以知道 protocolDirID其實每一個node都有它的意義存在,我們再來看看飯粒(X)範例(O)
從以上大概可以理解到,protocolDirID 就是由一系列的 protocol identifiers 所組成,拿 http來解釋的話,第一個16 就是表示後面會有16位的長度,這就是cnt的意思,前四位表示的base layer identifier。
The first layer encapsulation is called the base identifier and it
contains optional protocol-function information and the base layer
(e.g. MAC layer) enumeration value used in this protocol identifier.
The base identifier is encoded as four octets as shown in figure 2.
Fig. 2
base-identifier format
+---+---+---+---+
| | | | |
| f |op1|op2| m |
| | | | |
+---+---+---+---+ octet
| 1 | 1 | 1 | 1 | count
The first octet ('f') is the special function code, found in table
4.1. The next two octets ('op1' and 'op2') are operands for the
indicated function. If not used, an operand must be set to zero. The last octet, 'm', is the enumerated value for a particular base layer encapsulation, found in table 4.2. All four octets are encoded in network-byte-order.Table 4.2 Base Layer Encoding Values
--------------------------------------
Name ID
------------------
ether2 1
llc 2
snap 3
vsnap 4
ianaAssigned 5
我不想讓這篇文章太長,所以每個Layer的定義都在下面
base layer identifier之後呢,就要去找iana的官網來找ip這個protocol的編號了,哪裡找呢,很抱歉我到目前還是沒找到,只知道最後代表IP的identifier是 0.0.8.0 。至於tcp就有辦法在下列網址找到代表的數字6了,and make 0.0.0.6
最後我們知道http用的是80這個通訊埠,組成了最後一個0.0.0.80
看到這邊相信各位對於protocolDirID就有了一個基本的認識了。
接下來介紹protocolDirParameters,關於這個oid從文件中有找到幾點必須要符合的:
1. The protocolDirParameters length MUST be exactly one quarter of the protocolDirID string length. 就是如果前面 protocolDirID 長度是16, protocolDirParameters 的長度就會是16的四分之一, which is 4.2. There are no suggested protocolDirParameters bits for the base layer.
我目前所找到的資料都沒有特別敘述這些 parameter 哪裡來的,從原始定義裡面也可以知道 parameter 也可以是 0
畢竟這些都是20年前的東西,相關資料有點少,有機會再補充