Welcome to ifconfig vs ip usage guide on Linux. ifconfig and ip commands are mostly useful when managing networking on Linux/Unix systems.  The ip command has been there for a while now but most people still stick to ifconfig for daily network configurations and troubleshooting on Linux. In this article, I’ll try to give you the basics you need to master ip command and show a comparison between the two.

ifconfig vs ip usage guide on Linux

In a nutshell, ip tool should be the replacement of ifconfig since ifconfig is considered deprecated and no active development on it is going on.On recent Linux systems, the ifconfig command is missing and can be installed from net-tools package. Installation on various OS is as below.

Installing ifconfig on Arch

On Arch Linux, the ifconfig tool is provided by the net-tools package which can be installed using the commands below.

$ sudo pacman -S net-tools
$ sudo pacman -Qi net-tools
Name : net-tools
Version : 1.60.20160710git-1
Description : Configuration tools for Linux networking
Architecture : x86_64
URL : http://net-tools.sourceforge.net/
Licenses : GPL2

To confirm that the tool is installed, just issue the command ifconfig on the terminal.

Installing ifconfig on Ubuntu

If your version of Ubuntu is missing the ifconfig command, you can install it by:

sudo apt-get install net-tools

Installing ifconfig on Fedora / CentOS

--- CentOS ---
sudo yum install net-tools

--- Fedora ---
sudo dnf install net-tools

For ip command, if missing for any reason, you can install it as well.

Install ip command on Ubuntu

ip command on Ubuntu is provided by iproute2 package installable from apt-get.

sudo apt-get install iproute2

Install ip command on CentOS / Fedora

The package that provides ip command is iproute, which can be installed or updated using yum/dnf

sudo yum -y install iproute

Comparison of ip and ifconfig commands

For this comparison, we’ll use a number of examples to demonstrate how things are done with ip command and similar commands used with ifconfig. Since both commands are available on all Linux distributions, you can stick with what you’re comfortable with. If you’ve been an ifconfig user for a long time now, this guide will introduce you to commands enough to get you started with ip tool.

In all examples, any command with prefix ifconfig is specific to the ifconfig tool and any command starting with ip is specific to the ip network management tool. So keep this in mind as you proceed.

Display network interfaces and ip address information

To get all IP address related information using ip/ifconfig, these commands are used.

$ ifconfig
$ ip addr

Take down/up network interface:

If you would like to take down or bring up an interface, this is often done when modifying network configurations, you can use below commands. The interface eth0 can be replaced with any other interface name.

$ sudo ifconfig eth0  {up|down}
$ sudo ip link set dev eth0 {up|down}

Set a static IP and netmask:

Static IP setting can be done using ip or ifconfig. But note that changes made with these commands are not persistent against reboots. Explore setting static ip using the nmcli tool or by modifying network configuration file on your distribution for permanent changes. Some guides available on this blog are:

Setting Static IP Address on Ubuntu

Setting Static IP Address on CentOS


sudo ifconfig eth0 netmask
sudo ip addr add dev eth0

Remove static IP address:

To clear ip address information for an interface commands syntax is as below for both tools:

sudo ifconfig eth0 del
sudo ip addr del dev eth0

Set network MTU

MTU is an abbreviation for maximum transmission unit. In networking, this is the size of the largest network layer protocol data unit that can be communicated in a single network transaction. In this example, mtu size of 1500 bytes is set. Larger MTU values is common for storage servers/systems.

sudo ifconfig eth0 mtu 1500
sudo ip link set dev eth0 mtu 1500

Enable Promiscuous Mode

Promiscuous mode is a mode of operation in networking whereby every data packet transmitted can be received and read by a network adapter. This is often used to monitor network activity.

sudo ifconfig eth0 promisc
sudo ip link set dev eth0 promisc on

Enable ARP

The Address Resolution Protocol is a communication protocol used for discovering the link layer address associated with a given IPv4 address, a critical function in Internet Protocol computer networks. To enable it to run the commands:

sudo ifconfig eth0 arp
sudo ip link set dev eth0 arp on

Set MAC address

ip and ifconfig commands can do runtime change of MAC address. In this example, we’re setting MAC address to  aa:bb:cc:dd:ee:ff. Note that each NIC has fixed mac address which cannot be changed, changing mac address is not recommended since it can cause issues on layer 2 network communication if any collision exists.

sudo ifconfig eth0 hw ether  aa:bb:cc:dd:ee:ff
sudo ip link set dev eth0 address aa:bb:cc:dd:ee:ff

Add default route via gateway IP

A default route can be set using ip and ifconfig commands for destinations without static routes defined.

sudo route add default gw
sudo ip route add default via

Set Static route

Static route defines a destination to a specific network. In this example, we’re specifying that all packets destined for network must go through gateway. The network interface to the default gateway is eth0.

sudo route add -net netmask gw
sudo ip route add via dev eth0

A different guide to Setting up Static routes on Linux is available on this blog. Please read it to strengthen the knowledge already accumulated here.

View neighbors (using ARP and NDP):

To check ARP table, run:

$ ip neighbor show

Display the current default route.

$ ip route show | head -n 1

Remove default gw

If you no longer need the default gateway set and would like to change, you can delete currently set using:

$ ip route del default via dev eth1


Hope this guide- ifconfig vs ip usage guide on Linux has been helpful in getting familiar with ip and ifconfig command line tools used to manage networking on Linux. If you’ve additional commands that could be beneficial and not listed in this tutorial, please post them in the comments section. I’ll be happy to update them here.

More guides:

How To Create and Configure Bridge Networking For KVM in Linux

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here