The ifconfig command in Linux (and other Unix-like operating systems) is used to display and configure network interfaces. When you execute the ifconfig command without any arguments, it typically shows information about all active network interfaces on your system. Here’s a breakdown of the data you typically see:
- Interface Name (
eth0,wlan0, etc.): This is the name of the network interface. It could be a physical interface like Ethernet (eth0,eth1, etc.) or a wireless interface (wlan0,wlan1, etc.). - Link encap: This indicates the type of encapsulation method used on the interface, such as Ethernet, Loopback, or Point-to-Point.
- HWaddr (Hardware Address): This is the MAC (Media Access Control) address of the network interface, which uniquely identifies it on the network.
- inet: This shows the IPv4 address assigned to the interface. If the interface is configured with an IPv4 address, you’ll see it listed here.
- inet6: If IPv6 is enabled on the interface, this field will display the IPv6 address assigned to the interface.
- Netmask: This indicates the subnet mask associated with the IPv4 address. It determines the size of the network segment the device is on.
- broadcast: This displays the broadcast address for the network segment the interface is connected to. It’s used for broadcasting messages to all devices on the same network.
- inet6 addr: Similar to the
inetfield, but for IPv6 addresses. - Scope: This indicates the scope of the IP address, whether it’s global, link-local, site-local, etc.
- RX packets/TX packets: These show the number of packets received (RX) and transmitted (TX) by the interface since it was activated or the statistics were last cleared.
- RX bytes/TX bytes: These display the number of bytes received (RX) and transmitted (TX) by the interface.
- MTU: This stands for Maximum Transmission Unit, which is the largest packet size allowed on the interface without fragmentation.
- RX errors/TX errors: These indicate the number of errors encountered while receiving (RX) or transmitting (TX) packets.
- Collisions: This shows the number of collisions detected on the interface. Collisions occur when two devices attempt to transmit data simultaneously on a shared network segment.
The output of ifconfig may vary slightly depending on the version of the tool and the Linux distribution you’re using. Some distributions are moving towards using the ip command instead of ifconfig, as it provides more features and is more powerful.