ifconfig Command in Linux

Learn via video courses
Topics Covered

Transform Your Career

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program

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.
Free Courses by top Scaler instructors
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science Course
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science Course

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

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

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

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

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.