• 패킷과 밀접한 관련이 있는 것이 네트워크 이더넷 카드
  • 네트워크 디바이스 드라이버와 하드웨어 셋팅을 보거나 설정할 수 있는 ethtool 명령어를 잘 알아야함
  • 이더넷 정보를 확인할 때 대표적인 도구가 ifconfig 명령어 → ifconfig 명령어를 통해 링크상태, IP 주소, 맥 주소, 통신 상태 현황 등을 확인 가능
  • ethtool 명령어는 ifconfig 명령어 보다 더 자세하고 섬세하게 이더넷을 설정하고 확인 가능

1. ethtool 명령어 기본 사용 방법

ethtool [옵션] [ethX] [파라미터]



2. ethtool 명령어 기본 정보 → 링크 모드와 속도, Duplex 상태 출력

  • 일목요연하게 이더넷 인터페이스에 대한 정보 확인 가능
    $ ethtool eth0
    Settings for eth0:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full
                           100baseT/Half 100baseT/Full
                           1000baseT/Full
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full
                           100baseT/Half 100baseT/Full
                           1000baseT/Full
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Speed: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: Unknown
    Supports Wake-on: umbg
    Wake-on: d
    Current message level: 0x00000007 (7)
            drv probe link
    Link detected: yes


3. ethtool 명령어에 -s 옵션 사용 → -s 옵션은 속도, Duplex 등의 값을 변경 가능

  • ethtool 명령어에 -s 옵션 사용할 때 설정 참고 자료
    ethtool -s ethX speed N [duplex half|full] [port tp|aui|bnc|mii]
                [autoneg on|off] [advertise N] [phyad N] [xcvr internal|external]
                [wol p|u|m|b|a|g|s|d...]  [sopass xx:yy:zz:aa:bb:cc] [msglvl N |
                msglvl type on|off ...]

  • Auto-negotiation, Speed 및 Duplex를 조정하기 위해서 Auto-negotiation 기능을 Off하고 Speed를 100, Duplex를 half로 설정

    $ ethtool -s eth0 autoneg off speed 100 duplex half
    
    # 설정 변경 반영 확인
    $ ethtool eth0
    Settings for eth0:
    Supported ports: [ TP MII ]
    Supported link modes:   10baseT/Half 10baseT/Full
                           100baseT/Half 100baseT/Full
                           1000baseT/Half 1000baseT/Full
    Supports auto-negotiation: Yes
    Advertised link modes:  Not reported
    Advertised pause frame use: No
    Advertised auto-negotiation: No
    Speed: 100Mb/s
    Duplex: Half
    Port: MII
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: off
    Supports Wake-on: pumbg
    Wake-on: g
    Current message level: 0x00000033 (51)
            drv probe ifdown ifup
    Link detected: yes

  • ※ 참고
    • 참고로 e1000 드라이버를 사용하고 있는데, 설정이 제대로 반영되지 않는 문제 발생 → NIC 드라이버의 특성 (드라이버의 패치가 필요)
    • 다른 컴퓨터에서 사용하고 있는 r8169 드라이버에서는 변경이 잘 이줘짐
    • ethtool 명령어가 안되면 아래의 modprobe 명령어 사용
    • 사용하는 네트워크 인터페이스에 따라 차이가 있을 수 있다는 점을 참고 필요



4. ethtool 명령어 X, modprobe 명령어로 e1000 드라이버 옵션을 설정 가능 → ethtool 명령어 적용 X

  • modprobe 명령어로 e1000 드라이버에 대한 옵션을 아래와 같은 형태로 설정
    modprobe e1000 [<option>=<VAL1>,<VAL2>,...]

  • Duplex 를 0 으로 설정한 예
    $ modprobe e1000 Duplex=0  (0=auto-negotiate, 1=half, 2=full)


