| ifconfig | |
|---|---|
Screenshot of ifconfig output in Linux | |
| Initial release | August 1983; 42 years ago (1983-08) |
| Operating system | Unix andUnix-like |
| Type | Command |
ifconfig (short forinterface config) is a system administration utility inUnix-like operating systems fornetwork interface configuration.
The utility is acommand-line interface tool and is also used in the systemstartup scripts of many operating systems. It has features for configuring, controlling, and queryingTCP/IP network interface parameters. Ifconfig originally appeared in4.2BSD as part of theBSD TCP/IP suite.
Many Linux distributions have deprecated ifconfig in favor of tools fromiproute2.
Common uses for ifconfig include setting theIP address andsubnet mask of a network interface and disabling or enabling an interface.[1] At boot time, many Unix-like operating systems initialize their network interfaces withshell scripts that call ifconfig. As an interactive tool, system administrators routinely use the utility to display and analyze network interface parameters. The following two examples show the output of the tool when querying the state of a single active interface each on aLinux-based host (interfaceeth0) and theural0 interface on anOpenBSD installation.
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
ifconfig is also commonly used to change themedium access control (MAC) address of an interface. In this process, the network interface is first disabled (setdown) with the ifconfig command, followed by a MAC change command:
ifconfig wlan0 downifconfig wlan0 hw ether 13:11:20:33:49:66ifconfig wlan0 up
TheBerkeley Software DistributionUNIX operating systems (e.g.,NetBSD,OpenBSD, andFreeBSD) continue active development of ifconfig and extension of its functionality to cover the configuration ofwireless networking interfaces,VLAN trunking, controlling hardware features such asTSO or hardware checksumming or setting up bridge and tunnel interfaces.Solaris has historically used ifconfig for all network interface configuration, but as of Solaris 10 introduced dladm to perform data-link (OSI model layer 2) configuration, reducing ifconfig's purview to IP configuration.
In olderLinux distributions, ifconfig, in conjunction with the utilityroute, was used to connect a computer to a network, and to define routes between networks. ifconfig for Linux is part of the packagenet-tools, released as the latest version 2.10 on 7 January 2021.[2]
Many Linux distributions have deprecated the use of ifconfig and route in favor of the software suiteiproute2, such as ArchLinux[3] or RHEL since version 7,[4] which has been available since 1999 for Linux 2.2.[5] iproute2 includes support for all common functions of ifconfig(8), route(8), arp(8) and netstat(1). It also includes multicast configuration support, tunnel and virtual link management, traffic control, and low-level IPsec configuration, among other features.
Another higher-level Linux command line tool isifup (includingifdown andifquery). In addition to controlling the interfaces, it also provides control of other aspects of the network such as specifying theDNS servers to use. The command is configured using the file/etc/network/interfaces, which contains "stanzas" for each interface.
NetworkManager is a Linux daemon that automatically reconfigures the network in dynamic environments, such as moving between WiFi hotspots. It is usually used in conjunction with a graphical front-end such asGNOME Shell.
Versions ofMicrosoft Windows fromWindows 95 toWindows Me usedwinipcfg to give a graphical display of current IP information.ipconfig, a command similar to ifconfig, comes withMicrosoftoperating-systems based on theWindows NTkernel.ipconfig also controls the WindowsDHCPclient.
InmacOS, the ifconfig command functions as awrapper to the IPConfiguration agent, and can control theBootP and DHCP clients from the command-line. Use of ifconfig to modify network settings in Mac OS X is discouraged, because ifconfig operates below the level of the system frameworks which help manage network configuration.
iwconfig, a component ofWireless tools for Linux, which took its name from ifconfig, manageswireless network interfaces outside the original scope of Linux's ifconfig. iwconfig sets such specialized settings as a wireless network'sSSID andWEP keys, and functions in tandem withiwlist. Linux also featuresiwspy, to read the signal, noise and quality of a wireless connection.
Other related tools for configuring Ethernet adapters are:ethtool,mii-tool, andmii-diag in Linux and the commanddladm show-link in Solaris.
The ip suite has a similar purpose and is meant to replace thedeprecated ifconfig.[6]