Monday, March 1, 2010

sockinfo -find out which process holds given socket port

AIX Only
# cat /usr/bin/sockinfo
#!/bin/ksh
netstat -Aan | grep "*.$1" | read s1 t1 t2 t3 t4
echo "Socket Address=>$s1"
echo "sockinfo $s1 tcpcb " | kdb | grep "^pvproc" | read pvproc procname active hex1 hex2 rest
echo "Socket occupied by PID=>" $((16#$hex1))

EX:
# sockinfo 8080
Socket Address=>f100020001c64398
Socket occupied by PID=> 258154


or you can use lsof ( Generic AIX/Linux etc best)

Ex: lsof -i :8080
lsof: WARNING: compiled for AIX version 5.1.0.0; this is 5.3.0.0.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 258154 root 76u IPv6 0xf100020001c64398 0t0 TCP *:http-alt (LISTEN)

or
# rmsock f100020001c64398 tcpcb (AIX only)
The socket 0x1c64008 is being held by proccess 258154 (java).

Tuesday, January 26, 2010

Disable Ping on AIX & Linux

Disable Ping on AIX & Linux


I had to disable ping for security concerns. Basically I hid my system from ICMP echo discovery.


on AIX

/usr/sbin/genfilt -v 4  -a 'D' -s '0.0.0.0' -m '0.0.0.0' -d '0.0.0.0' -M '0.0.0.0' -g 'y' -c 'icmp' -o 'any' -p '0' -O 'any' -P '0' -r 'B' -w 'B' -l 'N' -t '0' -i 'all' -D 'echo_request'


Easy way is use smitty ipsec4 ,fill required fields.

don't forget to start

smitty ips4_start


on Linux

echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all (on fly and temporary)



add/comment out  net.ipv4.icmp_echo_ignore_all=1 in /etc/sysctl.conf

Monday, January 25, 2010

AIX LINUX SOLARIS

AIX LINUX SOLARIS















































Task (Device management)

          
AIX                                           


Linux                                    


Solaris                     


HP-UX                           


List devices


llsdev -Cc adapter -spci



for hot plug slots

lsslot -c pci


lsdev (SUSE only)

lspci

dmidecode










Devices  properites


lscfg -vl


hal-device

lshal -l -t

haldaemon should be running for above commands.

dmidecode -t

or
lscfg
lsvpd
Install IBM devloped utils from
http://linux-diag.sourceforge.net/








Finding HBA Info


















List HBA devices



































List WWN number

firmware etc










































lsdev -Cc adapter -spci | grep fcs







































#Micorcode

lsmcode -cd fcs0




lscfg -vl fcs0



#Firmware

lscfg -vl fcs0 | grep Z9









#Driver

lsdev -C -Ftype,name | grep -i fcs

















use fcstat

for speed and link status


systool -c fc_host -A node_name

systool -av -c fc_host



lspci |grep -i -e fib -e hba

















For firmware revision



cat /sys/class/scsi_host/host0/fwrev



For WWN

cat /sys/class/scsi_host/host0/port_name



For drive version

cat /sys/class/scsi_host/host0/lpfc_drvr_version





cat /sys/class/scsi_host/host0/serialnum

cat /sys/class/scsi_host/host0/speed



cat /sys/class/scsi_host/host0/state



systool -p -c fc_host





or

Emulex suppied

lputil



Install lputil.tar from Emulex corp

for QLOGIC use
./ql-dynamic-tgt-lun-disc.sh



luxadm probe

luxadm -e port



















luxadm -e dump_map /devices/ssm@0,0/pci@18,700000/SUNW,qlc@2/fp@0,0:devctl

















Solaris 10



fcinfo hba-port -l





fcinfo remote-port -sl -p <WWN>

for which Luns

are seen by FC adapter.






or

Emulex suppied

lputil



Install lputil.tar from Emulex corp.







































AIX & VIO server quick reference

AIX & VIO server quick reference

AIX
VIO server
Notes
root /root shell
padmin / oem_setup_env (to become root)
padmin logged in to a restricted shell
oslevel
ioslevel

typically mksysb install or through DVD
mysysb / DVD or through HMC (installios)
Installed VIO using mksysb through nim
smitty update
updateios -dev /mnt -install -accept
for updating VIO server
mksysb
backupios -file /mnt/backup (for nim_resources.tar)
backupios -file /mnt/vios_bk.mksysb -mksysb (for mksysb backup)
nim_resources.tar (mksysb,bosinst.data,network boot image and SPOT)
RECOVER_DEVICES=default
NIM AIX 6.1 for VIO 2.1
NIM AIX 5.3 for VIO 1.X
lsdev -c disk
lsdev -dev disk
AIX
lsdev -c disk
hdisk0 Available 0T-08-00-9,0 16 Bit LVD SCSI Disk Drive
hdisk8 Available 0T-08-00-8,0 16 Bit LVD SCSI Disk Drive

VIO
lsdev -dev hdisk11
name status description
hdisk11 Available MPIO Other DS4K Array Disk

lsattr -El devicenamelsdev -dev devicename -attrShows the attributes of the device specified
lscfg -vl devicename
lsdev -dev devicename -vpd
Shows the vital product data
mkdev
mkvdev
 Adds a device to the system
cfgmgr
cfgdev
configures a  newly added device
rmdev -Rdl devicename
rmdev -dev devicename -recursive -ucfgf=
unconfigure and remove devices ,child devices recursively
chdev -l devicname -a <attribute=value>
chdev -dev devicename -attr <attribute=value>
to change device attributes.
mktcpip/smitty mktcpip
smitty chinet
mktcpip
chtcpip