System Story/CentOS 5,6
모든 네트워크 인터페이스를 기준으로 Link 활성화 대상 찾기
helperchoi
2013. 11. 10. 18:23
Linux OS상에 인식된 Ethernet Device 에 대하여 Speed와 Link 여부를 아래와 같은 명령으로 확인 가능하다.
[root@TEST01 ~]# [root@TEST01 ~]# for LIST in `ip addr | grep -w mtu | cut -d ":" -f 2 | egrep -v 'lo|inet|virbr'`; do echo "${LIST} - `ethtool ${LIST} | egrep 'Speed|Link detected'`" && echo; done
eth0 - Speed: Unknown! Link detected: no
eth1 - Speed: 10000Mb/s Link detected: yes
eth2 - Speed: 10000Mb/s Link detected: yes
eth3 - Speed: 10000Mb/s Link detected: yes
eth4 - Speed: Unknown! Link detected: no
eth5 - Speed: Unknown! Link detected: no
eth6 - Speed: Unknown! Link detected: no
eth7 - Speed: Unknown! Link detected: no
bond0 - Speed: 10000Mb/s Link detected: yes
bond1 - Speed: 10000Mb/s Link detected: yes
[root@TEST01 ~]#
[root@TEST01 ~]# [root@TEST01 ~]# |
만약 ifcfg script 설정에 HWADDR 를 별도 정의하는 문제로 인해 인식된 Ethernet 별 HW Macaddress 조회가 필요하다면 아래와 같이 가능하다.
[root@node02 ~]# [root@node02 ~]# for LIST in `find /sys/devices/ -type l | grep "eth"`; do echo "`echo ${LIST} | cut -d "/" -f 6` - `cat ${LIST}/address` - `cat ${LIST}/operstate`"; done net:eth0 - 08:00:27:5b:68:66 - up [root@node02 ~]# [root@node02 ~]# |