Ifconfig
| Company type | Command-line utility |
|---|---|
| Industry | Computer networking software |
| Founded | 1983 (part of 4.2BSD) |
| Headquarters | Unix-like operating systems |
| Products | Network interface configuration and management |
ifconfig—an abbreviation for interface configuration—is a command-line utility used in Unix-like operating systems to manage network interfaces.
This tool plays a crucial role in numerous system startup scripts by enabling configuration, management, and inspection of TCP/IP network interface parameters. Originating in 4.2BSD as part of the BSD TCP/IP implementation, ifconfig has historically been fundamental for network setup.
Despite its longstanding importance, many Linux distributions have phased out ifconfig in favor of more feature-rich utilities provided by the iproute2 package.
Usage
Administrators frequently utilize ifconfig to assign IP addresses and subnet masks to network interfaces, as well as to activate or deactivate them. During system initialization, Unix-like operating systems often execute shell scripts that invoke ifconfig to prepare network interfaces. It is also employed interactively for monitoring and adjusting interface configurations. The following examples demonstrate typical output from an active Ethernet interface (eth0) on Linux and a wireless interface (ural0) on OpenBSD:
eth0 Link encap:Ethernet HWaddr 00:0F:20:CF:8B:42
inet addr:192.168.1.128 Bcast: Mask:255.255.255.192
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2472694671 errors:1 dropped:0 overruns:0 frame:0
TX packets:44641779 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1761467179 (1679.7 Mb) TX bytes:2870928587 (2737.9 Mb)
Interrupt:28
ural0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
lladdr 00:0d:0b:ed:84:fb
media: IEEE802.11 DS2 mode 11b hostap (autoselect mode 11b hostap)
status: active
ieee80211: nwid ARK chan 11 bssid 00:0d:0b:ed:84:fb 100dBm
inet 172.30.50.1 netmask 0xffffff00 broadcast 172.30.50.255
inet6 fe80::20d:bff:feed:84fb%ural0 prefixlen 64 scopeid 0xa
- The term HWaddr refers to the hardware address, also known as the MAC address.
- The txqueuelen value indicates the size of the buffer managed by the network scheduler, quantified by the number of Ethernet frames.
Medium access control functions
A common use case for ifconfig is altering the medium access control (MAC) address of an interface. This process typically requires bringing the interface down, modifying the MAC address, and then reactivating it:
ifconfig wlan0 down ifconfig wlan0 hw ether 13:11:20:33:49:66 ifconfig wlan0 up
Release status
Development of ifconfig continues within Berkeley Software Distribution UNIX variants such as NetBSD, OpenBSD, and FreeBSD, where it has been enhanced to support configuration of wireless network devices, VLAN tagging, hardware capabilities like TSO and checksum offloading, along with bridge and tunnel interfaces. While Solaris traditionally relied on ifconfig for all network setup, it introduced the dladm utility starting with Solaris 10 to manage data-link layer aspects, relegating ifconfig primarily to IP-level configuration.
In legacy Linux distributions, network setup and routing were handled through a combination of ifconfig and the route command. The Linux version of ifconfig is included in the net-tools package, which saw its most recent update in January 2021.
Currently, many Linux distributions have moved away from both ifconfig and route in favor of the more comprehensive iproute2 suite—embraced by distributions like ArchLinux and RHEL from version 7 onwards—which has provided advanced Linux networking support since its introduction in 1999. iproute2 integrates functionalities previously split across ifconfig, route, arp, and netstat, while also offering enhancements such as multicast management, virtual tunnel handling, traffic shaping, and detailed IPsec configuration options.
Related tools
Advanced Linux utilities encompass ifup along with ifdown and ifquery, which facilitate the management of network interfaces and configurations such as DNS servers through the /etc/network/interfaces file.
NetworkManager operates as a Linux background service that automatically adjusts network settings in scenarios like fluctuating WiFi connections, often integrated with graphical interfaces such as GNOME Shell.
From Windows 95 through Windows Me, the utility winipcfg was used to display IP information. In contrast, Windows NT-based editions utilize the command-line tool ipconfig for handling IP configurations and DHCP client management.
On macOS, the ifconfig command serves as an interface to the IPConfiguration agent, managing BootP and DHCP clients via the terminal. Nonetheless, direct network configuration changes through ifconfig are discouraged because higher-level system services oversee these settings.
For wireless configuration on Linux, iwconfig, part of the Wireless tools suite, is employed to adjust wireless-specific options like SSID and WEP keys, often working in conjunction with iwlist. Signal quality monitoring is supported by utilities such as iwspy.
Additional tools for Ethernet device management on Linux include ethtool, mii-tool, and mii-diag, while Solaris uses dladm show-link for similar purposes.
The ip suite is designed to supersede the obsolete ifconfig, providing a more comprehensive approach to network configuration.
See also
External links
- ifconfig(8), official Linux net-tools ifconfig manual
- ifconfig(8), FreeBSD ifconfig manual page
- ifconfig(8), Solaris ifconfig manual page