ifconfig (short for interface configuration) is a system administration utility in Unix-like operating systems for network interface configuration.

The utility is a command-line interface tool and is also used in the system startup scripts of many operating systems. It has features for configuring, controlling, and querying TCP/IP network interface parameters. ifconfig originally appeared in 4.2BSD as part of the BSD TCP/IP suite.

Many Linux distributions have deprecated ifconfig in favor of the iproute2 tool suite.

Usage

Common uses for ifconfig include setting the IP address and subnet mask of a network interface and disabling or enabling an interface.[1] At boot time, many Unix-like operating systems initialize their network interfaces with shell 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 a Linux-based host (interface eth0) and the ural0 interface on an OpenBSD 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 

Medium access control functions

ifconfig wird häufig auch verwendet, um die MAC-Adresse ( Medium Access Control ) einer Schnittstelle zu ändern. Dabei wird die Netzwerkschnittstelle zunächst mit dem Befehl ifconfig deaktiviert (auf down gesetzt ), gefolgt von einem Befehl zum Ändern der MAC-Adresse:

ifconfig wlan0 down ifconfig wlan0 hw ether 13:11:20:33:49:66 ifconfig wlan0 up 

Veröffentlichungsstatus

Die UNIX -Betriebssysteme der Berkeley Software Distribution (z. B. NetBSD , OpenBSD und FreeBSD ) entwickeln ifconfig aktiv weiter und erweitern dessen Funktionalität, um die Konfiguration von drahtlosen Netzwerkschnittstellen, VLAN- Trunking, die Steuerung von Hardwarefunktionen wie TSO oder Hardware-Prüfsummen sowie die Einrichtung von Bridge- und Tunnel-Schnittstellen abzudecken. Solaris nutzte ifconfig traditionell für die gesamte Netzwerkschnittstellenkonfiguration, führte jedoch mit Solaris 10 dladm für die Datenverbindungsschicht (OSI-Modellschicht 2) ein, wodurch der Anwendungsbereich von ifconfig auf die IP-Konfiguration beschränkt wurde.

In älteren Linux-Distributionen wurde ifconfig zusammen mit dem Dienstprogramm route verwendet, um einen Computer mit einem Netzwerk zu verbinden und Routen zwischen Netzwerken zu definieren. ifconfig für Linux ist Teil des Pakets net-tools , das am 7. Januar 2021 in der Version 2.10 veröffentlicht wurde. [ 2 ]

Viele Linux-Distributionen , wie beispielsweise Arch Linux [ 3 ] oder RHEL seit Version 7 [ 4 ], haben die Verwendung von ifconfig und route zugunsten der Software-Suite iproute2 als veraltet eingestuft. iproute2 ist seit 1999 für Linux 2.2 verfügbar [ 5 ] . iproute2 bietet Unterstützung für alle gängigen Funktionen von ifconfig(8), route(8), arp(8) und netstat(1). Darüber hinaus umfasst es unter anderem Multicast-Konfiguration, Tunnel- und virtuelles Link-Management, Traffic-Control und Low-Level-IPsec-Konfiguration.

Ein weiteres Linux-Befehlszeilentool der höheren Ebene ist ifup (einschließlich ifdown und ifquery ). Neben der Steuerung der Schnittstellen ermöglicht es auch die Kontrolle anderer Netzwerkaspekte, wie beispielsweise die Angabe der zu verwendenden DNS-Server . Der Befehl wird über die Datei /etc/network/interfaces konfiguriert , die Abschnitte für jede Schnittstelle enthält.

NetworkManager ist ein Linux-Daemon, der das Netzwerk in dynamischen Umgebungen, wie beispielsweise beim Wechsel zwischen WLAN-Hotspots, automatisch neu konfiguriert. Er wird üblicherweise in Verbindung mit einer grafischen Benutzeroberfläche wie GNOME Shell verwendet .

Versions of Microsoft Windows from Windows 95 to Windows Me used winipcfg to give a graphical display of current IP information. ipconfig, a command similar to ifconfig, comes with Microsoftoperating-systems based on the Windows NTkernel. ipconfig also controls the Windows DHCPclient.

In macOS, the ifconfig command functions as a wrapper to the IPConfiguration agent, and can control the BootP 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 of Wireless tools for Linux, which took its name from ifconfig, manages wireless network interfaces outside the original scope of Linux's ifconfig. iwconfig sets such specialized settings as a wireless network's SSID and WEP keys, and functions in tandem with iwlist. Linux also features iwspy, to read the signal, noise and quality of a wireless connection.

Other related tools for configuring Ethernet adapters are: ethtool, mii-tool, and mii-diag in Linux and the command dladm show-link in Solaris.

The ip suite has a similar purpose and is meant to replace the deprecated ifconfig.[6]

See also

References

  1. ^"Interface Configuration for IP". Linux Network Administrators Guide. June 2000. Retrieved 12 March 2024.
  2. ^net-tools on SourceForge
  3. ^Gundersen, Tom (8 June 2011). "News: Deprecation of net-tools". Retrieved 28 March 2019.
  4. ^Jonathan Corbet (4 January 2017). "Moving on from net-tools". LWN.net. Retrieved 23 September 2019.
  5. ^Litvak, Michail (6 March 2019). "ip(8) manual page". Retrieved 28 March 2019.
  6. ^Carrigan, Tyler (6 May 2020). "Linux networking: ifconfig versus ip | Enable Sysadmin". Red Hat. Retrieved 2 November 2022.