How to test an ethernet card

ethernethardware

I have a USB->Ethernet card that may or may not be somehow broken. The problem is I don't really know how to test it. I have a normal Ethernet port as well, so I can hook a (already tested) cable from one to the other, but then what?

I could setup NAT on one interface and try to connect with the other, but that seems a bit excessive as well as possibilities for other problems. I want some way of just sending a raw Ethernet frame and seeing if the other side receives it.

I've looked at netcat a bit, but it works on the TCP/UDP level, while it seems I need to work at the Ethernet frame level.

What would be the best way to test this USB->Ethernet adapter?

Best Answer

For starters you can use the tool ethtool to run your NIC's self tests.

excerpt from man page
 ethtool -t|--test DEVNAME  Execute adapter self test

Example

$ sudo ethtool -t eth0
The test result is PASS
The test extra info:
Register test  (offline)     0
Eeprom test    (offline)     0
Interrupt test (offline)     0
Loopback test  (offline)     0
Link test   (on/offline)     0

Looking at the statistics for the NIC may be useful too in terms of diagnosing your issue further.

$ sudo ethtool -S eth0
NIC statistics:
     rx_packets: 988097069
     tx_packets: 589028032
     rx_bytes: 1291674232357
     tx_bytes: 116257143322
     rx_broadcast: 210375
     tx_broadcast: 34690
     rx_multicast: 69184
     tx_multicast: 179
     rx_errors: 0
     tx_errors: 0
     tx_dropped: 0
     multicast: 69184
     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: 346104
     rx_long_length_errors: 0
     rx_short_length_errors: 0
     rx_align_errors: 0
     tx_tcp_seg_good: 0
     tx_tcp_seg_failed: 0
     rx_flow_control_xon: 56
     rx_flow_control_xoff: 56
     tx_flow_control_xon: 0
     tx_flow_control_xoff: 0
     rx_long_byte_count: 1291674232357
     rx_csum_offload_good: 987406053
     rx_csum_offload_errors: 3730
     rx_header_split: 0
     alloc_rx_buff_failed: 0
     tx_smbus: 0
     rx_smbus: 0
     dropped_smbus: 0
     rx_dma_failed: 0
     tx_dma_failed: 0

Any of the statistics that have the string "error" in them should be zero. If they aren't then I would pursue what may have caused these.

Related Question