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’.
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
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.
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.
This IBM guide offers additional examples of ifconfig syntax, flags, and parameters
ipconfig vs. ifconfig
- 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?
References
- How to install missing ifconfig command on Linux (Linuxconfig)
- Linux Ifconfig Command: How to Use It (Helpdeskgeek)
- ifconfig Command (Ibm)
- net-tools future (Lists.debian)
- How to Find Your IP Address in Linux | ifconfig Command (Geeksforgeeks)