ifconfig

Why Trust Techopedia

What is ifconfig?

Ifconfig (interface configuration) is a command-line utility used to retrieve, display, and configure network interfaces on machines running Unix-like operating systems, including Linux, macOS, and BSD. On Windows, the command for displaying and configuring network-related information is ‘ipconfig’.  

Advertisements

Ifconfig is used to retrieve and display information about the system’s network interfaces, providing a way to configure details like IP addresses, network masks, broadcast addresses, and other parameters.

Ifconfig is a deprecated command. Deprecated commands are often removed from an operating system because they are outdated or pose a security risk. Ifconfig has been replaced with newer by the ip command, part of the Linux iproute2 collection of utilities for controlling TCP / IP networking and traffic control in Linux.

Despite its depreciation, ifconfig can still be installed on some Linux distributions, as shown in this LinuxConfig tutorial. However, it is highly recommended that newer utilities be used.

Techopedia Explains the ifconfig Meaning

Techopedia Explains the ifconfig Meaning

Ifconfig is used to display and configure network interfaces on systems running Linux and related operating systems. It allows users to configure a variety of network parameters, like IP addresses and network masks. Ifconfig has been replaced with a newer tool called ‘ip’, which offers more advanced features and better control.

How Does ifconfig Work?

When the command is run without any arguments (‘ifconfig’), it will display information about all active network interfaces. 

How Does ifconfig Work?
Source: Help Desk Geek

Detailed information about a specific interface can be displayed by providing the interface name as an argument. For example, ‘ifconfig eth1‘ will display detailed information about the “eth1″ network interface, providing information like IP address, MAC address, and other network configuration settings.

The ifconfig command is also used to configure network interfaces. For example, the following command would be used to deactivate the “eth1” interface: ‘sudo ifconfig eth1 down’.

When modifying network configurations, use ‘sudo’, as these changes require administrator privileges.

Starting ifconfig

  • Open a terminal or command prompt
  • Type ‘ifconfig’ and press Enter

Since ifconfig is a command-line tool, users will need to open a terminal or command prompt on the system. On Linux, you can find a terminal in your applications menu or use a keyboard shortcut like Ctrl + Alt + T.  

Once the terminal or command prompt is open, type ‘ifconfig’ and press Enter to display information about all active network interfaces on the system.

Configuring Networks with ifconfig

One common use of ifconfig is to retrieve and display detailed information about the system network interfaces. This includes:

  • IP addresses
  • MAC (Media Access Control) addresses
  • Network masks
  • Statistics about data transmission

The tool also provides a way to configure aspects of the network, such as enabling or disabling network connectivity, changing the MAC address of a network interface, or capturing and analyzing network traffic.

ifconfig Commands

In the following examples, ifconfig commands “eth1” would be replaced with the actual name of your network interface.

ifconfig

Display information for all active network interfaces

ifconfig -a

Display detailed information about all interfaces (including inactive ones)

ifconfig eth1

Display information for a specific interface  (e.g. eth1)

ifconfig -v eth1

Display information for a specific interface with more details  (e.g. eth1)

sudo ifconfig eth1 up

Activate a specific network interface (e.g. eth1)

sudo ifconfig eth1 down

Deactivate a specific network interface (e.g. eth1)

sudo ifconfig eth1 192.168.1.2 netmask 255.255.255.0

Set the IP address of an interface (e.g., eth1)

sudo ifconfig eth1 hw ether 00:11:22:33:44:55

Change the MAC address of an interface (e.g., eth1)

sudo ifconfig eth1 192.168.1.2 netmask 255.255.255.0 up

Change both IP address and netmask of an interface (e.g., eth1)

This IBM guide offers additional examples of ifconfig syntax, flags, and parameters

ipconfig vs. ifconfig

ipconfigifconfig
  • The command used on Windows operating systems
  • Used to display and manage IP configuration information
  • Example syntax and options: ‘ipconfig’  ‘ipconfig /release’  ‘ipconfig /renew’

  • Command used on Unix-like operating systems (Linux, BSD, macOS)
  • Display and configure information about network interfaces
  • Example syntax and options: ‘ifconfig eth0’ ‘ifconfig eth0 up’ ‘ifconfig eth0 down’

Uses of ifconfig

Common uses of ifconfig include the following:

  • Activate/Deactivate Interfaces
  • Adjust MTU (Maximum Transmission Unit)
  • Change MAC Addresses
  • Check Interface Statistics
  • Configure VLAN (Virtual LAN) Interfaces
  • Display Interface Information
  • Enable/Disable Broadcast Mode
  • Enable/Disable Multicast Mode

Examples Using ifconfig Command

Examples using “eth1” as the network interface name:

Command  Description
ifconfig Display information for active network interfaces.
ifconfig eth1 Display information for a specific interface.
sudo ifconfig eth1 up Activate a specific network interface.
sudo ifconfig eth1 192.168.1.2 netmask 255.255.255.0 Set the IP address of an interface.

The Bottom Line

Ifconfig serves as a flexible command-line tool for managing network interfaces on Linux. It is used to retrieve and display detailed information about the system’s network interfaces and offers a good amount of network configuration options for users.

It’s important to remember that ifconfig is deprecated (March 2009) and has been largely replaced by the ip command – part of the Linux iproute2 collection of networking utilities.

FAQs

What is ifconfig in simple terms?

How to check IP address in Linux?

Why use ifconfig instead of ipconfig?

Does ifconfig work in Windows?

Advertisements

Related Questions

Related Terms

Vangie Beal
Technology Expert
Vangie Beal
Technology Expert

Vangie Beal is a digital literacy coach based in Nova Scotia, Canada, and recently joined Techopedia. She is an award-winning business and technology writer with 20 years of experience in the technology and web publishing industry. Since the late 1990s, his byline has appeared in dozens of publications, including CIO, Webopedia, Computerworld, InternetNews, Small Business Computing, and many other technology and business publications. She is an avid gamer with deep roots in the female gaming community and a former Internet TV gaming host and gaming journalist.