I apologize in advance if my questions is too simplistic as i am no expert in networking. I am working on a project and i need to know if it is possible to dynamically determine the type of device connected to a switch port. Switches connect end hosts using access ports and connect to other switches using Trunk ports. I want to know if its possible to programmatically track the type of devices connected to each switch port. One idea i came across was to monitor the type of traffic incoming from each port. For example incoming DNS requests could suggest that it is a host connected to the switch but since trunk connections carry all sorts of messages including DNS packets which makes it hard to be sure of the device type connected to the port. Any existing methods and references will be highly appreciated. Thank you.

  • 1
    My favorite question: what are you really trying to accomplish? Tracking this directly from the switchport isn't going to yield the most robust info. You can very loosely correlate manufacturers via the OUI of the MAC address. (Check out wireshark.org/tools/oui-lookup.html) EDIT: Didn't realize "hit enter to post" was enabled.
    – boomi
    Jul 12, 2017 at 12:13
  • Your favourite question: What i am trying to accomplish is that i want to create a program that monitors the network and creates a table like structure for each switch in the network. The table is then populated with the type of device connected to each port on the switch. As i mentioned making the decision simply based on tracking host specific traffic is not sufficient and that is why I need a better way to make this distinction.
    – Syed Emad
    Jul 12, 2017 at 12:52
  • 1
    For infrastructure, @Cown's answer is what you're looking for. For arbitrary unmanaged hosts, e.g., Is this a user's {Mac|Windows|Linux} computer, the switch won't help too much. You might use the switch's knowledge of MAC:interface mapping (CAM table), which you'd then correlate with devices in an asset management suite, which hopefully has an appropriate API. (Not posting this as an answer as it really isn't one.)
    – boomi
    Jul 12, 2017 at 14:31

1 Answer 1


On a Cisco environment it is possible to use Cisco Smartports.

Auto Smartports uses event triggers to map macros to the source port of the event. The most common triggers are based on Cisco Discovery Protocol (CDP) messages received from a connected device. A CDP event trigger occurs when these devices are detected:

• Cisco switch
• Cisco router
• Cisco IP Phone
• Cisco Wireless Access Point including autonomous and lightweight access points
• Cisco IP video surveillance camera

Additional event triggers for Cisco and third-party devices are user-defined MAC address groups, MAC authentication bypass (MAB) messages, IEEE 802.1x authentication messages, and Link Layer Discovery Protocol (LLDP) messages.

LLDP supports a set of attributes used to discover neighbor devices. These type, length, and value attributes and descriptions are referred to as TLVs. LLDP-supported devices use TLVs to receive and send information. This protocol advertises details such as device configuration information, capabilities, and identity. Auto Smartports uses the LLDP system capabilities TLV as the event trigger. Use the event trigger control feature to specify if the switch applies a macro based on the detection method, device type, or configured trigger.

For devices that do not support CDP, MAB, or 802.1x authentication, such as network printers, LLDP, or legacy Cisco Digital Media Players, you can configure a MAC address group with a MAC operationally unique identifier (OUI)-based trigger. You map the MAC address to a built-in or user-defined macro that has the desired configuration.

  • @SyedEmad No problem, feel free to accept my answer. :-)
    – user36472
    Jul 12, 2017 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.