Posted by The TechMentor in BASH, Scripts
on Feb 13th, 2013
Sometimes we have a need to figure out which port, on a network switch, a given device is plugged into. In “Part 1” here we assume we have a single switch on our LAN. “Part 2” will go a little deeper and check multiple switches. Using this script, we can search by hostname, IP address, or MAC address. The MAC address is the key to success so, if searching by hostname or IP address, we need to first find the MAC address. We use the “arp” command to check our arp cache for the MAC address. To ensure the MAC address is in the arp cache, we first “ping” the...