리눅스 NIC 상태 확인 방법

Auto Negotiation OFF시 스피드와 Duplex 모드를 동시에 같이 셋팅 해 주어야 함.


Auto Negotitation Diable 시키는 방법 (일시적)


# ethtool -s eth0 autoneg off


스피드와 duplex를 같이 셋팅하지 않고 위와 같이 명령 내리면, 드라이버가 자동으로 다시 Auto Negotiation을 Enable 시켜 버림.


Auto Negotitation Diable 시키는 방법 (NIC을 죽었다 살리면 다시 auto로 바뀜)


# ethtool -s ethx autoneg off speed 1000 duplex full


ethx에서 x는 이더넷 디바이스 숫자를 의미함. 1Gbps 스피드에 Duplex Mode가 Full-Duplex로 맞춰 주는 것을 의미


Auto Negotitation Diable 시키는 방법 (NIC을 죽었다 살려도 고정으로 하게 하는 방법)


# vi /etc/sysconfig/network-scripts/ifcfg-ethx
ETHTOOL_OPTS=”speed 100 duplex full autoneg off”


ifcfg-ethx에서 x는 이더넷 디바이스 숫자를 의미함. ifcfg-ethx를 vi 에디터를 통해 열고, ETHTOOL_OPTS… 이하 문구를 넣어 주면 NIC을 죽였다 살렸을 때도 고정 시킬 수 있음.


몇몇 카드는 ethtool로 동작 하지 않을 때가 있는데, 이럴 때는 mii-tool 유틸리티를 이용한다.


# ethtool eth0 => eth0 상태 보기
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full


Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: puag
Wake-on: g
Link detected: yes


# mii-tool -v eth0 => eth0 상태 보기
eth1: no autonegotiation, 10baseT-HD, link ok


# mii-tool -F 100BaseTx-FD eth0 => eth0 상태 변경(100BaseTx-HD 등…)
불행하게도 위 옵션도 부팅 되면, 모두 풀려 버려, auto negotiation으로 변경 되어 버린다. 부팅 될 때도 수동으로 동작하게 하려면, /etc/rc.local 파일에
ethtool 문구나 mii-tool 문구를 넣어 준다.


#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don’t
# want to do the full Sys V style init stuff.


ethtool -s eth0 speed 100 duplex full autoneg off
mii-tool -F 100baseTx-FD eth1
touch /var/lock/subsys/local


==============================================================================================
Linux


1. 연결상태 확인


mii-tool을 옵션없이 실행하면 랜카드의 속도, duplex 모드, 연경 상태를 보여주며
-v 옵션을 추가하면 보다 상새한 MII 상태를 볼 수 있다.
root 권한으로 실행해야 합니다.


—————————————————————————————
# mii-tool
eth0: negotiated 100baseTx-FD, link ok ( 100MB, Full Duplex로 autonegotiation됨 )
eth1: no link             ( 연결되어 있지 않음 )
# mii-tool -v
eth0: negotiated 100baseTx-FD, link ok
 product info: Intel 82555 rev 4
 basic mode:  autonegotiation enabled
 basic status: autonegotiation complete, link ok
 capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
 advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
 link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
eth1: no link
 product info: Intel 82555 rev 4
 basic mode:  autonegotiation enabled
 basic status: no link
 capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
 advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
—————————————————————————————


-w 옵션을 사용하면 실시간으로 연결 상태를 확인할 수 있다.
만약 갑자기 no link라고 나온다면 회선에 문제가 생겼거나 연결된 장비간의 회선속도나
duplex 모드가 맞지 않은 경우이다.


—————————————————————————————
# mii-tool -w
08:58:00 eth0: negotiated 100baseTx-FD, link ok
08:58:00 eth1: no link
21:23:11 eth0: no link (연결이 끊긴 상태에서)
21:23:15 eth0: negotiated 100baseTx-FD, link ok (다시 연결됨)
—————————————————————————————


2. 속도 변경


autonegotiation으로 두 장비간의 연결 속도와 duplex 모드를 자동으로 맞추게되지만
제대로 되지 않아 충돌(Late Collision)이 많이 발생하는 경우나 원하는 속도로 변경을
해야할 때 mii-tool은 유용하게 쓰일 수 있다. 다음은 100MB, Full duplex 모드로 변경
하는 예이다.


—————————————————————————————
# mii-tool -F 100baseTx-FD eth0
—————————————————————————————


원래 autonegotiation로 restart하려면 -r 옵션을 사용하면 된다.

발췌: http://yris.thoth.kr/?mid=blog&document_srl=290050

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

페이스북/트위트/구글 계정으로 댓글 가능합니다.