Hour 136: ARP Tables and TCL Scripts Part 2

In my last post I shared a technique in which you refresh your switches ARP tables and then keep the ip-mac-port mapping in a database for future reference. I would first like to say that there are some 3rd party monitoring software tools that can do the same job for you as a TCL script but sometimes, due to licensing or security reasons you won’t be able to add SNMP read/write access to some devices. Also, sometimes you will have a network that is not routed to your monitoring servers. For these reasons, it’s important to be able to know a little bit of scripting to automate the data aggregation process.

I did not find any script that worked with 6500’s on the internet so I created my own for you guys to use if needed. It will display the IP address – Mac Address – Physical Interface – Logical Interface – Description on the port. Here it is:

proc arpThistable {} {
set ARP [split [exec “show ip arp | e Protocol| -“] “\n”]
foreach line $ARP {
set IP [lindex $line 1]
set MAC [lindex $line 3]
set LOG [lindex $line 5]
set INT [exec “show mac address-table address $MAC | i Gi|Te”]
set PHY [lindex $INT 6]
set DESC [exec “show run interface $PHY | i description”]
puts “$IP $MAC $PHY $LOG $DESC”
}
}
arpThistable

Hope this was useful.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s