Skip to content

Instantly share code, notes, and snippets.

@netaviator
Created March 1, 2022 19:34
Show Gist options
  • Select an option

  • Save netaviator/02d66ffc6294cb6cca52b3b2ef88be99 to your computer and use it in GitHub Desktop.

Select an option

Save netaviator/02d66ffc6294cb6cca52b3b2ef88be99 to your computer and use it in GitHub Desktop.

Revisions

  1. netaviator created this gist Mar 1, 2022.
    15 changes: 15 additions & 0 deletions nic_lldp_link-state.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/bin/bash
    echo "Write special configurations onto Intel NICs."
    echo "Search for ensXfX devices and apply settings..."
    for iface in $(ip link list | cut -d ' ' -f2 | tr ':' '\n' | awk NF)
    do
    if [[ "$iface" =~ ^ens[0-9]f[0-9]$ ]]; then
    echo $iface

    echo "Disable LLDP..."
    /usr/sbin/ethtool --set-priv-flags $iface disable-fw-lldp on

    echo "Enable link down on close..."
    /usr/sbin/ethtool --set-priv-flags $iface link-down-on-close on
    fi
    done