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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use snmp to find out what ip addresses go to which port numbers

Status
Not open for further replies.

EonsNearby

Programmer
Aug 15, 2012
2
US
As the title suggests, I need to find out which ip addresses (or MAC addresses, either will work) go belong to which port numbers. I have used the following snmpwalk command to be able to find out every ip address, MAC address, Network address, and port is active (it finds other information as well, but I don't know what to do with them):

snmpwalk -v 1 [NAME_OF_ROUTER] -c [PASSWORD]

I just want to know, is there a way to correlate the ip address or MAC address to its respective port number?
 
The ifTable should tell you this.

1.3.6.1.2.1.2.2(ifTable)

1.3.6.1.2.1.2.2.1.6(ifPhysAddress) will give you the mac address.


Bill
 
I don't think 1.3.6.1.2.1.2.2.1.6(ifPhysAddress) gives me the MAC address. I know what my MAC address is, and none of the entries from 1.3.6.1.2.1.2.2.1.6(ifPhysAddress) are anything close to my MAC address (unless they are in a different format). Also, how does the ifTable tell me the correlation? It just seems to give me the same information I can find with snmpwalk -v 1 [NAME_OF_ROUTER] -c [PASSWORD]
 
Object ifPhysAddress
OID 1.3.6.1.2.1.2.2.1.6
Type PhysAddress
Permission read-only
Status current
MIB IF-MIB ; - View Supporting Images
Description "The interface's address at its protocol sub-layer. For
example, for an 802.x interface, this object normally
contains a MAC address. The interface's media-specific MIB
must define the bit and byte ordering and the format of the
value of this object. For interfaces which do not have such
an address (e.g., a serial line), this object should contain
an octet string of zero length."

Maybe show a walk of the ifTable here?

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top