Close Menu
IOupdate | IT News and SelfhostingIOupdate | IT News and Selfhosting
  • Home
  • News
  • Blog
  • Selfhosting
  • AI
  • Linux
  • Cyber Security
  • Gadgets
  • Gaming

Subscribe to Updates

Get the latest creative news from ioupdate about Tech trends, Gaming and Gadgets.

What's Hot

Linux 7.0-rc1 Released With Many New Features:

February 23, 2026

Microsoft has a new plan to prove what’s real and what’s AI online

February 23, 2026

15 Useful ifconfig Commands to Configure Network in Linux

February 23, 2026
Facebook X (Twitter) Instagram
Facebook Mastodon Bluesky Reddit
IOupdate | IT News and SelfhostingIOupdate | IT News and Selfhosting
  • Home
  • News
  • Blog
  • Selfhosting
  • AI
  • Linux
  • Cyber Security
  • Gadgets
  • Gaming
IOupdate | IT News and SelfhostingIOupdate | IT News and Selfhosting
Home»Linux»15 Useful ifconfig Commands to Configure Network in Linux
Linux

15 Useful ifconfig Commands to Configure Network in Linux

MarkBy MarkFebruary 23, 2026No Comments12 Mins Read
15 Useful ifconfig Commands to Configure Network in Linux


In the dynamic world of Linux network configuration, mastering command-line tools is essential for any tech-savvy administrator. This article dives deep into ifconfig, the venerable utility for managing network interfaces. While ifconfig has been largely superseded by the more modern ip command in recent Linux distributions, understanding its functionalities remains invaluable for troubleshooting legacy systems or environments where net-tools is still prevalent. We’ll explore 15 practical ifconfig commands, from listing interfaces to assigning IP addresses and configuring advanced settings, alongside crucial insights into its deprecation and recommended modern alternatives, ensuring your command-line networking skills are always up-to-date.

Mastering Network Interface Configuration with ifconfig (and Modern Alternatives)

The ifconfig (Interface Configuration) utility has long been a staple for system and network administrators in Unix/Linux operating systems. It allows for the configuration, management, and querying of network interface parameters directly via the command line or within system configuration scripts. From displaying current network settings to assigning IP addresses, managing netmasks, and enabling/disabling interfaces, ifconfig provides granular control over your system’s network connectivity.

Important Update: It is crucial for tech-savvy users to note that the ifconfig command is deprecated and has been officially replaced by the more powerful and feature-rich ip command in most modern Linux distributions. ifconfig is part of the net-tools package, which may not be installed by default on newer systems like recent versions of Ubuntu, Fedora, or RHEL. While still functional if installed, it’s highly recommended to familiarize yourself with the ip command for future-proofing your **Linux network configuration** skills.

Getting Started: Installing ifconfig on Modern Linux Systems

If you find ifconfig missing on your system, you can easily install the net-tools package. Here’s how:

sudo apt install net-tools # Debian/Ubuntu
sudo dnf install net-tools # RHEL/Fedora

Essential ifconfig Commands for Network Management

1. Displaying Network Interface Information

Understanding your network topology begins with knowing your interfaces. Here’s how to list them:

Listing All Active Network Interfaces in Linux

The ifconfig command, when executed without any arguments, will display configuration details for all currently active network interfaces. This includes their assigned IP addresses, netmasks, hardware addresses, and other vital statistics.

ifconfig

Sample Output:

