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!

Finding an IP address given the MAC address

Status
Not open for further replies.

ISmonkey

MIS
Sep 6, 2001
62
FR
We have a cisco 3500 and i know i can lookup what mac address are attached to the ports by the show mac command. Is there any way to find the IP address (only given the mac address) either from the IOS or from the Windows command prompt (without a third party software)?
IS[monkey]
 
I would check it with

show ip arp [mac] ( looks like this ffff.ffff.ffff.ffff)



best regards
ypswes
 
YPSYES's solution works on cisco routers and would produce the desired results.

If you really want to go for the gold, try the following:
Telnet to the 3500.
Use file capture: Log Session to file
After logging in use the following:
Command: SH VER Find # of Mod’s in Switch
Command: SH CAM DYN n/ n is the Mod #
Cisco has a consistent problem across IOS’s that all ports with MAC's will be displayed except the very last port. When the “more” appears depress Break key or <ctrl> & c to discontinue.
Check the last port:
Command: SH CAM DYN n/xx n is the Mod # and xx is
last port 12 or 24 or 48.

Repeat the above for ALL mods on the Switch
(exclude the supervisor module ).
Repeat for ALL Switches.

Log file contains Vlan, MAC, CoS, Mod/port

Import to Spreadsheet or EXCEL, insert column before data and enter Switch identifier (IP, DNS Name, etc.) on all rows pertaining to that switch.
Then identify the next switch and copy identifier in first column on all rows pertaining to that switch.
Then select all items on the spreadsheet and sort on column B. Delete all the header lines and other rows not needed. Use the DATA in Tool bar and Text to Columns command to separate fields within column B which are Vlan, MAC, CoS, Mod/Port be careful and define all fields as text or you will have dates instead of Mods/Ports and the MAC addresses with all numbers expressed as floating point ( real ugly and not what we want).

This is tedious, but it took about 20 mins for my 44 switches. I then wrote a script for a Reflections Telnet session and wrote a comma separated variable file, rather than using session logging.

Now let's get the corresponding IP addresses from the ARP table on the default gateway router.
Telnet to the router.
Use file capture: Log Session to file
After logging in use the following:
Command: SH ARP List of IP addresses/macs is displayed.
at the more prompt hit the space bar until all entries are displayed in the ARP table.

Again, import log file to Spreadsheet or EXCEL. Then select all items on the spreadsheet and sort on column B. Delete all the header lines and other rows not needed. Use the DATA and Text to Columns command to separate fields within column B which are protocol, IP address, Age, MAC address, Type and Interface be careful and define all fields as text or you will have MAC address with all numbers are expressed as floating point ( real ugly and not what we want).

As an alternative get the corresponding IP addresses from the ARP table on the default gateway router using the freebie program GETIF. Not only do you get the IP and MAC addresses, it resolves the IP address providing the DNS name and Network interface card vendor. If an OUI is not translated properly or missing a simple text file called vendor can be updated (be sure to keep the file in order by OUI or lookups will fail) for the OUI and Company Name use:


for lookups of the latest OUI's or download the text file.

The router must be configured for SNMP for GETIF to do its magic. Under the Parameters tab enter the IP address, hit start. Under the ARP tab depress start again and the ARP table appears with DNS names if selected and Vendor names for the NIC's. (Newbies) Vendor identification is established by the first six hex digits of the MAC address.
Once the ARP table is complete, swipe all the columns and rows, right click on the highlighted area and copy to a spreadsheet or EXCEL.

Personally, GETIF does it all with the added benefits of DNS and Vendor Names.

You can now establish a common column in both spreadsheets for the MAC address. Copy and paste the two together into one sheet and sort by MAC. Merge the data elements together by MAC. Use ACCESS to form a data base merging the two spreadsheets again by MAC.
Dependent on your environment all MACS may not have an associated IP address and you may elect to include an slist or nlist from Novell outputting it to a file. Import the file to a spreadsheet. Slice and dice the data to your liking, but definitely isolate the MAC to merge the data with the other IP addressing data.
The long and short of it is, if you can get a MAC or IP address along with other pertinent data, it can all be merged together within a spreadsheet or database.
Even if you are running DHCP, you may have to repeat the capture of information process more frequently, but you have a wealth of information. Automating the process is the trick. It's the old adage &quot;Physician heal thy self&quot;.
Hopefully this all makes sense. After proof reading, it is quite long.

The last comment is anything is possible:

Reality is a state of mind for those who lack imagination.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top