Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listing ALL IP parameters on all interfaces

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
HI,

Just wanted to have all IP parameters for all interfaces in one window,including the Interface card type and the current selected speed :

Int IP_address Mask DNS Gateway Domain Speed Selected Type
--- ---------- ---- --- ------- ------ -------------- ------
en0 10.4.2.12 10.4.26.1 cil.co.com 100_Full_Duplex 100BT
en1 10.4.2.12 10.4.26.1 cil.co.com none 100BT
en2 10.4.27.77 255.255.254.0 10.4.2.12 10.4.26.1 cil.co.com 100_Full_Duplex 100BT

===================================
The script that does it is below :
===================================
#!/bin/ksh
# Written on 1/7/03
# Updated April 17, 2005
# Version 1.7
# The script displays IP settings on all ent interfaces

printf "%-4s %-15s %-15s %-14s %-14s %-21s %-20s %-8s\n" "Int" "IP_address" "Mask" "DNS" "Gateway" "Domain" "Speed Selected" "Type"
printf "%-4s %-15s %-15s %-14s %-14s %-21s %-20s %-8s\n" "---" "----------" "----" "---" "-------" "------" "--------------" "------"
for EN in `lsdev -Cs pci| awk '/ent/ { print $1 }'|cut -c 1,2,4`;do
mktcpip -S $EN 2>&1|awk -F: '$0 !~ /host/ {printf ("%-4s %-15s %-15s %-14s %-14s %-22s",$4,$2,$3,$5,$7,$6 )}'
ENT=`echo $EN|cut -c 3`
SPEED=`lsattr -El ent$ENT | grep -i speed|awk '{print $2}'`
if [[ -z $SPEED ]] ;then
SPEED="none"
fi
lscfg -v -l ent$ENT|grep -iE "gigabit|10/100/1000" >/dev/null
if [[ $? = 0 ]] ;then
DESCRIPTION=GIGABIT
else
DESCRIPTION=100BT
fi
printf "%-20s %-20s \n" $SPEED $DESCRIPTION
done
exit



Long live king Moshiach !
 
great script. Now can you make it go to other systems and get the info?
the file aixlist is a list of aix systems.

for i in `cat aixlist`
do
{
rsh $i
your script
}>>network.txt
done
pg network.txt
 
you can use pssp (if you have it)
you can use ssh with authentication keys
you can set up a .netrc type file with rlogin

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top