ifconfig Command in Linux: Configure Network Interfaces

When a server comes back from a reboot with no network, the fastest way to see what the interfaces are doing is to ask them directly. ifconfig (interface configuration) is the classic tool for that job, 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.
To calculate the network and usable host range for a netmask, use the interactive subnet calculator .
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-toolsOnce the package is in place, confirm that the binary responds:
/usr/sbin/ifconfig -VThe command prints the net-tools release string and exits. Using the full path also works on Debian systems where /usr/sbin is not included in a regular user’s PATH.
ifconfig 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
The options that change how ifconfig reports are:
-a- display all interfaces, including the ones that are down-s- display a short list, in the same format asnetstat -i-v- print more detail for some error conditions
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 2001:db8:10::3 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 0Each block starts with the interface name, followed by the fields that describe its current state:
- flags - The interface flags, printed as a number and a readable list.
UPmeans the interface is administratively enabled.RUNNINGmeans its operational state is up or unknown, but it does not guarantee a usable connection.BROADCASTandMULTICASTmean the interface supports those traffic types. For Ethernet carrier state, check forLOWER_UPwithip link show. - mtu - The largest packet the interface will transmit, in bytes.
- inet, netmask, broadcast - The IPv4 address, its subnet mask, and the broadcast address of the subnet.
- inet6, prefixlen, scopeid - The IPv6 addresses. A
globalscope address is not restricted to the local link, but routing and firewall rules still determine whether it is reachable. Alinkscope address starting withfe80::is valid only on the local segment. - ether - The MAC address of the interface, with the hardware type in parentheses.
- txqueuelen - The length of the transmit queue for the device.
- RX and TX - Packet counts and byte totals received and transmitted, each followed by its error counters.
The error counters are the part worth reading closely. RX errors counts bad packets received by the interface, while TX errors counts transmission problems. RX dropped counts received packets that were not processed, often because of resource limits, unsupported protocols, or filtering. TX dropped counts packets discarded before transmission. overruns reports FIFO or buffer overflow events, and collisions counts Ethernet collisions during transmission.
A nonzero or rising counter does not identify one cause by itself. Congestion, resource pressure, filtering, driver behavior, and physical link problems can all affect these values. Compare repeated samples and check the detailed counters with ip -s link before drawing a conclusion.
One caveat applies to interface aliases such as eth0:0. Since kernel 2.2 there are no separate statistics for aliases, so the counters printed for an alias are the counters of the parent device.
For a condensed view of the same statistics, use the -s flag:
ifconfig -sIface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 84110 0 0 0 59727 0 0 0 BMRU
lo 65536 4198 0 0 0 4198 0 0 0 LRUThe Flg column packs the interface flags into single letters. B is broadcast, M is multicast, R is running, U is up, L is loopback, and P is promiscuous, so the BMRU on eth0 above is the short form of the flags line in the full output.
To display information for a specific interface, pass its name as an argument:
ifconfig eth0The equivalent ip command is:
ip addr show eth0When you need the addresses and nothing else, filter the output:
ifconfig eth0 | grep inet inet 172.20.10.3 netmask 255.255.255.240 broadcast 172.20.10.15
inet6 2001:db8:10::3 prefixlen 64 scopeid 0x0<global>
inet6 fe80::4ebb:58ff:fe9c:f555 prefixlen 64 scopeid 0x20<link>Because inet6 contains inet, both families are matched. Use grep -w inet to keep the IPv4 line alone. Our guide on finding your IP address in Linux
covers the other ways to get the same answer.
Assign 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 eth0Assign an IPv6 Address to a Network Interface
IPv4 addresses are passed straight to ifconfig, but IPv6 addresses go through the inet6 address family and the add keyword:
ifconfig INTERFACE inet6 add ADDRESS/PREFIXLENFor example, to add 2001:db8::1 with a 64-bit prefix to eth0:
ifconfig eth0 inet6 add 2001:db8::1/64Run ifconfig eth0 afterwards and the new address appears as an extra inet6 line with global scope. To take it away again, swap add for del:
ifconfig eth0 inet6 del 2001:db8::1/64The equivalent ip commands are:
ip -6 addr add 2001:db8::1/64 dev eth0
ip -6 addr del 2001:db8::1/64 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.
ifconfig: command not found after installing net-tools
Debian installs the binary as /usr/sbin/ifconfig, but /usr/sbin may not be part of a regular user’s PATH. Call it by its full path with /usr/sbin/ifconfig.
Changes are lost after a rebootifconfig 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 -s | ip -s link | Show a short list with interface counters |
ifconfig eth0 | ip addr show eth0 | Show a specific interface |
ifconfig eth0 IP netmask MASK | ip addr add IP/PREFIX dev eth0 | Assign an IPv4 address |
ifconfig eth0 inet6 add IP/PREFIX | ip -6 addr add IP/PREFIX dev eth0 | Assign an IPv6 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 a deprecated legacy tool 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, or the ip command cheatsheet
for a printable version.
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
.
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 1000+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page