ens3      Link encap:Ethernet  HWaddr 00:0B:CD:1C:18:5A
          inet addr:172.16.25.126  Bcast:172.16.25.63  Mask:255.255.255.224
          inet6 addr: fe80::20b:cdff:fe1c:185a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2341604 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2217673 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:293460932 (279.8 MiB)  TX bytes:1042006549 (993.7 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:5019066 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5019066 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2174522634 (2.0 GiB)  TX bytes:2174522634 (2.0 GiB)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.1.1.1  P-t-P:10.1.1.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Note: Modern Linux distributions often use predictable network interface names such as ens3, enp3s0, or eno1, which offer more consistency compared to the traditional eth0 naming convention. For a more modern equivalent to ifconfig, consider using ip a or ip addr show.

Displaying Information on All Network Interfaces (Active and Inactive)

To view details for all network interfaces, regardless of whether they are active or inactive, use the -a argument:

ifconfig -a

Sampple Output:

eth0      Link encap:Ethernet  HWaddr 00:0B:CD:1C:18:5A
          inet addr:172.16.25.126  Bcast:172.16.25.63  Mask:255.255.255.224
          inet6 addr: fe80::20b:cdff:fe1c:185a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2344927 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2220777 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:293839516 (280.2 MiB)  TX bytes:1043722206 (995.3 MiB)
          Interrupt:185 Memory:f7fe0000-f7ff0000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:5022927 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5022927 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2175739488 (2.0 GiB)  TX bytes:2175739488 (2.0 GiB)

sit0      Link encap:IPv6-in-IPv4
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.1.1.1  P-t-P:10.1.1.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Viewing Network Settings of a Specific Interface

To inspect a single network interface, specify its name (e.g., ens3) as an argument:

ifconfig ens3

Sampple Output:

ens3      Link encap:Ethernet  HWaddr 00:0B:CD:1C:18:5A
          inet addr:172.16.25.126  Bcast:172.16.25.63  Mask:255.255.255.224
          inet6 addr: fe80::20b:cdff:fe1c:185a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2345583 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2221421 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:293912265 (280.2 MiB)  TX bytes:1044100408 (995.7 MiB)

2. Enabling and Disabling Network Interfaces

Controlling the state of your network interfaces is a fundamental task in **command-line networking**.

Enabling a Network Interface

The up flag activates a network interface that is in an inactive state, allowing it to send and receive data. For example, ifconfig ens3 up will activate the ens3 interface.

ifconfig ens3 up

Note: The ifup command was traditionally used as an alternative, but it is no longer available by default on many modern distributions such as RHEL 8+, Ubuntu 18.04+, and Fedora. The recommended modern approach is to use ip link set ens3 up or manage interfaces through NetworkManager using the nmcli command.

Disable a Network Interface

The down flag deactivates the specified network interface, stopping all data transmission. For example, the ifconfig ens3 down command deactivates the ens3 interface.

ifconfig ens3 down

Note: Similar to ifup, the ifdown command is not available by default on most modern Linux distributions. Use ip link set ens3 down or nmcli device disconnect ens3 as the modern alternatives.

3. Configuring IP Addresses and Network Parameters

Here’s how to assign critical network identifiers to your interfaces:

Assigning an IP Address to a Network Interface

To assign an IP address to a specific interface, use the ifconfig command with the interface name and the desired IP address.

For example, the following command sets the IP address on the ens3 interface.

ifconfig ens3 172.16.25.125

Note: IP addresses assigned this way are not persistent and will be lost after a system reboot. To make changes permanent, configure the network through NetworkManager (using nmcli or nmtui) or by editing the appropriate network configuration files for your distribution (e.g., /etc/netplan/*.yaml on Ubuntu, or files under /etc/sysconfig/network-scripts/ on RHEL/CentOS). The ip command equivalent is ip addr add 172.16.25.125/24 dev ens3.

Assigning a Netmask to a Network Interface

Using the ifconfig command with the netmask argument and an interface name allows you to define a subnet mask for the given interface.

For example, the following command sets the netmask on the ens3 interface.

ifconfig ens3 netmask 255.255.255.224

Assigning a Broadcast Address to a Network Interface

Using the broadcast argument with an interface name will set the broadcast address for the given interface. For example, the following command sets the broadcast address on the ens3 interface.

ifconfig ens3 broadcast 172.16.25.63

Assigning an IP Address, Netmask, and Broadcast Address Together

To assign an IP address, netmask, and broadcast address all at once, use the ifconfig command with all three arguments as shown below.

ifconfig ens3 172.16.25.125 netmask 255.255.255.224 broadcast 172.16.25.63

4. Advanced Interface Settings

Beyond basic IP configuration, ifconfig allows for fine-tuning specific interface behaviors.

Changing the MTU for a Network Interface

The mtu argument sets the Maximum Transmission Unit for an interface. The MTU defines the largest size of packet (in bytes/octets) that the interface will transmit in a single transaction. Adjusting the MTU is useful in specific network environments, such as when using VPNs to avoid fragmentation or when enabling jumbo frames on a local network for increased throughput.

For example, the following command sets the MTU to 1000 on the ens3 interface.

ifconfig ens3 mtu 1000

Note: Not all network interfaces support MTU changes. The default MTU for most Ethernet interfaces is 1500 bytes. Setting it too low can degrade performance, so change it only when required and with a clear understanding of its implications. The ip command equivalent is ip link set dev ens3 mtu 1000.

Enabling Promiscuous Mode on a Network Interface

In normal operation, a network card processes only packets addressed to itself or broadcast packets. In promiscuous mode, however, the network interface accepts all packets flowing through the network segment, regardless of their destination address. Network monitoring and packet analysis tools such as tcpdump and Wireshark rely on promiscuous mode to capture and analyze network traffic.

To enable promiscuous mode on an interface, use the following command.

ifconfig ens3 promisc

Disabling Promiscuous Mode on a Network Interface

To disable promiscuous mode and return the network interface to normal operation, use the -promisc switch as shown below.

ifconfig ens3 -promisc

5. Managing Network Interface Aliases

Interface aliases allow a single physical network interface to respond to multiple IP addresses.

Adding an Alias to a Network Interface

The ifconfig utility allows you to configure additional IP addresses on the same physical interface using the alias feature. This is useful when you need a single interface to respond to multiple IP addresses, for instance, hosting multiple virtual web servers on different IPs on the same machine.

To add an alias for the ens3 interface, use the following command. Note that the alias IP address must typically be within the same subnet as the primary IP address unless specific routing is configured.

For example, if your primary IP is 172.16.25.125, a valid alias might be 172.16.25.127.

ifconfig ens3:0 172.16.25.127

Next, verify the newly created alias interface by running the following command:

ifconfig ens3:0

Sample Output:

ens3:0    Link encap:Ethernet  HWaddr 00:01:6C:99:14:68
          inet addr:172.16.25.127  Bcast:172.16.25.63  Mask:255.255.255.224
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

Note: Interface aliases created with ifconfig are not persistent across reboots. For permanent multiple IP addresses on a single interface, configure them through NetworkManager (nmcli connection modify ens3 +ipv4.addresses 172.16.25.127/27) or the distribution-specific network configuration files. The ip command handles this by simply adding multiple IP addresses to the same device: ip addr add 172.16.25.127/27 dev ens3.

Removing an Alias from a Network Interface

If you no longer require an alias network interface or configured it incorrectly, you can remove it using the following command:

ifconfig ens3:0 down

6. Changing the MAC Address of a Network Interface

Modifying the MAC (Media Access Control) address can be useful for various purposes, including privacy or bypassing MAC-based network restrictions.

To change the MAC address of a network interface, use the ifconfig command with the hw ether argument followed by the new MAC address. Note that the interface must typically be brought down before changing its MAC address on most systems.

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

Note: MAC address changes made this way are temporary and will revert after a reboot. For permanent changes, use ip link set dev ens3 address AA:BB:CC:DD:EE:FF or configure it through NetworkManager.

Beyond ifconfig: The ip Command and Other Linux Networking Utilities

These 15 commands illustrate the most useful functionalities of ifconfig for configuring network interfaces in Linux. For comprehensive information and usage options, always refer to the man page by running man ifconfig at the terminal.

Since ifconfig is deprecated on most modern Linux distributions, it is imperative to familiarize yourself with the ip command, which is part of the iproute2 suite. The ip command offers a unified syntax for managing all aspects of networking, including interfaces, routing, and tunnels, and provides full IPv6 support—a significant advantage over ifconfig. For example, ip addr show is the modern equivalent to ifconfig, and ip link set dev ens3 up replaces ifconfig ens3 up.

Beyond `ifconfig` and the `ip command`, a rich ecosystem of other networking utilities enhances your **command-line networking** capabilities:

  • nmcli – a powerful command-line client that is used to control NetworkManager and report network information, ideal for managing persistent configurations.
  • tcpdump – an indispensable command-line packet capture and analyzer tool for monitoring network traffic in real-time.
  • netstat – an older, but still useful, command-line network monitoring tool that displays network connections, routing tables, interface statistics, and more.
  • ss (socket statistics) – a faster and more informative replacement for `netstat`, providing detailed network socket-related information.
  • Wireshark – a widely used open-source graphical network protocol analyzer that offers deep inspection of hundreds of protocols.
  • Munin – a web-based network and system monitoring application that generates insightful graphs using `rrdtool`.
  • Cacti – a complete web-based monitoring and graphing application for network monitoring, offering robust data collection and visualization.

To get more information and options for any of the above tools, see their man pages by entering "man toolname" at the command prompt. For example, to get information for the "netstat" tool, use the command "man netstat".


FAQ

Question 1: Why is ifconfig considered deprecated in modern Linux distributions?

Answer: ifconfig is deprecated because it is part of the older net-tools package, which has not been actively maintained for many years. Its successor, the ip command (from the iproute2 package), offers a more consistent syntax, improved IPv6 support, and a broader range of functionalities for **Linux network configuration**, all within a single, modern utility. This makes iproute2 the preferred and more powerful choice for current network management tasks.

Question 2: How can I make changes made with ifconfig permanent across reboots?

Answer: Changes made directly with ifconfig are temporary and will not persist after a system reboot. To make network configurations permanent, you should use your distribution’s recommended tools. This typically involves NetworkManager (controlled via nmcli or nmtui), editing specific configuration files (e.g., /etc/network/interfaces on Debian/Ubuntu, or files under /etc/sysconfig/network-scripts/ on RHEL/CentOS), or using modern configuration utilities like Netplan on Ubuntu (e.g., editing /etc/netplan/*.yaml files).

Question 3: What is a quick tip for transitioning from ifconfig to the ip command?

Answer: A great way to start transitioning is by learning the ip addr show command, which directly replaces ifconfig for displaying interface information. Similarly, ip link set dev [interface] up and ip link set dev [interface] down replace ifconfig [interface] up and ifconfig [interface] down, respectively. Think of ip as having sub-commands for different network aspects (addr for addresses, link for interface state, route for routing tables) which streamlines **command-line networking** tasks.



Read the original article

0 Like this
Commands Configure ifconfig Linux network
Share. Facebook LinkedIn Email Bluesky Reddit WhatsApp Threads Copy Link Twitter
Previous ArticleCode Metal Raises $125 Million to Rewrite the Defense Industry’s Code With AI
Next Article Microsoft has a new plan to prove what’s real and what’s AI online

Related Posts

Linux

Linux 7.0-rc1 Released With Many New Features:

February 23, 2026
Linux

GNOME 50 Desktop Environment Enters Public Beta Testing with More New Features

February 18, 2026
Linux

Deploying Encryption Honeypots – Pixelated Dwarf

February 18, 2026
Add A Comment
Leave A Reply Cancel Reply

Top Posts

AI Developers Look Beyond Chain-of-Thought Prompting

May 9, 202515 Views

6 Reasons Not to Use US Internet Services Under Trump Anymore – An EU Perspective

April 21, 202512 Views

Andy’s Tech

April 19, 20259 Views
Stay In Touch
  • Facebook
  • Mastodon
  • Bluesky
  • Reddit

Subscribe to Updates

Get the latest creative news from ioupdate about Tech trends, Gaming and Gadgets.

About Us

Welcome to IOupdate — your trusted source for the latest in IT news and self-hosting insights. At IOupdate, we are a dedicated team of technology enthusiasts committed to delivering timely and relevant information in the ever-evolving world of information technology. Our passion lies in exploring the realms of self-hosting, open-source solutions, and the broader IT landscape.

Most Popular

AI Developers Look Beyond Chain-of-Thought Prompting

May 9, 202515 Views

6 Reasons Not to Use US Internet Services Under Trump Anymore – An EU Perspective

April 21, 202512 Views

Subscribe to Updates

Facebook Mastodon Bluesky Reddit
  • About Us
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms and Conditions
© 2026 ioupdate. All Right Reserved.

Type above and press Enter to search. Press Esc to cancel.