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

Best method to port map hostnames to port location?

Status
Not open for further replies.

DarkestClown

Technical User
Feb 18, 2003
3
0
0
US
Im looking to find a way to associate hostnames to port location? Here is the whole story... Im at a new job. I have limited access other than show commands into the production switches.

I want to find a way to associate every port number with a hostname of whatever server that is connected to the switch. Is there an easy way of doing it?

Thanks for your help.
 
This is not too hard to do, even without fancy software, and all you need is show commands, but it requires a few separate steps and some "massaging" of the data in Excel or something.

On the access switches, get a list of mac-addresses by doing:

show mac-address | include fa0/ #where fa0/ = a string that identifies your access ports. Either use hyperterminal and capture the output, or copy and paste it from cmd window.

Then, on a layer 3 router/switch, do:

show arp

Once again capturing the output. Place all that data in Excel either on the same sheet or separate sheets, do a compare, filter out the nonsense, and what you'll have left is a list of IP address to port mappings. Since servers are typically static addresses, then at this point you should have what you need.

(If you don't have access to a layer3 switch, this becomes a little more difficult, but still doable. Let me know if this works for you.)

If you need hostnames, you can put the IPs in a text file and do a for loop with an "nbtstat -a" or "ping -a", once again filtering out the unneeded data. Something like:

for %1 in (text.txt) do ping -a -n 1 %1 >> output.txt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top