ifconfig
Configure network interfaces
TLDR
View network settings of an interface
Display details of all interfaces, including disabled interfaces
Disable an interface
Enable an interface
Assign an IP address to an interface
SYNOPSIS
ifconfig
ifconfig interface
ifconfig interface options | address ...
PARAMETERS
(no arguments)
Displays information for all active network interfaces configured on the system.
interface
Specifies a particular network interface (e.g., eth0, wlan0) to display its configuration or apply changes to.
up
Activates the specified network interface, making it ready to send and receive network traffic.
down
Deactivates the specified network interface, bringing it offline and preventing it from sending or receiving traffic.
address
Assigns an IP address to the network interface. Can be used in conjunction with netmask and broadcast.
netmask address
Sets the network mask for the interface, defining the network and host portions of the IP address.
broadcast address
Sets the broadcast address for the interface's subnet.
mtu N
Sets the Maximum Transmission Unit (MTU) for the interface to N bytes, which is the largest packet size that can be transmitted.
hw type address
Sets the hardware address (e.g., MAC address) for the interface. Common types include ether for Ethernet interfaces.
add address
Adds an additional IP address (an alias) to the specified interface.
del address
Removes a previously assigned IP address (an alias) from the interface.
txqueuelen N
Sets the length of the transmit queue for the interface. A larger queue can help with bursty traffic but may increase latency.
DESCRIPTION
The ifconfig command is a legacy command-line utility used for network interface configuration on Unix-like operating systems. It allows administrators to configure, view, and control network interfaces. While still found in many systems and scripts, it has largely been superseded by the more powerful and modern ip command from the iproute2 suite on contemporary Linux distributions.
ifconfig can display the current configuration of network interfaces, including IP addresses, netmasks, broadcast addresses, MAC addresses, MTU settings, and I/O statistics. It also provides the functionality to assign IP addresses, set netmasks and broadcast addresses, enable or disable interfaces, change the MTU, and manipulate other interface properties. Despite its age, it remains a common tool for quick network checks or in environments where the ip command is not preferred or available.
CAVEATS
The ifconfig command is considered deprecated on modern Linux systems. It is part of the net-tools package, which is no longer actively developed. Many advanced networking features (e.g., network namespaces, more complex routing policies) are not supported by ifconfig. New installations of Linux distributions often do not include net-tools by default, preferring the iproute2 utilities.
USAGE EXAMPLES
- To display configuration for all active interfaces:
ifconfig - To display configuration for a specific interface (e.g., eth0):
ifconfig eth0 - To bring an interface up and assign an IP address with netmask:
ifconfig eth0 192.168.1.100 netmask 255.255.255.0 up - To change the MTU of an interface:
ifconfig eth0 mtu 1500 - To bring an interface down:
ifconfig eth0 down
PERMISSIONS
Modifying network interface configurations with ifconfig typically requires superuser (root) privileges. Displaying information can often be done by non-root users, though this can vary by system configuration.
HISTORY
ifconfig has a long history, originating from BSD Unix and becoming a standard utility across various Unix-like operating systems. It was the primary tool for network interface management for decades. With the advent of the iproute2 suite in the Linux kernel around the early 2000s, the newer ip command began to replace ifconfig. The iproute2 tools provide a more consistent and powerful way to manage networking, including support for modern features like policy routing, namespaces, and advanced traffic control. Despite its deprecation, ifconfig is still widely encountered in older documentation, scripts, and embedded systems.