Saturday, July 22, 2017

▷ AIX network info (네트워크 정보)

[ To find network info ]



   case `uname -s` in
   AIX)
      lsdev -Cc adapter | grep '^ent' | grep Available | awk '{ print $1 }' | while read DEV_NAME
      do
         DEV_MAC=`lscfg -vpl ${DEV_NAME} | grep 'Network Address' | sed -e 's/[.]*[.]/ /' | awk '{ print $NF }' | awk \
            '{for(i=1;i<12;i=i+2) {
                 m=substr($1,i,2);
                 MAC=MAC":"m;
              }
              print MAC;
             }' | sed -e 's/^://'`
         DEV_NAME=`echo ${DEV_NAME} | sed -e 's/ent/en/'`
         # if EtherChannel (Link Aggregation)
         test -z "${DEV_MAC}" && { DEV_MAC=`netstat -ni | grep link | awk '$1=="'${DEV_NAME}'" { print $4 }'`; }
        
         DEV_ADDR=`ifconfig ${DEV_NAME} | awk '$1=="inet" { print $2}' | head -1`
         ...
        
         printf "%s %s %s\n" "${DEV_NAME}" "${DEV_MAC}" "${DEV_ADDR}"
      done
      ;;
 
   *)
      echo "This script must be run on AIX/HP-UX/SunOS/Linux."
      exit 1
      ;;
   esac

No comments:

Post a Comment

◈ Recent Post

▷ UITest demo with TestOne (Mobile, Keypad and Drag until found tip)

[ UITest Demo Environment ] 1. UITest Solution: TestOne 2. Description 데모 설명    How to use keypad, and to drag until found.     키패드를...

◈ Popular Posts