moonquelle
Programmer
Hi all,
I'm tring to write a little program in Ruby which connects to a switch, then take the mac addresses and ports of the devices; which were related to the switch.
So, i walk on this mib to get mac addresses; "1.3.6.1.2.1.17.4.3.1.1"
Then i get many variables like this:
"1.3.6.1.2.1.17.4.3.1.1.0.0.12.7.172.8"
Then i convert the last 6 numbers to hex (i took
"0.0.12.7.172.8" then i convert them to hex one by one, and i get the mac address like "00 00 0C 07 AC 08").
It's ok. But i stucked up about ports.
I used this mib "1.3.6.1.2.1.17.4.3.1.2" to get the ports. I get something like this:
"1.3.6.1.2.1.17.4.3.1.2.0.0.33.207.215.190"
So, as i did in mac addresses, i wanted to convert this
("1.3.6.1.2.1.17.4.3.1.2.0.0.33.207.215.190") to a port number.
But i couldn't find, how i will do that?
I searched a lot, but couldn't find a usefull answer. If you have any idea about converting these to port numbers? Or where am i wrong?
I'm tring to write a little program in Ruby which connects to a switch, then take the mac addresses and ports of the devices; which were related to the switch.
So, i walk on this mib to get mac addresses; "1.3.6.1.2.1.17.4.3.1.1"
Then i get many variables like this:
"1.3.6.1.2.1.17.4.3.1.1.0.0.12.7.172.8"
Then i convert the last 6 numbers to hex (i took
"0.0.12.7.172.8" then i convert them to hex one by one, and i get the mac address like "00 00 0C 07 AC 08").
It's ok. But i stucked up about ports.
I used this mib "1.3.6.1.2.1.17.4.3.1.2" to get the ports. I get something like this:
"1.3.6.1.2.1.17.4.3.1.2.0.0.33.207.215.190"
So, as i did in mac addresses, i wanted to convert this
("1.3.6.1.2.1.17.4.3.1.2.0.0.33.207.215.190") to a port number.
But i couldn't find, how i will do that?
I searched a lot, but couldn't find a usefull answer. If you have any idea about converting these to port numbers? Or where am i wrong?