#!/bin/bash
NICLIST=`ifconfig | egrep '^eth[0-9] ' | awk '{ print $1 }'`
for nics in $NICLIST
do
niclink=(`ethtool $nics | awk '/Duplex/ { duplex=$2 }; /Link detected/ { link=$3 }; /Speed/ { speed=$2 } END { print link " " speed " " duplex }'`)
if [ "${niclink[0]}" = "yes" ]; then
speed="${niclink[1]}"
duplex="${niclink[2]}"
fi
printf "%7s %4s %9s %5s\n" $nics ${niclink[0]} $speed $duplex
speed=""
duplex=""
done
Note : Power-1 and UTM-1 There are differences as the nic name changes
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.