내가쓰는리눅스 강좌
26. ethtool 사용하기 speed 와 duplex 변경
Dorori
2009. 11. 23. 00:17
ethtool 을 사용해서 네트워크 포트의 speed duplex autonego 를 조정할 수 있다.
[root@localhost ~]# ethtool eth1
Settings for eth1:
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: No
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: no
[root@localhost ~]# ethtool -s eth1 speed 10 duplex full autoneg on
[root@localhost ~]# ethtool eth1
Settings for eth1:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Full
Advertised auto-negotiation: Yes
Speed: 10Mb/s
Duplex: Half
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: no
여기서 ethtool 은 해당되는 네트워크 포트가 리눅스 커널에서 어떻게 인식되어서 동작하는지를 확인할 수 있다.
위의 방법은 임시로 적용이 된 것이고 OS가 리부팅되면 다시 초기화되어버리므로
아예 /etc/sysconfig/network-scripts 밑에 있는 ifcfg-eth0 파일에 아래 라인을 넣어줘서
OS가 리부팅되도 계속 적용이 되도록 할 수 있다.
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
ETHTOOL_OPTS="speed 100 duplex full autoneg off"
ETHTOOL_OPTS 의 안의 필드를 보면
speed 뒤의 숫자는 100 이면 100M 를 지정하고
1000 이면 1000M 즉 1G 를 정해준다.
네트워크 인터페이스 드라이버에 따라 저 옵션이 적용될 수도, 안 될 수도 있다.
그럴땐 mii-tool 이란 명령어로 되는지 확인 필요.
Duplex 값은 half 와 full 이 있는데 한국말로는 반이중 / 전이중 이런 어려운 용어가 있다.
하지만 Full 이 좋은 것은 당연지사.
마지막의 autoneg 는 auto-nego 를 스위치와 하지 않도록 off 한다는 의미이다.
보통 저렇게 리눅스 서버에서 자동협상 기능을 끈다면 스위치쪽에서도 동일한 speed 와 duplex 를 맞쳐서 사용하는 것이 정석이다.
저 서버에 연결된 상위의 스위치 ( 시스코이든 3COM 이든 ) 에서도 해당 포트에 static 으로 고정되게 speed 와 duplex 를 서버에 설정해준것과 동일하게 맞춰야 한다.