ifconfig Command in Linux
Transform Your Career
Choose from our industry-leading programs designed for career success
Modern Software and AI Engineering Program
Master full-stack development with AI integration
+1000 moreModern Data Science and ML with specialisation in AI
Advanced data science techniques with AI specialization
+1000 moreAdvanced AIML with Specialisation in Agentic AI
Deep dive into AIML with focus on Agentic systems
+1000 moreDevOps, Cloud & AI Platform Engineering
Build and manage AI-powered cloud infrastructure
+1000 moreAI Engineering Advanced Certification by IIT-Roorkee
Premier AI engineering certification from IIT-Roorkee
Overview
The ifconfig command is a versatile command-line utility in Linux, used primarily for network configuration and management. It allows users to view and modify network interface parameters such as IP addresses, netmasks, and broadcast addresses.
Linux ifconfig Command Syntax
The syntax for the ifconfig command is as follows:
Where:
- INTERFACE: The name of the network interface you want to configure, like eth0 or wlan0.
- FLAGS: Flags are used to modify the behavior of the command, such as enabling or disabling an interface.
- OPTIONS: Options are used to set specific parameters for the network interface, such as IP addresses, netmasks, and broadcast addresses.
ifconfig Command Options:
- up: Enable a network interface.
- down: Disable a network interface.
- add: Add an IP address to the network interface.
- del: Delete an IP address from the network interface.
Example Usages
-
Display network interface information.:
Output:
Explanation: This command provides an overview of all available network interfaces and their current settings, including IP addresses, netmasks, and broadcast addresses.
-
Enable a network interface.:
Output:
Explanation: This command enables the eth0 network interface, allowing it to transmit and receive data.
Scaler Placement Report and Statistics
Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.
Tips
-
Always use 'sudo' when modifying network interface settings to ensure you have the necessary privileges.
-
Use 'man ifconfig' to view the complete list of options and their descriptions.
Advanced Use Cases of ifconfig Command in Linux
-
Configure a static IP address.:
Output:
Explanation: This command assigns the static IP address 192.168.1.10 with a netmask of 255.255.255.0 to the eth0 network interface.
-
Configure multiple IP addresses on a single network interface.:
Output:
Explanation: This command adds a secondary IP address 192.168.1.11 to the eth0 network interface.
-
Remove an IP address from a network interface.:
Output:
Explanation: This command removes the secondary IP address 192.168.1.11 from the eth0 network interface.
Turn Learning into Career Growth
Conclusion
-
ifconfig is a powerful command-line utility for network configuration and management in Linux.
-
It allows users to view and modify network interface parameters such as IP addresses, netmasks, and broadcast addresses.
-
Always use 'sudo' when modifying network interface settings to ensure you have the necessary privileges.




