메뉴 닫기

ethtool 옵션 정리

ethtool은 Linux에서 네트워크 인터페이스의 하드웨어적인 설정값을 확인하거나 변경할 수 있는 명령어이다.

자주 쓰이는 명령어지만 다른 옵션등을 정리하기 위한 글이다.

  • 명령어 형식
    # ethtool [옵션] [인터페이스명] [파라미터]
옵션설명
-i드라이버 정보
-a자세한 auto negotiation 정보
-kNetwork Device Offload 정보
-K-k 옵션으로 조회한 Offload 설정 정보를 변경
-pNIC 포트 점등(어떤 포트인지 확인할 때)
-s설정 값 변경
-S인터페이스 통계 정보
-g인터페이스의 ring buffer size 확인
-G인터페이스의 ring buffer 설정 값 변경

현재 사용중인 kali VM 인터페이스 상태는 아래와 같다. eth0이 동작중이고 IP는 192.168.56.127을 쓰고 있다.

└─# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.127  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::a00:27ff:feb3:b86c  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:b3:b8:6c  txqueuelen 1000  (Ethernet)
        RX packets 538  bytes 87369 (85.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 161  bytes 30286 (29.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

1. ethtool [포트명]
– ethtool [인터페이스명] 을 입력하면 기본적인 정보를 알 수 있다.

└─# ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]    // interface card의 지원하는 port type (TP : Twisted pair / FIBER : Optical fiber)
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full   // 지원하는 Link 속도 1000BaseT Full Duplex까지 지원한다
        Supported pause frame use: No      // pause frame 지원 여부(pause frame은 Full Duplex에서의 Flow Control 관련된 패킷이다)
        Supports auto-negotiation: Yes     // 자동협상 기능 지원 여부(Speed, Duplex를 자동으로 협상)
        Supported FEC modes: Not reported    // FEC(Forward Error Correction) 지원 여부
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: 1000Mb/s         // Speed 정보(현재 설정은 1000M/s (1G))
        Duplex: Full            // Duplex 정보(Half or Full)
        Auto-negotiation: on    // 자동협상 기능 사용
        Port: Twisted Pair      // Port의 물리적인 타입
        PHYAD: 0
        Transceiver: internal
        MDI-X: off (auto)
        Supports Wake-on: umbg
        Wake-on: d
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes        // 물리적인 링크 연결상태

2. ethtool -i [포트명]
– i 옵션은 인터페이스가 사용하고 있는 드라이버에 대한 정보와 bus, 인터페이스에서 지원하는 옵션들을 확인할 수 있다.
현재 eth0에서 사용하는 드라이버는 e1000이고 드라이버 버전은 7.3.21-k8-NAPI이다.
Linux에서 bus에 관련된 내용은 lshw -c network -businfo 로도 확인할 수 있다.

└─# ethtool -i eth0
driver: e1000
version: 5.10.0-kali7-amd64
firmware-version:
expansion-rom-version:
bus-info: 0000:00:03.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

3. ethtool -a [포트명]
-a 옵션은 auto-negotiation에 관한 자세한 내용을 보여준다.

└─# ethtool -a eth0
Pause parameters for eth0:
Autonegotiate:  on
RX:             on
TX:             off

4. ethtool -k [포트명]

-k 옵션은 인터페이스의 Offload 정보를 보여준다.

└─# ethtool -k eth0
Features for eth0:
rx-checksumming: off
tx-checksumming: on
        tx-checksum-ipv4: off [fixed]
        tx-checksum-ip-generic: on
        tx-checksum-ipv6: off [fixed]
        tx-checksum-fcoe-crc: off [fixed]
        tx-checksum-sctp: off [fixed]
scatter-gather: on
        tx-scatter-gather: on
        tx-scatter-gather-fraglist: off [fixed]
tcp-segmentation-offload: on
        tx-tcp-segmentation: on
        tx-tcp-ecn-segmentation: off [fixed]
        tx-tcp-mangleid-segmentation: off
        tx-tcp6-segmentation: off [fixed]
generic-segmentation-offload: on
generic-receive-offload: on
large-receive-offload: off [fixed]
rx-vlan-offload: on
tx-vlan-offload: on [fixed]
ntuple-filters: off [fixed]
receive-hashing: off [fixed]
highdma: off [fixed]
rx-vlan-filter: on [fixed]
vlan-challenged: off [fixed]
tx-lockless: off [fixed]
netns-local: off [fixed]
tx-gso-robust: off [fixed]
tx-fcoe-segmentation: off [fixed]
tx-gre-segmentation: off [fixed]
tx-gre-csum-segmentation: off [fixed]
tx-ipxip4-segmentation: off [fixed]
tx-ipxip6-segmentation: off [fixed]
tx-udp_tnl-segmentation: off [fixed]
tx-udp_tnl-csum-segmentation: off [fixed]
tx-gso-partial: off [fixed]
tx-tunnel-remcsum-segmentation: off [fixed]
tx-sctp-segmentation: off [fixed]
tx-esp-segmentation: off [fixed]
tx-udp-segmentation: off [fixed]
tx-gso-list: off [fixed]
fcoe-mtu: off [fixed]
tx-nocache-copy: off
loopback: off [fixed]
rx-fcs: off
rx-all: off
tx-vlan-stag-hw-insert: off [fixed]
rx-vlan-stag-hw-parse: off [fixed]
rx-vlan-stag-filter: off [fixed]
l2-fwd-offload: off [fixed]
hw-tc-offload: off [fixed]
esp-hw-offload: off [fixed]
esp-tx-csum-hw-offload: off [fixed]
rx-udp_tunnel-port-offload: off [fixed]
tls-hw-tx-offload: off [fixed]
tls-hw-rx-offload: off [fixed]
rx-gro-hw: off [fixed]
tls-hw-record: off [fixed]
rx-gro-list: off
macsec-hw-offload: off [fixed]

5. ethtool -K [포트명] [옵션] [on/off]

-K 옵션은 -k 옵션으로 확인한 checksum offload 값을 변경할 수 있다. 아래는 tx-checksumming 옵션을 on->off 시킨 예제

└─# ethtool -k eth0 | grep tx-checksumming
tx-checksumming: off

6. ethtool -p [포트명]

-p 옵션은 입력한 포트명이 실제 어떤 물리적인 포트와 매핑되는지 확인할 수 있게 LED를 점등해준다.
(ex. eth2번이 실제 물리적인 포트위치가 어디인지 헷갈리는 경우 ethtool -p eth2를 입력해 eth2번이 실제 어느포트인지 확인할 수 있다)

7. ethtool -s [포트명]

-s 옵션은 인터페이스에 설정된 파라미터 값을 변경할 수 있습니다.

8. ethtool -S [포트명]

-S 옵션은 (statistics)의 약자로 인터페이스로 인입되는 패킷들에 대한 통계치(수신,발신,에러,드랍 등)를 보여준다.

└─# ethtool -S eth0
NIC statistics:
     rx_packets: 763
     tx_packets: 260
     rx_bytes: 116693
     tx_bytes: 41620
     rx_broadcast: 486
     tx_broadcast: 2
     rx_multicast: 0
     tx_multicast: 17
     rx_errors: 0
     tx_errors: 0
     tx_dropped: 0
     multicast: 0
     collisions: 0
     rx_length_errors: 0
     rx_over_errors: 0
     rx_crc_errors: 0
     rx_frame_errors: 0
     rx_no_buffer_count: 0
     rx_missed_errors: 0
     tx_aborted_errors: 0
     tx_carrier_errors: 0
     tx_fifo_errors: 0
     tx_heartbeat_errors: 0
     tx_window_errors: 0
     tx_abort_late_coll: 0
     tx_deferred_ok: 0
     tx_single_coll_ok: 0
     tx_multi_coll_ok: 0
     tx_timeout_count: 0
     tx_restart_queue: 0
     rx_long_length_errors: 0
     rx_short_length_errors: 0
     rx_align_errors: 0
     tx_tcp_seg_good: 1
     tx_tcp_seg_failed: 0
     rx_flow_control_xon: 0
     rx_flow_control_xoff: 0
     tx_flow_control_xon: 0
     tx_flow_control_xoff: 0
     rx_long_byte_count: 116693
     rx_csum_offload_good: 0
     rx_csum_offload_errors: 0
     alloc_rx_buff_failed: 0
     tx_smbus: 0
     rx_smbus: 0
     dropped_smbus: 0

9. ethtool -g [포트명]

-g 옵션은 인터페이스의 ring 매개변수 값을 확인할 수 있습니다. 지원 가능한 최대 사이즈와 현재 장치에 설정된 설정 값을 확인할 수 있습니다. ring buffer는 물리적인 이더넷카드의 버퍼라고 생각하면 되고 해당 buffer 사이즈가 작을 경우에 병목 현상이 발생할 수도 있습니다.

└─# ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX:             4096
RX Mini:        n/a
RX Jumbo:       n/a
TX:             4096
Current hardware settings:
RX:             256
RX Mini:        n/a
RX Jumbo:       n/a
TX:             256

10. ethtool -G [포트명] [rx/tx] [size]

-G 옵션은 -g 옵션으로 확인한 인터페이스의 ring buffer 사이즈를 변경할 수 있습니다. kali vm에서는 현재 256으로 설정되어 있고 최대 4096까지 지원합니다.

5 1 vote
Article Rating
구독
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x