Wednesday, July 26, 2017

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

[ To find network info ]


   Linux)
      ip link | egrep -v 'lo:|loopback' | awk \
         'BEGIN { i=0; }
          {if($1 ~ /^[0-9]*:/) { DEV_NAME=$2; i++ }}
          i==0 { next; }
          {if($1=="link/ether") { DEV_MAC=$2; i++ }}
          i==2 { printf("%s %s\n", DEV_NAME, DEV_MAC); i=0 }
         ' | sed -e 's/: / /'
   
      ...
      do
         ip -4 addr | grep 'inet'
     
         # if it is a related interface
         if [ -d /proc/net/bonding ]
         then
            cd /proc/net/bonding; : > /tmp/dummy
            DEV_ADDR=`grep -w ${DEV_NAME} * /tmp/dummy 2> /dev/null | head -1 | tr ':' ' ' | awk '$NF=="'${DEV_NAME}'" { print "(Related="$1")"; }'`
         fi
         ...
      done
      ;;

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