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

function to return a workstation's physical port number

Status
Not open for further replies.

ws6764a

Technical User
Joined
Sep 9, 2002
Messages
1
Location
US
I am curious if anyone is aware of a way to identify the physical network port a workstation is on. I would like to write a utility to help me with my workstation inventory.

If I can tie the mac address to a physical port it would save a lot of foot work.

I have found one network management software that will scan the network and identify the devices by port. However it only works with switches that support bridged_mib.

I would like to find a function or .dll call that would allow a logon script to interrogate the switch/hub and return the port number and then have the logon script log the information in a central repository of some type.

Anyone have any ideas?
 
Maybe not exactly what you are looking for, but since you posted your question in Cisco: Switches you might want to check out the freeware CatTools from One of the many features of this great tool is generating a detailed report of all your Cisco switches. This report shows which MAC address was seen on which switch/port. The report is TAB delimited and can be viewed and post-processed with EXCEL.
Just enter your switches into the database (Ctrl+L), select them and perform "Create Switch Documentation File" (Ctrl+S).

Cheers *Rob
 
Hi,
Not sure if this is what you're looking for but it may help. This is a simple shell script to execute commands on an IOS device and log the results. See if you can modify it for your purposes.
You can change the commands add to them depending on what you're looking for.

Hope it helps,
Cheers,
Phil.

#!/opt/local/bin/bash

###########################################
# Replace x's with Router's IP address
#
IP_ADDRESS='xxx.xxx.xxx.xxx'


# Directory where the log files will be stored
#
DIR=/var/log/routername.log

########################################

if [ ! -e $DIR ]
then
mkdir $DIR
fi

# Tag specification: mmddhhmm
DATE=`date +'%m%d'`
TIME=`date +'%H%M'`
TAG=$DATE$TIME

# Collect data from the router
(echo "loginname"; echo "password"; echo "enable"; echo "enablepassword"; echo "term len 0"; echo "show version"; echo "show processes cpu"; echo "term len 15"; echo "show memory summary"; echo "q"; sleep 30)|telnet $IP_ADDRESS > $DIR/info.$TAG 2>$DIR/info.$TAG.msg
If everything is coming your way then you're in the wrong lane.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top