Linux,Unix,BSD

[linux] 연결된 링크의 속도 확인하는 방법

채윤아빠 2024. 6. 13. 14:08
728x90
반응형

인터넷과 연결된 링크의 속도를 확인하는 방법들을 정리해 둡니다.

"ip" 명령

현장치에 존재하는 모든 링크 및 어댑터 정보를 확인할 수 있습니니다. ("address" 옵션 이용)

nvidia@nvidia-Z790-AORUS-ELITE:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 10:ff:e0:2c:37:17 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.209/24 brd 192.168.0.255 scope global dynamic noprefixroute enp4s0
       valid_lft 7050sec preferred_lft 7050sec
    inet6 fe80::542:f549:db38:7ddf/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:53:43:46:29 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever

"enp4s0" 어댑터와 연결된 링크에 대한 속도를 확인해 보도록 하겠습니다.


dmesg 시스템 메시지 검색

dmesg 시스템 메시지에서 "enp4s0" 어댑터로 검색한 결과입니다.

nvidia@nvidia-Z790-AORUS-ELITE:~$ sudo dmesggrep enp4s0
[    2.898868] r8169 0000:04:00.0 enp4s0: renamed from eth0
[    5.427609] r8169 0000:04:00.0 enp4s0: Link is Down
[  171.472601] r8169 0000:04:00.0 enp4s0: Link is Up - 100Mbps/Full (downshifted) - flow control rx/tx
[  177.503551] r8169 0000:04:00.0 enp4s0: NETDEV WATCHDOG: CPU: 11: transmit queue 0 timed out 6016 ms

링크의 속도가 "100Mbps/Full"임을 확인할 수 있습니다.


시스템 파일을 통한 확인

다음과 같이 링크를 구성하는 어댑터에 대한 "speed" 파일을 확인하면 됩니다.

다음은 "enp4s0" 어댑터에 대한 링크 속도를 확인하는 예제입니다.

nvidia@nvidia-Z790-AORUS-ELITE:~$ cat /sys/class/net/enp4s0/speed
100

"mii-tool"

"mii-tool"을 이용하면 링크의 속도를 확인할 수 있습니다.

nvidia@nvidia-Z790-AORUS-ELITE:~$ sudo mii-tool enp4s0
enp4s0: negotiated 100baseTx-FD flow-control, link ok

ethtool

"ethtool" 명령을 이용하면 어뎁터에 대한 상세한 정보를 확인할 수 있습니다.

nvidia@nvidia-Z790-AORUS-ELITE:~$ sudo ethtool enp4s0
[sudo] password for nvidia:
Settings for enp4s0:
        Supported ports: [ TP    MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
                                2500baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
                                2500baseT/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Full
        Link partner advertised pause frame use: Symmetric
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 100Mb/s
        Duplex: Full
        Auto-negotiation: on
        master-slave cfg: preferred slave
        master-slave status: slave
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: external
        MDI-X: Unknown
        Supports Wake-on: pumbg
        Wake-on: g
        Link detected: yes

연결된 링크의 속도는 "Speed"로 검색하면 "Speed: 100Mb/s" 임을 확인할 수 있습니다.

nvidia@nvidia-Z790-AORUS-ELITE:~$ sudo ethtool enp4s0grep Speed
        Speed: 100Mb/s

networkctl

"networkctl" 명령을 이용하면 어댑터 및 링크에 대한 상세한 정보를 확인할 수 있습니다.

nvidia@nvidia-Z790-AORUS-ELITE:~$ networkctl status enp4s0
systemd-networkd is not running, output might be incomplete.
Failed to query link bit rates: Unit dbus-org.freedesktop.network1.service not found.
Failed to query link DHCP leases: Unit dbus-org.freedesktop.network1.service not found.
● 2: enp4s0
                   Link File: /run/systemd/network/10-netplan-NM-c72f2595-3d6e-32f5-9bad-98adbe9641c2.link
                Network File: n/a
                       State: n/a (unmanaged)
                Online state: unknown
                        Type: ether
                        Path: pci-0000:04:00.0
                      Driver: r8169
                      Vendor: Realtek Semiconductor Co., Ltd.
                       Model: RTL8125 2.5GbE Controller
            Hardware Address: 10:ff:e0:2c:37:17 (GIGA-BYTE TECHNOLOGY CO.,LTD.)
                         MTU: 1500 (min: 68, max: 9194)
                       QDisc: fq_codel
IPv6 Address Generation Mode: none
    Number of Queues (Tx/Rx): 1/1
            Auto negotiation: yes
                       Speed: 100Mbps
                      Duplex: full
                        Port: tp
                     Address: 192.168.0.209
                              fe80::542:f549:db38:7ddf
                     Gateway: 192.168.0.1

Oct 15 17:35:59 nvidia-Z790-AORUS-ELITE systemd-resolved[1083]: enp4s0: Bus client set default route setting: yes
Oct 15 17:35:59 nvidia-Z790-AORUS-ELITE systemd-resolved[1083]: enp4s0: Bus client set DNS server list to: 210.94.0.73