#!/bin/bash
###########################################################################
# script: get_active_nic_settings.sh
# date: 14:30, fri., feb. 22 2008
# author: brad hudson
# description: script to get the ndd settings on active NICs (Sun specific)
###########################################################################
# you have to be root
[[ $UID -ne 0 ]] && {
echo ""
echo "You must be root to run $0!"
echo ""
exit
}
# declare an array of NICs
declare -a INTERFACES
# assign the NICs to the array
INTERFACES=(`ifconfig -a | grep ^[A-Za-z] | awk -F: '{print $1}' | grep -v lo0`)
for ((i=0; i < ${#INTERFACES[@]}; i++)) {
# set some interface specific variables
interface=${INTERFACES[$i]}
int_length=${#INTERFACES[$i]}
instance=${INTERFACES[$i]:$int_length-1}
module=${INTERFACES[$i]:0:$int_length-1}
# set the instance of the module to the current NIC
# account for goofy bge method
if [ "$module" = "bge" ]
then
module="${module}${instance}"
else
ndd -set /dev/$module instance $instance
fi
echo ""
echo "----- $interface settings -----"
# get the module parameters
declare -a MOD_PARMS
MOD_PARMS=(`ndd -get /dev/$module \? | grep -v ^? | awk '{print $1}'`)
for ((x=0; x < ${#MOD_PARMS[@]}; x++)) {
parm_name=${MOD_PARMS[$x]}
parm_setting=`ndd -get /dev/$module $parm_name`
printf "%20s = %s\n" $parm_name $parm_setting
}
unset MOD_PARMS
}
echo"" unset INTERFACES
My blog has moved,please visit the new site
IBM AIX/UNIX system storage administration ksh/perl scripting
Thursday, March 12, 2009
Solaris script(get_active_nic_settings.sh) - bash script to get the ndd settings for all active NICs
Solaris script (get_all_nic_settings.sh) - bash script to get all NIC settings (even unplumbed, but slower).
#!/bin/bash
##########################################################################
# script: get_all_nic_settings.sh
# date: 14:30, thu, mar 13 2008
# author: brad hudson
# description: script to get the ndd settings on all NICs (Sun specific)
##########################################################################
# you have to be root
[[ $UID -ne 0 ]] && {
echo ""
echo "You must be root to run $0!"
echo ""
exit
}
# disclaimer
echo ""
echo "**************************************************"
echo "Disclaimer: unplumb'd NICs are very slow to query!"
echo "**************************************************"
sleep 3
# declare an array of NIC modules
declare -a MODULES
MODULES=(bge ce eri hme qfe)
# loop through the modules to get ndd settings
for ((i=0; i < ${#MODULES[@]}; i++)) {
kstat -m ${MODULES[$i]} > /dev/null 2>&1
if [ $? -eq 0 ]
then
# get all NIC instances for the NIC module
declare -a INSTANCES
INSTANCES=(`kstat -m ${MODULES[$i]} | grep instance: | sort -u | awk '{print $NF}'`)
for ((x=0; x < ${#INSTANCES[@]}; x++)) {
echo ""
# account for non-standard bge method for ndd
if [ "${MODULES[$i]}" = "bge" ]
then
module="${MODULES[$i]}${INSTANCES[$x]}"
echo "***** $module settings *****"
else
module="${MODULES[$i]}"
ndd -set /dev/$module instance ${INSTANCES[$x]}
echo "***** $module${INSTANCES[$x]} settings *****"
fi
# get the module parameters
declare -a MOD_PARMS
MOD_PARMS=(`ndd -get /dev/$module \? | grep -v ^? | awk '{print $1}'`)
for ((z=0; z < ${#MOD_PARMS[@]}; z++)) {
parm_name=${MOD_PARMS[$z]}
parm_setting=`ndd -get /dev/$module $parm_name`
printf "%20s = %s\n" $parm_name $parm_setting
}
unset MOD_PARMS
}
unset INSTANCES
fi
}
echo ""
unset MODULES
Sun BigAdmin Link
Labels
- ACL (1)
- admin (2)
- AIX 5.3 (1)
- AIX 6.1 (3)
- Atape (1)
- backup (5)
- backupios (1)
- Best Practices (1)
- bosboot (1)
- cdrom (1)
- cfgmgr (1)
- commands (4)
- compatibility (1)
- console (1)
- device (2)
- dhcp (1)
- disk (1)
- DNS (2)
- Downloads (1)
- dump (1)
- Dynamic (1)
- error (1)
- errpt (1)
- ESS (1)
- etherchannel (1)
- Filesystem (7)
- firmware (2)
- Freeware (1)
- ftp (2)
- getty (1)
- GNU (1)
- HACMP (2)
- HEA (1)
- HMC (2)
- hostname (1)
- I/O (1)
- Installation (2)
- installp (2)
- IP alias (1)
- iptrace (1)
- iso (2)
- IVM.CLI (1)
- jfs (1)
- JFS to JFS2 conversion (1)
- jfs2 (2)
- kdb (1)
- kernel (1)
- LED (2)
- lifecycle (2)
- Live Partition Mobility (1)
- lofiadm (1)
- login (1)
- LPAR (1)
- lppchk (1)
- lsof (1)
- LV (1)
- lvm (3)
- memory (1)
- migration (4)
- mksysb (2)
- mkvdev (1)
- mkvgdata (1)
- mount (1)
- multibos (1)
- ndd (2)
- netstat (1)
- network (7)
- NFS (2)
- NIC (4)
- NIM (2)
- NPIV (1)
- ODM (2)
- openssh (1)
- oslevel (1)
- patching (1)
- Performance (4)
- Perl (2)
- Perl Module (2)
- permission (1)
- port (1)
- Power VM (1)
- Power5 (1)
- Power6 (1)
- printer (1)
- problem (17)
- process (4)
- RAID5 (1)
- Recovery (2)
- respawn (1)
- restore (1)
- routing (4)
- RSC (1)
- runq (1)
- savevg (1)
- scripts (4)
- SEA (1)
- security (5)
- sendmail (1)
- solaris (7)
- SSA (1)
- SSH (2)
- ssh-agent (1)
- storage (3)
- subnet (1)
- Sun Remote System Control (1)
- support (2)
- synchronize (1)
- TCPIP (5)
- telnet (2)
- time zone (1)
- topas (1)
- Total Storage (1)
- trace (2)
- tuning (1)
- uninstall (1)
- update (1)
- update boot (4)
- upgrade (3)
- users (2)
- Veritas Volume Manager (1)
- VG (1)
- VIOS (4)
- VMM (1)
- VxVM (1)
- wtmp (1)
Blog Archive
-
▼
2010
(14)
-
▼
March
(11)
- My blog has moved to aixmind.com, please visit my ...
- Command Respawning Too Rapidly From init, wtmp Fil...
- How to Apply ACL to New Files Automatically
- How to use netgroups with NFS without NIS
- mkvdev creating SEA adapter generates: 0514-040 Er...
- NIM installation and backup of the VIO server
- Backupios Fails with 0512-008 savevg
- Atape trace log files are filling my /var filesyst...
- IVM CLI Examples to set HEA Attributes on Power Sy...
- Why does the FTP option fail in my updates for HMC...
- NPIV FAQs for Vritual I/O Server Environment
-
▼
March
(11)
