ifconfig Command in Linux (With Examples)

Last updated Wednesday, February 18, 2026 3:24 pm Joshua James 10 min read

ifconfig (interface configuration) reads and configures Linux network interfaces directly from the terminal. Run it without arguments and you immediately see every active adapter: IP address, MAC address, MTU, status flags, and packet counters. From there you can assign IPs, bring interfaces up or down, enable promiscuous mode for packet capture with tools like Wireshark and tcpdump, change MAC addresses, and tune MTU for jumbo frames. On modern Linux, the ip command from iproute2 has largely replaced ifconfig, but it remains embedded in legacy scripts, container base images, and older servers. The package is net-tools (not pre-installed on most modern distributions); the Install section below covers it for each major distro family.

Understand the ifconfig Command

ifconfig vs ip Command

ifconfig is part of the net-tools package, which dates back to the early days of Linux networking. Most modern distributions ship without net-tools installed, preferring ip from the iproute2 suite instead. Both tools accomplish similar tasks but use different syntax and offer different feature sets:

Featureifconfig (net-tools)ip (iproute2)
Pre-installed on modern distrosNo (requires net-tools)Yes (ships by default)
IPv6 supportLimitedFull
Multiple IPs per interfaceVia aliases (eth0:0)Native (ip addr add)
Active developmentMaintenance onlyActively developed
Script portabilityWide legacy supportModern standard
Output formatVerbose, familiarTerse, structured

ifconfig is considered deprecated on modern Linux systems. For new scripts and configurations, prefer the ip command from iproute2, which ships by default on all major distributions. The ifconfig command remains useful for reading legacy scripts, working on embedded Linux (Alpine/BusyBox), and managing older systems where ip is unavailable.

ifconfig Command Syntax

The basic syntax for ifconfig is:

ifconfig [-a] [-v] [-s] [interface] [address] [options]

The three global flags control display when no interface or options follow:

  • -a: Show all interfaces, including inactive ones.
  • -v: Verbose mode; prints additional error detail.
  • -s: Short statistics table showing packet counts per interface.

Changes made with ifconfig are not persistent across reboots. To make permanent changes, edit your distribution’s network configuration files: /etc/netplan/ on Ubuntu, /etc/network/interfaces on Debian, or /etc/NetworkManager/system-connections/ on Fedora and RHEL-based systems.

ifconfig Quick Reference

Common ifconfig operations at a glance:

TaskCommandNotes
Show active interfacesifconfigNo flags needed
Show all interfacesifconfig -aIncludes inactive ones
Show one interfaceifconfig eth0Replace eth0 with your interface name
Short stats tableifconfig -sPacket and error counts per interface
Assign IP addresssudo ifconfig eth0 192.168.1.10 netmask 255.255.255.0Requires root
Bring interface upsudo ifconfig eth0 upRequires root
Bring interface downsudo ifconfig eth0 downRequires root
Add secondary IPsudo ifconfig eth0:0 192.168.1.11 netmask 255.255.255.0Interface aliasing
Change MTUsudo ifconfig eth0 mtu 9000Standard Ethernet default: 1500
Enable promiscuous modesudo ifconfig eth0 promiscFor packet capture tools
Disable promiscuous modesudo ifconfig eth0 -promiscPrefix flag with - to disable
Change MAC addresssudo ifconfig eth0 hw ether AA:BB:CC:DD:EE:FFBring interface down first

Install the ifconfig Command

ifconfig is not installed by default on most modern Linux distributions. It ships as part of the net-tools package. Install it with your distribution’s package manager:

Debian and Ubuntu:

sudo apt install net-tools

Fedora, RHEL, AlmaLinux, and Rocky Linux:

sudo dnf install net-tools

Arch Linux:

sudo pacman -S net-tools

Verify the installation:

ifconfig --version
net-tools 2.10

Alpine Linux ships BusyBox, which includes its own minimal ifconfig implementation without needing a separate package. BusyBox ifconfig uses an older output format: Link encap: and HWaddr labels, instead of the flags= and ether labels used by net-tools. Most core operations work the same.

Practical ifconfig Command Examples

Display Active Network Interfaces

Running ifconfig without arguments shows all currently active interfaces and their configuration:

ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 1e:2c:03:9e:46:bb  txqueuelen 1000  (Ethernet)
        RX packets 52981  bytes 71678727 (71.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 47722  bytes 3440294 (3.4 MB)
        TX errors 0  dropped 0  overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)

Each interface entry shows its flags, MTU, assigned IPv4 address (inet), IPv6 address (inet6), MAC address (ether), and packet transmission statistics. The lo interface is the loopback adapter used for internal system communication at 127.0.0.1. The flags between angle brackets describe the current interface state:

