Saturday, 12 September 2015

How to check your NIC (network interface card) mode

Occassionally you'll want to verify that your gigabit network is actually running in gigabit mode.  Or, to futureproof this little post, maybe we're talking about kajigabits.

Anyway, normally there are little mode LEDs on your network hardware that indicate what speed it's operating at.  However, if you aren't in a position to physically see these little lights on the back of your network card or router, or you are but you're too lazy to get off your cushy chair and go look, here are a couple of quick and totally unintuitive ways of examining things using nothing but your trusty shell.

Use mii-tool (as root):
$ mii-tool -v eth0
Look at the 'negotiated' value.  It'll indicate what speed the interface is using.  'FD' means 'Full Duplex'.  'HD' means 'Half Duplex'.  For example, '100baseTx-FD' means 100mbit Full Duplex.

Use tcpdump (as root):
$ tcpdump -v -i eth0 -c 1
Look at what it says for 'link-type', although I'm not convinced this is an accurate method for speed reporting.  But tcpdump is awesome for other stuff, and maybe I just don't know how to interpret what it's saying.

Use dmesg:
$ dmesg | grep eth0
Look for a line similar to one of the following:
eth0: link up, 100Mbps, full-duplex
e1000e: eth0 NIC Link is Up 100 Mbps Full Duplex
It may be that your dmesg buffer doesn't go back far enough to include that.  If so, try one of the other methods.  Or I guess you could cycle the interface down/up, and then peak at dmesg again.

Use ethtool:
$ ethtool eth0
Look for the 'Speed:' value.  Lots of other good info is listed as well.  This technique  is the one that produces the most self-explanatory output, but it probably also the least likely to already be available on your system.


No comments:

Post a Comment