Ethtool

ethtool is the primary means in Linux kernel-based operating systems (primarily Linux and Android) for displaying and modifying the parameters of network interface controllers (NICs) and their associated device driver software from application programs running in userspace.

ethtool consists of two components, an API within the Linux kernel through which NICs can send and receive parameters through their device driver software, and a userspace API based on the Linux SIOCETHTOOL ioctl mechanism through which application programs can communicate with the kernel to send and receive NIC and NIC driver parameters.

Most Linux distributions provide a standard utility program called ethtool that can be used from a shell to control, or gather information from NICs using the ethtool userspace API. In the Information technology community, the term ethtool is usually used to refer to this utility program.

The ethtool userspace API can be accessed from programs written in the C and C++ programming languages through the C standard library or C++ standard library respectively.

Several scripting languages such as Perl and Python provide ethtool API bindings that allow programmers using these languages to write scripts that can control NIC's.

The macOS and FreeBSD operating systems provide utility programs that have a user interface similar to the Linux ethtool utility, but that use fundamentally different APIs to communicate with their operating system kernels and NIC's.

Usage
The command is useful for:
 * Identification and diagnosis of Ethernet devices
 * Extended Ethernet devices statistics
 * Control speed, duplex, autonegotiation and flow control for Ethernet devices
 * Control checksum offload and other hardware offload features, such as large receive offload and large send offload
 * Control DMA ring sizes and interrupt moderation
 * Control receive queue selection for multiqueue devices
 * Upgrade firmware in flash memory

Examples
To display the current parameters of the first network port (eth0):

To configure it with the 1000 Mb/s speed and duplex, in 1000BASE-T:

To let the link light of the device eth0 flash for two minutes: To print the driver info of the interface eth0:

mii-tool
mii-tool is an older program performing a similar function to ethtool. Since 2003, it's considered obsolete and replaced by ethtool.

Example
To display the current parameters: To force the network speed to 1 Gbit/s, and the duplex in full on the port 1 (eth0):