Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I could get the capacity for the network interface by lshw, but which file in sysfs is this information stored(i.e. which file in /sys/class/net/eth0/device/ directory)?

$ sudo lshw -class network
  *-network               
       description: Ethernet interface
       product: 82579LM Gigabit Network Connection
       vendor: Intel Corporation
       physical id: 19
       bus info: pci@0000:00:19.0
       logical name: eth0
       version: 04
       serial: 3c:97:0e:b4:5c:6a
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=2.3.2-k firmware=0.13-3 latency=0 link=no multicast=yes port=twisted pair
       resources: irq:43 memory:f2500000-f251ffff memory:f253b000-f253bfff ioport:6080(size=32)


$ ls /sys/class/net/eth0/device/
broken_parity_status      d3cold_allowed  enable         local_cpus  net        remove    resource0  subsystem_device
class                     device          firmware_node  modalias    numa_node  rescan    resource1  subsystem_vendor
config                    dma_mask_bits   irq            msi_bus     power      reset     resource2  uevent
consistent_dma_mask_bits  driver          local_cpulist  msi_irqs    ptp        resource  subsystem  vendor
share|improve this question

3 Answers 3

up vote 3 down vote accepted

You're looking in the wrong place.

Look at /sys/class/net/<device>/speed.

share|improve this answer
    
cat: /sys/class/net/wlan0/speed: Invalid argument, how to get the content? –  schemacs Apr 3 at 15:29
    
You didn't ask about wireless interfaces. These have no fixed link speed anyway. –  Michael Hampton Apr 3 at 15:31
    
Yes, I have also found out that. So what's the unit for this file: sudo cat /sys/class/net/eth0/speed gives 100 while lshw shows capacity: 1Gbit/s size: 100Mbit/s.(I wonder where size comes from. sorry this might be another question). –  schemacs Apr 3 at 15:34
    
100 means it's actually running at 100Mbit/sec. –  Michael Hampton Apr 3 at 15:36
    
How could I know the max capacity(not which speed it is now) for this interface? –  schemacs Apr 3 at 16:26

In general, you could find this out using a tool such as strace:

sudo  strace -e trace=file -f -s128  lshw -class network
share|improve this answer
    
You are so nice to tell me how to trace files opened by programs. Thanks. –  schemacs Apr 3 at 15:30

You can check the interface capacity in following ways.

  1. dmesg | grep eth0

  2. mii-tool -v eth0

  3. ethtool eth0

Note:- Change the device name according to yours.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.