Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

about getting ports of a switch

Status
Not open for further replies.

moonquelle

Programmer
Feb 12, 2006
1
TR
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?
 
Take a look at the (unknown) script from our MRTG friend Tobias, named cammer.
This perl script queries your switch and your router and provides a list of Ports with corresponding MAC addresses and corresponding IP addresses which are in use on your switch.
Perhaps you can use this at your advantage.
Read the cammer.readme.txt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top