5. ethtool 명령어에 -i 옵션 사용 → 드라이버에 대한 정보 확인

  • e1000 드라이버를 사용하고 있고, eeprom 접근이 가능한지 여부 확인
    $ ethtool -i eth0
    driver: e1000
    version: 7.3.21-k8-NAPI
    firmware-version: N/A
    bus-info: 0000:00:03.0
    supports-statistics: yes
    supports-test: yes
    supports-eeprom-access: yes
    supports-register-dump: yes


6. ethtool 명령어에 -S 옵션 사용 → 인터페이스 통계 정보 확인

  • rx,tx 의 패킷 전송 개수, 바이트 정보, 브로드캐스팅 정보들 확인 가능
  • 대문자 S 를 사용했다는 점을 주의 필요
  • 소문자 s 는 설정 할때 사용
    $ ethtool -S eth0
    NIC statistics:
       rx_packets: 10
       tx_packets: 29
       rx_bytes: 2145
       tx_bytes: 4100
       rx_broadcast: 0
       tx_broadcast: 3
       rx_multicast: 0
       tx_multicast: 18
       rx_errors: 0
       tx_errors: 0
       tx_dropped: 0


7. ethtool 명령어에 -a 옵션 사용 → Pause 파라미터에 대한 정보를 출력

  • Auto Negotiation 정보를 좀 더 상세히 출력
    $ ethtool -a eth0
    Pause parameters for eth0:
    Autonegotiate: on
    RX:  on
    TX:  off


8. ethtool 명령어에 -p 옵션 사용 → 특정 포트에 LED를 깜빡

  • 어뎁터가 4개의 포트를 가지고 있다고 가정하고, eth3번이 어떤 포트인지 알고 싶을때 LED 를 깜빡 거리게 하여 알려줌
    $ ethtool -p eth3


9. ethtool 명령어에 -k 옵션 사용 → 디바이스의 Offload 정보 출력

  • Offload는 이더넷 카드에서 TOE 기능을 지원하게 되면 사용할 수 있는 기능
  • TOE
    • NIC(Network Interface Cards)에서 사용되는 기술
    • 보통 운영체제 상에서 처리되는 TCP/IP 스택을 네트워크 컨트롤러로 내려서 처리
    • 네트워크 처리가 크게 필요한 기가비트나 10G 기가비트같은 고속네트워크에서 유용하게 사용
      $ ethtool -k eth0
      Offload parameters for eth0:
      rx-checksumming: on
      tx-checksumming: on
      scatter-gather: on
      tcp-segmentation-offload: on
      udp-fragmentation-offload: off
      generic-segmentation-offload: on
      generic-receive-offload: on
      large-receive-offload: off
      rx-vlan-offload: on
      tx-vlan-offload: on
      ntuple-filters: off
      receive-hashing: off


10. ethtool 명령어 이외에 lshw명려어를 이용해 network 관련한 정보를 확인 가능

  • lshw(Hardware Lister)는 메모리, 펌웨어 버전, 메인보드, CPU, 네트워크, 디스크 등의 정보를 알려주는 명령어
  • -C 옵션은 lshw에서 제공하는 하드웨어 정보 중 원하는 것만 출력
    $ lshw -C network
    *-network              
         description: Ethernet interface
         product: 82540EM Gigabit Ethernet Controller
         vendor: Intel Corporation
         physical id: 3
         bus info: pci@0000:00:03.0
         logical name: eth0
         version: 02
         serial: 08:00[deleted]:d0
         size: 1Gbit/s
         capacity: 1Gbit/s
         width: 32 bits
         clock: 66MHz
         capabilities: pm pcix bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
         configuration: autonegotiation=on broadcast=yes driver=e1000 driverversion=7.3.21-k8-NAPI duplex=full firmware=N/A ip=10.0.2.15 latency=64 link=yes mingnt=255 multicast=yes port=twisted pair speed=1Gbit/s
         resources: irq:10 memory:f0000000-f001ffff ioport:d010(size=8)

+ Recent posts