Linux/Ubuntu
ethtool - 리눅스에서 네트워크 링크 상태 / 속도 확인하기
구차니
2011. 12. 11. 21:03
물론 socket을 건드려야 해서 root 권한으로 해야만 원하는 값을 얻을수 있다.
[링크 : http://www.cyberciti.biz/faq/howto-setup-linux-lan-card-find-out-full-duplex-half-speed-or-mode/]
아래는 C 코드로 작성한 링크 속도 확인방법
[링크 : http://stackoverflow.com/questions/2872058/get-link-speed-programmatically]
| $ ethtool eth0
Settings for eth0:
Cannot get device settings: Operation not permitted
Cannot get wake-on-lan settings: Operation not permitted
Current message level: 0x000000ff (255)
Cannot get link status: Operation not permitted
$ sudo ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Link partner advertised link modes: Not reported
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: No
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: pg
Wake-on: d
Current message level: 0x000000ff (255)
Link detected: yes |
[링크 : http://www.cyberciti.biz/faq/howto-setup-linux-lan-card-find-out-full-duplex-half-speed-or-mode/]
아래는 C 코드로 작성한 링크 속도 확인방법
[링크 : http://stackoverflow.com/questions/2872058/get-link-speed-programmatically]