본문 바로가기

리눅스

ethtool을 사용하여 랜 카드의 속도 및 전송 모드를 설정하는 방법

728x90

ethtool을 사용하여 랜 카드의 속도 및 전송 모드를 설정하는 방법

1. ethtool 설치

  • CentOS
sudo yum install -y ethtool
  • Ubuntu
sudo apt-get install -y ethtool

2. LAN 카드(Ethernet) 정보 확인

  • Ethernet 카드 정보 확인
lspci -m | grep -i Ethernet
$ lspci -m | grep -i Ethernet
02:00.0 "Ethernet controller" "Broadcom Corporation" "NetXtreme BCM5719 Gigabit Ethernet PCIe" -r01 "Hewlett-Packard Company" "Device 22be"
02:00.1 "Ethernet controller" "Broadcom Corporation" "NetXtreme BCM5719 Gigabit Ethernet PCIe" -r01 "Hewlett-Packard Company" "Device 22be"
02:00.2 "Ethernet controller" "Broadcom Corporation" "NetXtreme BCM5719 Gigabit Ethernet PCIe" -r01 "Hewlett-Packard Company" "Device 22be"
02:00.3 "Ethernet controller" "Broadcom Corporation" "NetXtreme BCM5719 Gigabit Ethernet PCIe" -r01 "Hewlett-Packard Company" "Device 22be"
  • 인터페이스 정보 확인
ethtool -i eno1
$ ethtool -i eno1
driver: tg3
version: 3.137
firmware-version: 5719-v1.45 NCSI v1.3.12.0
bus-info: 0000:02:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

3. ethtool을 이용한 속도 및 전송 모드 설정

3-1 ethtool eno1 설정 확인

ethtool eno1
$ ethtool eno1
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                             100baseT/Half 100baseT/Full 
                                             1000baseT/Full 
        Link partner advertised pause frame use: No
        Link partner advertised auto-negotiation: Yes
        Speed: 10Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: off
        Supports Wake-on: g
        Wake-on: g
        Current message level: 0x000000ff (255)
                               drv probe link timer ifdown ifup rx_err tx_err
        Link detected: yes
  • Supported link modes: 지원 가능한 링크모드(속도와 전송모드)
  • Supports auto-negotiation: 자동협상인식기능 지원여부
728x90

3-2 명령어를 사용하여 속도와 전송 모드를 설정

이더넷 설정 변경(1000baseT/Full, Auto-negotiation 활성화로 설정 변경)

 ethtool -s eno1 speed [10|100|1000] duplex [half|full] autoneg [on|off]
ethtool -s eno1 speed 1000 duplex full autoneg on

** 핑(ping) 끊김 현상 및 ssh 연결 타임아웃(ssh connection timeout) 발생

3-3 ethtool eno1 설정 확인

ethtool eno1
$ ethtool eno1
Settings for eno1:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  1000baseT/Full 
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                             100baseT/Half 100baseT/Full 
                                             1000baseT/Full 
        Link partner advertised pause frame use: No
        Link partner advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: off
        Supports Wake-on: g
        Wake-on: g
        Current message level: 0x000000ff (255)
                               drv probe link timer ifdown ifup rx_err tx_err
        Link detected: yes
ethtool eno1 | egrep "Speed:"
$ ethtool eno1 | egrep "Speed:"
        Speed: 1000Mb/s

3-4 영구적인 설정(선택 사항)

변경한 설정을 영구적으로 유지하려면 네트워크 설정 파일에 해당 ethtool 명령을 추가해야 합니다.

sudo vim /etc/sysconfig/network-scripts/ifcfg-eth0
ETHTOOL_OPTS="speed 1000 duplex full"

저장한 후 시스템을 다시 부팅하면 변경된 설정이 유지됩니다.

 

728x90