1.1.b Layer 2 protocols

1.1.b i CDP

Devices send Cisco Discovery Protocol (Cisco proprietary protocol) announcements to the destination MAC address 01:00:0c:cc:cc:cc, out each connected network interface (messages sent in clear text). These multicast frames may be received by Cisco switches and other networking devices that support CDP into their connected network interface. By default, CDP announcements are sent every 60 seconds. Each device that supports CDP stores the information received from other devices in a table that can be viewed using the show cdp neighbors command.

The holdtime specifies the lifetime of an entry in the table – if no announcements are received from a device for a period in excess of the holdtime, the device information is discarded (default 180 seconds).

The first thing we should do is use CDP to find any directly connected devices:

SW1#sh cdp nei
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
                  D - Remote, C - CVTA, M - Two-port Mac Relay

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
SW4              Gig 1/1           141             R S I            Gig 1/1
SW4              Gig 1/0           139             R S I            Gig 1/0
SW2              Gig 1/3           140             R S I            Gig 1/3
SW2              Gig 1/2           146             R S I            Gig 1/2
SW3              Gig 0/3           141             R S I            Gig 0/3
SW3              Gig 0/2           138             R S I            Gig 0/2

Total cdp entries displayed : 6

Let’s dig deeper into a neighbor to see some more information:

SW1#sh cdp nei detail
-------------------------
Device ID: SW4
Entry address(es):
  IP address: 10.10.10.1
Platform: Cisco ,  Capabilities: Router Switch IGMP
Interface: GigabitEthernet1/1,  Port ID (outgoing port): GigabitEthernet1/1
Holdtime : 135 sec

Version :
Cisco IOS Software, vios_l2 Software (vios_l2-ADVENTERPRISEK9-M), Version 15.2(CML_NIGHTLY_20190423)FLO_DSGS7, EARLY DEPLOYMENT DEVELOPMENT BUILD, synced to  V152_6_0_81_E
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2019 by Cisco Systems, Inc.
Compiled Tue 23-Apr-19 04:48 by mmen

advertisement version: 2
VTP Management Domain: ''
Native VLAN: 1
Duplex: full
Management address(es):
  IP address: 10.10.10.1

Configuration for CDP is fairly simple.  We can turn it on/off globally:

SW1(config)#no cdp run
SW1(config)#cdp run

Or we can turn it on/off for an individual interface:

SW1(config)#int gi1/0/1
SW1(config-if)#no cdp enable

Default values for CDP

SW01#show cdp 
Global CDP information:
        Sending CDP packets every 60 seconds
        Sending a holdtime value of 180 seconds
        Sending CDPv2 advertisements is  enabled

If we want to change them we can.

SW1(config)#cdp timer ?
  <5-254>  Rate at which CDP packets are sent (in sec)

SW1(config)#cdp holdtime ?
  <10-255>  

1.1.b i LLDP

LLDP is similar to CDP, but we have some more options (messages sent in clear text).

We can view neighbors with show lldp neighbors and show lldp neighbors detail.
We can also turn on the protocol globally:

SW1(config)#lldp run

Or on an interface:

SW1(config-if)#lldp transmit

LLDP supports a set of attributes that contain TLVs (type, length, value).  These are the mandatory TLVs:

  • Port description TLV
  • System name TLV
  • System description TLV
  • System capabilities TLV
  • Management address TLV

Some other devices can use LLDP for VLAN assignment or PoE.  In order to do this they use LLDP-MED, which adds a number of TLVs:

  • LLDP-MED capabilities TLV
  • Network policy TLV
  • Power management TLV
  • Inventory management TLV
  • Location TLV

We can configure which TLV’s to send globally:

SW1(config)#lldp tlv-select ?
  4-wire-power-management  Cisco 4-wire Power via MDI TLV
  mac-phy-cfg              IEEE 802.3 MAC/Phy Configuration/status TLV
  management-address       Management Address TLV
  port-description         Port Description TLV
  port-vlan                Port VLAN ID TLV
  power-management         IEEE 802.3 DTE Power via MDI TLV
  system-capabilities      System Capabilities TLV
  system-description       System Description TLV
  system-name              System Name TLV

If we want to configure LLDP-MED TLVs, we have to go to an interface:

SW1(config-if)#lldp med-tlv-select ?
  inventory-management  LLDP MED Inventory Management TLV
  location              LLDP MED Location TLV
  network-policy        LLDP MED Network Policy TLV
  power-management      LLDP MED Power Management TLV

For the network policy TLV, we have to configure the policy first, then enable it on the interface:

SW1(config)# network-policy 1
SW1(config-network-policy)# voice vlan 100 cos 4
SW1(config-network-policy)# exit
SW1(config)# interface gi1/0/1
SW1(config-if)# network-policy profile 1
SW1(config-if)# lldp med-tlv-select network-policy

Finally, we can also configure LLDP timers:

SW1(config)# lldp holdtime 120
SW1(config)# lldp reinit 2
SW1(config)# lldp timer 30

1.1.b ii UDLD

UDLD (RFC 5171 / Cisco-proprietary) detects and disables unidirectional links on Ethernet fiber and copper interfaces due to miswiring or malfunctioning of the interfaces. UDLD is disabled by default.

UDLD has 2 modes of operation:

  • Normal mode – When a unidirectional link is detected, the port is allowed to continue operation.  UDLD will generate a syslog message and the port is considered undetermined.
  • Aggressive mode – If a unidirectional link is detected, UDLD will try to reestablish the link.  Messages are sent out once per second for 8 seconds.  If none of the messages are echoes back, the port is places in the errdisable state.

UDLD can be configured globally:

SW1(config)#udld ?
  aggressive  Enable UDLD protocol in aggressive mode on fiber ports except where locally configured
  enable      Enable UDLD protocol on fiber ports except where locally configured
  message     Set UDLD message parameters

If we set udld enable it will enable the protocol in normal mode.  The message parameter sets the message interval in seconds, the default is 15.  Note that UDLD timers do not need to match on both sides of the link.  This is because the messages (Destination MAC 01:00:0c:cc:cc:cc) are echoed back as they are received, and this is used to detect failures.

You can also enable/disable UDLD on an interface:

SW1(config-if)#udld port ?
  aggressive  Enable UDLD protocol in aggressive mode on this interface
  <cr>

You can verify UDLD with the following:

SW1#sh udld gigabitEthernet 1/1

Interface Gi1/1
---
Port enable administrative configuration setting: Enabled / in aggressive mode
Port enable operational state: Enabled / in aggressive mode
Current bidirectional state: Bidirectional
Current operational state: Advertisement - Single neighbor detected
Message interval: 15000 ms
Time out interval: 5000 ms

Port fast-hello configuration setting: Disabled
Port fast-hello interval: 0 ms
Port fast-hello operational state: Disabled
Neighbor fast-hello configuration setting: Disabled
Neighbor fast-hello interval: Unknown


    Entry 1
    ---
    Expiration time: 37800 ms
    Cache Device index: 1
    Current neighbor state: Bidirectional
    Device ID: 95XZAGWRDRA
    Port ID: Gi1/1
    Neighbor echo 1 device: 99EADNB89SE
    Neighbor echo 1 port: Gi1/1

    TLV Message interval: 15 sec
    No TLV fast-hello interval
    TLV Time out interval: 5
    TLV CDP Device name: SW4

Wireshark capture between two switches (IOSv /copper links)

Comments

So empty here ... leave a comment!

Leave a Reply

Sidebar