일거리/os2009. 3. 4. 14:40
ethtool -s eth0 autoneg off speed 100 duplex full

vi /etc/sysconfig/network-scripts/ifcfg-eth0

ETHTOOL_OPTS="speed 100 duplex full autoneg off"

 

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

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

# ethtool -s eth0 autoneg off
ethtool -s eth0 autoneg on

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

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

# ethtool -s ethx autoneg off speed 1000 duplex full

ethtool -s eth0 autoneg off speed 100 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 옵션을 사용하면 된다.


Solaris

다음 절차는 네트워크 인터페이스 카드가 자동 협상(autonegotiation)이 설정(ON)되어
있는 상태에서 실행하고 있는 경우 100 MB full duplex 또는  원하는 속도와 모드로
강제 설정하는 방법입니다.

1. 서버에서 확인한 결과, 자동 협상(autonegotiation)이 설정(ON)되어 있다면 100fdx
및 100hdx 옵션 모두가 1(ON)을 여러 번 반환하고 10fdx 및 10hdx도 1을 반환합니다.
따라서 100fdx 또는 1000fdx 변수를 1(ON)로 설정한 경우 다른 설정값은 여전히 활성화된
상태입니다. /etc/rc2.d/S99.. 스크립트가 수행하는 것처럼 다른 모든 옵션을 0으로
설정해야 합니다. 예를 들어 hme 카드의 경우 명령행에서 다음과 같은 순서대로 옵션을
설정해야 합니다.

ndd -set /dev/hme instance 0
ndd -set /dev/hme adv_autoneg_cap 0
ndd -set /dev/hme adv_100T4_cap 0
ndd -set /dev/hme adv_100fdx_cap 1
ndd -set /dev/hme adv_100hdx_cap 0
ndd -set /dev/hme adv_10fdx_cap 0
ndd -set /dev/hme adv_10hdx_cap 0

------------------------------------

ifconfig -a로 LAN Card 확인

- NETWORK Parameter 확인.
====================================
ndd -get /dev/eri adv_autoneg_cap
ndd -get /dev/eri adv_100T4_cap
ndd -get /dev/eri adv_100fdx_cap
ndd -get /dev/eri adv_100hdx_cap
ndd -get /dev/eri adv_10fdx_cap
ndd -get /dev/eri adv_10hdx_cap
==============================
- 수동으로 설정 파일 수정.
@doc[/etc/rc2.d]#vi S97fdx
ndd -set /dev/eri adv_autoneg_cap 0
ndd -set /dev/eri adv_100T4_cap 0
ndd -set /dev/eri adv_100fdx_cap 1
ndd -set /dev/eri adv_100hdx_cap 0
ndd -set /dev/eri adv_10fdx_cap 0
ndd -set /dev/eri adv_10hdx_cap 0

------------------------------------

2. 스위치 측에서 확실한 값을 반환하는 유일한 옵션은 lp_autoneg_cap입니다. 그 외의
모든 옵션의 대부분은 언제나 0을 반환합니다. 예를 들어 아래 모든 옵션은 0을 반환
합니다.

ndd -set /dev/hme instance 0 ndd /dev/hme lp_100fdx_cap ndd /dev/hme lp_100hdx_cap ndd /dev/hme lp_10fdx_cap ndd /dev/hme lp_10fdx_cap

어느 정도 도움이 되는 유일한 옵션은 다음과 같습니다.

ndd /dev/hme lp_autoneg_cap

3. 그러므로 인터페이스 카드와 스위치를 설정한 후 사용할 수 있는 최상의 옵션은
다음과 같습니다.

ndd /dev/hme link_speed (100MB의 경우 1, 10MB의 경우 0) ndd /dev/hme link_mode (full duplex의 경우 1, half duplex의 경우 0)

위 옵션은 통신할 때 사용하고 있는 인터페이스 및 스위치의 속도와 모드를 나타냅니다.


적용 대상:    네트워크 - OS/네트워크 구성, AFO Vertical Team Docs/LAN/WAN/Datacomms
첨부:         (없음)

4. 솔라리스에서 회선이 연결됐는지 확인하는 방법

  while 1
  ? ndd -get /dev/hme link_status
  ? sleep 1
  ? end
5. 패킷 모니터링을 위한 트래픽 덤프 툴 tcpdump
 
  1) eth0 인터페이스로 오고가는 트래픽 정보를 보여줌(-i eth0 옵션없으면 eth0임)
 
  tcpdump
 
  2) 192.128.1.1 host로 오고가는 또는 제외한 트래픽

  tcpdump host 192.128.1.1
  tcpdump src host 192.128.1.1
  tcpdump dst host 192.128.1.1
  tcpdump not host 192.128.1.1

  3) 192.128.1.1과 192.128.1.2 사이를 오고가는 트래픽만

  tcpdump host 192.128.1.1 and 192.128.1.2

  4) ICMP, ARP, UDP 프로토콜만, ICMP 프로토콜 20개만

  tcpdump icmp -i eth0
  tcpdump arp
  tcpdump udp
  tcpdump icmp -c 20

  5) 웹 포트로 오고가는 패킷만

  tcpdump port 80

  6) dhcp 패킷 확인할 때

  # tcpdump -v -s 1500 port 67 or port 68
  tcpdump: listening on eth0
  01:17:16.803166 0.0.0.0.bootpc > 255.255.255.255.bootps: [udp sum ok]
  xid:0x29b28363 vend-rfc1048 DHCP:REQUEST RQ:truefeel
  PR:SM+BR+TZ+DG+DN+NS+HN+YD+YS+NTP [tos 0x10] (ttl 16, id 0, len 328)
  01:17:16.806441 192.168.1.254.bootps > 255.255.255.255.bootpc:
  ... 생략 ...
6. 솔라리스에서 패킷 모니터링

  snoop 
  snoop port 53


'일거리 > os' 카테고리의 다른 글

[OS] ubuntu 에 SVN Sever 설치 및 사용하기  (0) 2009.07.02
[Linux] jfreechart 한글깨찜 현상  (0) 2009.03.04
Posted by 달곰네두목곰