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

identifying which mac is on which a specific port.

Status
Not open for further replies.

youcandoit

Technical User
Feb 14, 2005
159
US
Hi,

I know the port and need to identify the mac.

Any HELP is greatly appreciated!
 
Depends on the switch

the set feature set would use show cam
most older IOS feature sets would use show mac
most newer IOS feature sets would use show mac-address




It is what it is!!
__________________________________
A+, Net+, I-Net+, Certified Web Master, MCP, MCSA, MCSE, CCNA, CCDA, and few others (I got bored one day)
 
But you can be greatly informed about the whereabouts of your MAC adresses or IP addresses.
Do you know MRTG? Do you know the developer? Do you know his most brilliant script named cammer?
Check out and get cammer.
This is a perl script which will search through your Switch for IP adresses and relate them, via your Router, to MAC addresses on your Switchports !! BRILLIANT !! Now you have a nice overview of your complete switch.

Get the latest Perl and MRTG distributions from the Internet. Install both and copy the .pm files from \mrtg\lib\mrtg2\ to \perl\lib\ because cammer needs a few of those which are not distributed with perl (in my case). Now you are ready to go hunt those MAC addresses.

I run (schedule) the following every 15 minutes:
perl \cammer\cammer.pl public@10.1.1.10 public@10.1.1.1 >macout.txt
assuming that public is your SNMPReadCommunityString and 10.1.1.10 is your switch and 10.1.1.1 is your Router.
After each run I process (scheduled) the .txt into a database.
Every time I (or the helpdesk) want to know something about a MAC or port or IP address (first seen / last seen) I search through my database and produce an overview of the activity. And the best of all cammer is free !!
 
On our Cisco 2948G, we do a
show cam dynamic
and this shows all entries, but you have to keep
entering 'y' and a return.

To capture this massive list to a file...
1. login to a Unix box.
2. pop open a shell window.
3. run the 'script' command with the filename..
4. Telnet to the switch
5. run the 'show cam dynamic' command
6. exit the telnet, then exit out of the script
7. perform some cleanup on the file using text editir.
You can then search the file using the FIND pattern function.

You can also use Perl to write a script that will PING all the IP addresses in your subnet. Immediately after doing the PING, check the ARP table with an ARP -A, and you will find the MAC address ... as long as your local PC is on same segment as the system you're pinging.

Another idea is to have your local LAN administrator add a
line something like this to the LAN login scripts....
IPCONFIG /ALL >> Q:\TEMP\WKSTNMAC.txt
The next time the user logs in, the startup process would add the IP information, which would include the MAC address to the file. And you pick it up in a few days.

After getting all the IPCONFIG or PING script results in one text file, and all the CAM table dumps in a 2nd file, you can then write a Perl script to cross-reference the results and generate a table showing SWITCH PORT, MACADDRESS and IPADDRESS.

good luck..
Alan
 
Try sh mac-address-table |include <port> or scroll through the 'sh mac-address-table' until you find the port.
 
In IOS try:

sh mac-address-table interface <Interface>

In CAT-OS:

sh cam dynamic <mod/port>


Regards.
 
You can search on specific ports , for catos it just show cam slot/port aand it will give you the mac, for IOS it's show mac-address-table slot/port. On the catos boxes if you have a big cam tabel and you don't want to keep hitting "Y" then just do a "set length 0" before doing a show cam dynamic .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top