Last active
December 7, 2016 12:17
-
-
Save prestelpirate/2980da57cdfa90b0a8d1017bb00669e0 to your computer and use it in GitHub Desktop.
kstat can return a lot of useful information about the state of your ethernet interfaces. However, the syntax can be confusing and difficult to remember. This script functions as a wrapper around kstat – tell it the interface type and instance number, and it will return configuration details. It’s important to note that older cards, like hme, wi…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ksh | |
# See http://www.gaeltd.com/scripts-and-tools/ for more details | |
# 2004-01-20 Tom Kranz (tom@siliconbunny.com) | |
# This script is distributed under the GNU Public License (GPL) with the | |
# following extra conditions: | |
# - attritbution must be maintained | |
# - CD-ROM or similar media for commercial distribution without the prior | |
# approval of the author | |
# This script is a nice wrapper for kstat, giving us some nice output about | |
# settings for a specified nic and instance | |
# Make sure we got our command line args | |
if [[ ${1} == "" ]] || [[ ${2} == "" ]] | |
then | |
echo "" | |
echo "Usage:" | |
echo "kstat_check.ksh <interface> <instance number>" | |
echo "" | |
echo "eg. kstat_check.ksh ce 0" | |
echo "" | |
exit 1 | |
fi | |
# Path to kstat | |
KSTAT=/usr/bin/kstat | |
echo "" | |
# What is possible with this nic instance? | |
echo "Port capabilities for ${1} instance ${2}" | |
${KSTAT} -p ${1}:${2}::"/^cap_/" | |
echo "" | |
# What is actually set for this nic instance? | |
echo "Current settings in effect for ${1} instance ${2}" | |
${KSTAT} -p ${1}:${2}::"/^link_/" | |
echo "" | |
# What can our link partner do? | |
echo "Link partner capabilities for ${1} instance ${2}" | |
${KSTAT} -p ${1}:${2}::"/^lp_cap_/" | |
echo "" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment