ifconfig Command in Linux: Configure Network Interfaces

ifconfig (interface configuration) is a network management tool used to configure and view the status of network interfaces in Linux. With ifconfig, you can assign IP addresses, enable or disable interfaces, change MTU values, modify MAC addresses, and more.
ifconfig is deprecated and replaced by the ip
command. It may not be installed on modern Linux distributions. Where possible, use ip for new scripts and workflows.This guide explains how to use the ifconfig command with practical examples.
How to Install ifconfig
ifconfig is part of the net-tools package, which is not installed by default on many modern distributions.
If you get an error saying ifconfig: command not found, install the package using the instructions below.
Install ifconfig on Ubuntu, Debian, and Derivatives
sudo apt install net-toolsInstall ifconfig on Fedora, RHEL, and Derivatives
sudo dnf install net-toolsifconfig Command Syntax
The general syntax for ifconfig is:
ifconfig [INTERFACE] [OPTIONS] [ADDRESS]INTERFACE— the name of the network interface (for example,eth0,ens3, orlo)ADDRESS— the IP address to assign to the interface
ens3 or enp0s3 instead of the traditional eth0. Run ifconfig -a to see the actual interface names on your system.The configurations set with ifconfig are not persistent. After a system restart, all changes are lost. To make changes permanent, edit the distribution-specific network configuration files or use a network manager.
Only root or users with sudo privileges can modify network interfaces.
Display Network Interface Information
Run ifconfig without options to display all active network interfaces:
ifconfigTo display all interfaces, including inactive ones, add the -a flag:
ifconfig -aeth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.20.10.3 netmask 255.255.255.240 broadcast 172.20.10.15
inet6 2401:4900:1d65:40a1:4ebb:58ff:fe9c:f555 prefixlen 64 scopeid 0x0<global>
inet6 fe80::4ebb:58ff:fe9c:f555 prefixlen 64 scopeid 0x20<link>
ether 4c:bb:58:9c:f5:55 txqueuelen 1000 (Ethernet)
RX packets 84110 bytes 70667629 (70.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 59727 bytes 20886290 (20.8 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)
RX packets 4198 bytes 498729 (498.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4198 bytes 498729 (498.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0To display information for a specific interface, pass its name as an argument:
ifconfig eth0The equivalent ip command is:
ip addr show eth0Assign an IP Address and Netmask to a Network Interface
To assign an IP address and netmask to an interface, use the following syntax:
ifconfig INTERFACE IP_ADDRESS netmask SUBNET_MASKFor example, to assign the IP address 192.168.0.101 with netmask 255.255.0.0 to eth0:
ifconfig eth0 192.168.0.101 netmask 255.255.0.0You can also assign a secondary IP address using interface aliasing:
ifconfig eth0:0 192.168.0.102 netmask 255.255.0.0The equivalent ip command for assigning an address is:
ip addr add 192.168.0.101/16 dev eth0Enable and Disable a Network Interface
To disable an active network interface, pass the down flag after the interface name:
ifconfig eth0 downTo enable an inactive interface, use the up flag:
ifconfig eth0 upIf you are connected over SSH through the same interface, bringing it down will disconnect your session. Use caution on remote systems and make sure you have out-of-band access before applying interface state changes.
The equivalent ip commands are:
ip link set eth0 down
ip link set eth0 upEnable and Disable Promiscuous Mode
Promiscuous mode allows a network interface to capture and view all packets on the network segment, not just those addressed to it. It is commonly used for network analysis and packet capture with tools like tcpdump
.
To enable promiscuous mode on an interface:
ifconfig eth0 promiscTo disable promiscuous mode:
ifconfig eth0 -promiscThe equivalent ip commands are:
ip link set eth0 promisc on
ip link set eth0 promisc offChange the MTU of a Network Interface
The MTU (Maximum Transmission Unit) defines the maximum size of packets transmitted on an interface. Lowering the MTU can help on networks with fragmentation issues; raising it (jumbo frames) can improve throughput on supported networks.
To change the MTU value, use the following syntax:
ifconfig INTERFACE mtu MTU_VALUEFor example, to set the MTU of eth0 to 9000:
ifconfig eth0 mtu 9000The equivalent ip command is:
ip link set eth0 mtu 9000Change the MAC Address of a Network Interface
The MAC (Media Access Control) address is the hardware address that uniquely identifies a network interface on a local network.
To change the MAC address, first bring the interface down, then set the new address with the hw ether flag:
ifconfig eth0 down
ifconfig eth0 hw ether 00:00:2d:3a:2a:28
ifconfig eth0 upThe interface must be down before changing its MAC address. The equivalent ip commands are:
ip link set eth0 down
ip link set eth0 address 00:00:2d:3a:2a:28
ip link set eth0 upTroubleshooting
ifconfig: command not found
The net-tools package is not installed. Install it with sudo apt install net-tools on Ubuntu, Debian, and Derivatives, or sudo dnf install net-tools on Fedora, RHEL, and Derivatives.
Changes are lost after a reboot
ifconfig changes are applied only to the running system and do not survive a restart. To make changes permanent, use your distribution’s network manager (NetworkManager, systemd-networkd, or Netplan) or edit the appropriate configuration files.
The interface name is not eth0
Modern Linux systems use predictable interface names such as ens3, enp0s3, or wlp2s0. Run ifconfig -a or ip link show to list the actual interface names on your system.
Cannot change the MAC address while the interface is up
The interface must be brought down before changing its MAC address. Run ifconfig eth0 down first, change the address, then bring it back up with ifconfig eth0 up.
Quick Reference
ifconfig command | ip equivalent | Description |
|---|---|---|
ifconfig | ip addr show | Show active interfaces |
ifconfig -a | ip addr show | Show all interfaces including inactive |
ifconfig eth0 | ip addr show eth0 | Show a specific interface |
ifconfig eth0 IP netmask MASK | ip addr add IP/PREFIX dev eth0 | Assign an IP address |
ifconfig eth0 down | ip link set eth0 down | Disable an interface |
ifconfig eth0 up | ip link set eth0 up | Enable an interface |
ifconfig eth0 promisc | ip link set eth0 promisc on | Enable promiscuous mode |
ifconfig eth0 -promisc | ip link set eth0 promisc off | Disable promiscuous mode |
ifconfig eth0 mtu VALUE | ip link set eth0 mtu VALUE | Change MTU |
ifconfig eth0 hw ether MAC | ip link set eth0 address MAC | Change MAC address |
FAQ
Should I use ifconfig or ip?
Use ip for new scripts and day-to-day work. ifconfig is no longer maintained and is absent from many modern distributions. The ip command provides all of the same functionality and more. See the Quick Reference table above for the ip equivalents of common ifconfig commands.
Why do my network changes disappear after a reboot?
ifconfig configures the live kernel network state only. The changes are not written to any configuration file. To persist changes, use your distribution’s network configuration system — Netplan on Ubuntu, NetworkManager on Fedora, or /etc/network/interfaces on Debian.
How do I find my IP address on Linux?
Run ifconfig to display all active interfaces and their assigned addresses. The inet field shows the IPv4 address and inet6 shows the IPv6 address. The modern alternative is ip addr show.
What is promiscuous mode and is it safe to enable?
Promiscuous mode allows an interface to receive all packets on the network, not just those addressed to it. It is safe to enable in controlled environments for diagnostic purposes (for example, with tcpdump). On shared networks, it can capture other hosts’ traffic, so it should only be used with appropriate authorization.
Conclusion
Use ifconfig to view and configure network interfaces, assign IP addresses, toggle interface state, and modify MAC addresses and MTU values. For new systems and scripts, prefer the ip command
, which replaces ifconfig and is available on most modern Linux distributions. For more details, see the ifconfig man page
.
If you have any questions, feel free to leave a comment below.
Tags
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page