ifconfig Command in Linux (2026 Guide): Examples, Installation, and Modern Alternatives

Linux_OS

Managing network interfaces is a fundamental skill for Linux users, system administrators, and DevOps engineers. One of the most well-known tools for this purpose is the ifconfig command.

Although many modern Linux distributions now favor the ip command, understanding ifconfig remains valuable β€” especially when working with legacy systems, older documentation, or troubleshooting environments.

In this guide, you will learn:

  • What ifconfig is
  • How to install it
  • Common commands with examples
  • Whether ifconfig is deprecated
  • The difference between ifconfig and ip
  • When you should still use it

Let’s get started.

What Is the ifconfig Command?

ifconfig (interface configuration) is a Linux command-line utility used to configure, manage, and view network interface settings.

With ifconfig, you can:

βœ… View IP addresses
βœ… Enable or disable network interfaces
βœ… Change MAC addresses
βœ… Configure netmasks
βœ… Adjust MTU values
βœ… Troubleshoot connectivity

It was originally part of the net-tools package and served as the default networking tool for many years.

However, Linux networking has evolved β€” and so have the tools.

Is ifconfig Deprecated?

Yes β€” ifconfig is considered deprecated on many modern Linux distributions.

Most systems now use the ip command, which is part of the iproute2 package. It offers:

  • Better IPv6 support
  • Advanced routing capabilities
  • Improved network diagnostics
  • More consistent syntax

πŸ‘‰ Important:
Deprecated does NOT mean unusable.

Many administrators still rely on ifconfig for:

  • Legacy servers
  • Minimal environments
  • Quick diagnostics
  • Older training materials

Knowing both tools makes you far more adaptable in real-world infrastructure.

How to Install ifconfig on Linux

Some distributions no longer install ifconfig by default. If you see:

ifconfig: command not found

you simply need to install net-tools.

Ubuntu / Debian

sudo apt update
sudo apt install net-tools

RHEL / CentOS / Rocky Linux

sudo dnf install net-tools

After installation, verify with:

ifconfig

Basic Syntax

ifconfig [interface] [options]

Example:

ifconfig eth0

Displays configuration for the eth0 interface.

Common ifconfig Commands (With Examples)

1. Show All Network Interfaces

ifconfig

This displays:

  • Interface names (eth0, ens33, wlan0)
  • IP addresses
  • MAC addresses
  • Packet statistics

Great for quick diagnostics.

2. Enable a Network Interface

sudo ifconfig eth0 up

Useful when an interface is disabled.

3. Disable a Network Interface

sudo ifconfig eth0 down

Often used during maintenance or testing.

⚠️ Warning:
Disabling the active interface on a remote server may disconnect your SSH session.

4. Assign an IP Address

sudo ifconfig eth0 192.168.1.100 netmask 255.255.255.0

Important note:

πŸ‘‰ Changes made with ifconfig are temporary and usually reset after reboot.

For permanent configuration, use:

  • Netplan (Ubuntu)
  • NetworkManager
  • nmcli

5. Change the MAC Address

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

Common use cases:

  • Network testing
  • Privacy
  • Lab simulations

6. Enable Promiscuous Mode

sudo ifconfig eth0 promisc

This allows the interface to capture all packets β€” often used in:

  • Packet analysis
  • Security testing
  • Wireshark environments

7. Change MTU Size

sudo ifconfig eth0 mtu 1500

Adjusting MTU can help optimize performance or fix fragmentation issues.

Understanding ifconfig Output

Typical output includes:

  • inet β†’ IPv4 address
  • ether β†’ MAC address
  • RX/TX packets β†’ Traffic statistics
  • netmask β†’ Network range

Monitoring these values helps diagnose:

βœ… Packet loss
βœ… Interface errors
βœ… Connectivity problems

ifconfig vs ip Command

Here is a quick comparison:

Taskifconfigip command
Show IP addressifconfigip addr show
Enable interfaceifconfig eth0 upip link set eth0 up
Disable interfaceifconfig eth0 downip link set eth0 down
View routesrouteip route

πŸ‘‰ Recommendation:
Learn the ip command for future-proof Linux skills.

But keep ifconfig in your toolkit for compatibility.

When Should You Still Use ifconfig?

Despite being replaced, ifconfig is still helpful in scenarios such as:

Legacy Infrastructure

Older enterprise environments may still depend on net-tools.

Quick Troubleshooting

Many admins find ifconfig faster for simple checks.

Learning Linux Fundamentals

It provides a clearer conceptual view of interfaces for beginners.

Modern Alternatives to ifconfig

If you want the industry-standard approach, start using:

ip

The direct successor to ifconfig.

Example:

ip addr show

nmcli

Ideal for NetworkManager-based systems.

ss

Replaces netstat for socket statistics.

πŸ‘‰ Pro Tip:
Professionals typically know both old and modern tools.

Conclusion

The ifconfig command remains a valuable utility for viewing and configuring network interfaces β€” even though it is gradually being phased out in favor of the more powerful ip command.

For modern Linux environments:

βœ… Prioritize learning ip
βœ… Understand ifconfig for legacy support
βœ… Use both when troubleshooting

Mastering these tools will significantly strengthen your Linux administration skills and prepare you for real-world infrastructure challenges.

FAQ

Why is ifconfig missing on my Linux system?

Because many distributions no longer install net-tools by default. Install it manually to use ifconfig.

Is ifconfig obsolete?

It is deprecated but still functional, especially on older systems.

What replaced ifconfig?

The ip command from the iproute2 package.

Are ifconfig changes permanent?

No β€” most changes disappear after reboot unless configured via network management tools.

(Visited 128 times, 1 visits today)

You may also like