FlagMeaning
UPInterface is enabled and can send or receive traffic
BROADCASTInterface supports sending packets to all hosts on the subnet
RUNNINGNetwork driver has allocated resources; hardware is ready
MULTICASTInterface supports multicast traffic
LOOPBACKLoopback interface, present on lo only
PROMISCPromiscuous mode is active; interface captures all packets
ALLMULTIAll-multicast mode is active; receives all multicast packets

On modern systems, interfaces use predictable names like ens3, enp2s0, or wlp3s0 rather than the older eth0 and wlan0 convention. The examples in this guide use eth0 for brevity; substitute your actual interface name throughout.

Display All Interfaces Including Inactive

The -a flag shows every interface, including those that are down or have no address assigned:

ifconfig -a

This is useful when troubleshooting a missing interface. If an interface exists but is down, it will not appear in plain ifconfig output; -a reveals it.

Display a Specific Interface

Pass an interface name to limit output to that single interface:

ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 1e:2c:03:9e:46:bb  txqueuelen 1000  (Ethernet)
        RX packets 52981  bytes 71678727 (71.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 47722  bytes 3440294 (3.4 MB)
        TX errors 0  dropped 0  overruns 0  carrier 0  collisions 0

Once you know the interface subnet (192.168.1.0/24 in this example), the nmap command can scan for active hosts and open ports on that range.

View a Short Statistics Summary

The -s flag produces a compact table of packet statistics for all interfaces at once, useful for a quick health check:

ifconfig -s
Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0      1500    52981      0      0 0         47722      0      0      0 BMRU
lo       65536        0      0      0 0             0      0      0      0 LRU

Each column represents packet counts per interface since the last boot or counter reset. RX-OK and TX-OK are successfully received and transmitted packets. Non-zero values in RX-ERR, RX-DRP, TX-ERR, or TX-DRP indicate receive errors, dropped frames, transmit errors, or dropped outbound packets; any of these warrant further investigation. The Flg column abbreviates the interface flags: B=BROADCAST, M=MULTICAST, R=RUNNING, U=UP, L=LOOPBACK.

Assign an IP Address and Netmask

To configure an IP address on an interface, pass the interface name, the IP address, the netmask keyword, and the subnet mask. This requires root access:

sudo ifconfig eth0 192.168.1.100 netmask 255.255.255.0

Verify the assignment:

ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 1e:2c:03:9e:46:bb  txqueuelen 1000  (Ethernet)

Bring a Network Interface Up or Down

The up and down arguments enable or disable an interface. Taking an interface down stops all traffic on it without requiring a reboot, which is useful when testing new configuration or recovering from a misconfiguration:

Running sudo ifconfig eth0 down on your primary interface disconnects you from the network immediately, including active SSH sessions. Ensure you have local console access or an out-of-band connection before running this on a remote system.

sudo ifconfig eth0 down

When down, the UP and RUNNING flags are absent from the interface output:

eth0: flags=4098<BROADCAST,MULTICAST>  mtu 1500

Bring it back up:

sudo ifconfig eth0 up
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

Add a Secondary IP with Interface Aliasing

Interface aliasing assigns multiple IP addresses to a single physical adapter using the interface:N naming convention. A server can then respond to multiple IPs on the same NIC, which is useful for virtual hosting or testing:

sudo ifconfig eth0:0 192.168.1.101 netmask 255.255.255.0

Confirm the alias was created:

ifconfig eth0:0
eth0:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.101  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 1e:2c:03:9e:46:bb  txqueuelen 0  (Ethernet)

To remove the secondary IP, set it to 0.0.0.0:

sudo ifconfig eth0:0 0.0.0.0

Advanced ifconfig Techniques

Change the MTU Size

The Maximum Transmission Unit (MTU) controls the largest packet size an interface sends in a single frame. Standard Ethernet uses 1500 bytes. Jumbo frames extend this to 9000 bytes, reducing per-packet overhead on high-throughput networks such as storage or data center links:

sudo ifconfig eth0 mtu 9000

Verify the change by piping output through grep to filter the MTU field:

ifconfig eth0 | grep mtu
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9000

Jumbo frames require end-to-end support: the NIC, every switch, and any router on the path must all be configured for the same MTU. A mismatch causes packet fragmentation, dropped frames, and connection failures. Test with a small subset of traffic before applying jumbo frames to production links.

Enable and Disable Promiscuous Mode

Under normal operation a NIC discards packets not addressed to it. Promiscuous mode overrides this, making the interface capture all packets on the network segment regardless of destination. Packet analysis tools like Wireshark and tcpdump rely on this mode to monitor traffic.

Enable promiscuous mode:

sudo ifconfig eth0 promisc

When enabled, PROMISC appears in the interface flags:

eth0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST>  mtu 1500

Disable it by prepending - to the flag name:

sudo ifconfig eth0 -promisc
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

Enable and Disable All-Multicast Mode

The allmulti flag puts the interface into all-multicast mode, making it receive all multicast packets on the network rather than only those for subscribed groups. This is used by multicast-aware services such as video streaming servers and cluster heartbeat daemons.

Enable all-multicast mode:

sudo ifconfig eth0 allmulti
eth0: flags=4675<UP,BROADCAST,RUNNING,ALLMULTI,MULTICAST>  mtu 1500

Disable it:

sudo ifconfig eth0 -allmulti
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

Change the MAC Address

Each NIC has a hardware MAC address. ifconfig can override it at the OS level for the duration of the session. Common uses include testing, bypassing MAC-based network filtering, and improving privacy on public Wi-Fi. The interface must be down before the change:

sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF
sudo ifconfig eth0 up

Confirm the new address is active by filtering with grep:

ifconfig eth0 | grep ether
        ether aa:bb:cc:dd:ee:ff  txqueuelen 1000  (Ethernet)

The MAC change lasts only until the next reboot. On some systems, NetworkManager or the kernel may reset it sooner. For a persistent override, configure the MAC address in your distribution’s network management tool (nmcli or a Netplan YAML on Ubuntu).

Troubleshoot Common ifconfig Errors

ifconfig: command not found

If ifconfig is not installed, the shell returns:

bash: ifconfig: command not found

ifconfig is not pre-installed on modern Linux distributions. Install the net-tools package using the commands in the Install section above.

Device Not Found Error

Specifying an interface name that does not exist produces:

eth0: error fetching interface information: Device not found

Run ifconfig -a to list all interfaces and find the correct name. On modern systems with predictable interface naming, the adapter may be ens3, enp2s0, or wlp3s0 instead of eth0. If the interface is absent entirely, check whether the kernel recognizes the adapter with ip link show.

SIOCSIFFLAGS: Operation Not Permitted

Running a configuration command without root access produces:

SIOCSIFFLAGS: Operation not permitted

SIOCSIFFLAGS is the kernel’s internal name for the socket ioctl call that sets interface flags; the message simply means the operation requires root access. Interface configuration operations (assigning IPs, changing MTU, toggling interfaces up or down) require root privileges. Prefix the command with sudo:

sudo ifconfig eth0 up

Configuration Does Not Persist After Reboot

All changes applied with ifconfig reset at reboot. For a permanent assignment, configure the interface through your distribution’s network tools:

  • Ubuntu (Netplan): Edit the YAML file in /etc/netplan/ and run sudo netplan apply.
  • Debian: Edit /etc/network/interfaces and restart networking with sudo systemctl restart networking.
  • Fedora / RHEL / Rocky / AlmaLinux: Use nmcli or edit the connection file in /etc/NetworkManager/system-connections/ and run sudo nmcli connection reload.

Frequently Asked Questions

Is ifconfig deprecated on Linux?

Yes. ifconfig is part of the net-tools package, which is no longer actively developed. The ip command from iproute2 is the maintained replacement and ships by default on all modern distributions. ifconfig still works correctly, but new scripts and configurations should use ip instead.

What is the ip command equivalent of ifconfig?

The main equivalents are: ip addr show (replaces plain ifconfig), ip addr show dev eth0 (replaces ifconfig eth0), ip link set eth0 up or down (replaces ifconfig eth0 up/down), and ip addr add 192.168.1.100/24 dev eth0 (replaces ifconfig eth0 192.168.1.100 netmask 255.255.255.0). The ip command uses CIDR notation (/24) rather than a separate netmask argument.

Can I use ifconfig to configure a wireless interface?

Yes, for basic operations. ifconfig works with wireless interfaces (wlan0, wlp3s0) for bringing them up or down, assigning IP addresses, and changing MAC addresses. However, it cannot configure wireless-specific parameters such as SSID, channel, or encryption keys. Use iwconfig from the wireless-tools package or iw for those settings, or nmcli for unified network management.

Conclusion

ifconfig covers the core tasks of reading interface status, assigning IP addresses, toggling interfaces up and down, and adjusting settings like MTU, promiscuous mode, and MAC address. Install it via the net-tools package on any modern distribution, prefix all configuration commands with sudo, and use ifconfig -a when an interface is not visible in plain output. For new systems and scripts, the ip command is the actively maintained replacement that ships on every modern Linux installation.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffee Buy me a coffee

Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<a href="URL">link</a> link
<blockquote>quote</blockquote> quote block

Leave a Comment

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: