+370 5 205 5502 sales@monovm.com

11 Linux ifconfig commands that every administrator should know

Learn about some of the most helpful ifconfig commands that every administrator ought to know about.

10 Jan, 22 by Susith Nonis 6 min Read

Ifconfig in full means “interface configuration”. It is used for configuring the system’s kernel-resident network interfaces. Overall, it is a function for network administration in Linux (Unix) operating systems used to manage, configure and query network interface parameters. Linux ifconfig is used during booting time to set up interfaces as needed. After this, you will typically only need it again when debugging or once the system needs tuning. 

If no arguments are provided, ifconfig will display the status of your system’s active interfaces. If a single one is given, you will only see the status of the given interface. Moreover, if you get a single-a argument, your system will display the status of all interfaces, including the inactive ones. In any other cases, ifconfig will configure an interface depending on the provided options. If you are unfamiliar with this, here are some essential ifconfig commands.

1.   Delete IPv6 address from the interface

Deleting this address from an interface is relatively easy, provided you know how to assign it. What you are required to do is replace the add argument with the del argument. The following is an example to help you learn how this command works.

$ sudo ifconfig eth0 del 2001:0db8:0: f101::1/64

The command deletes the IPv6 set to eth0.

2.   Remove point-to-point connections

When you create point-to-point connections for a network interface, a direct link between two machines will be created without anyone else listening. The ifconfig command below will enable you to remove this kind of connection whenever you want to. You are required to add a – sigh to this point-to-point code.

$ sudo ifconfig sl0 -point-to-point

3.   Enable trailers for the ethernet interface

Linux users have a trailer option in ifconfig, which enables or prevents negotiations for trailer encapsulation of TCP packets. Use the command below to activate trailer encapsulation. An important thing to note is that this option will only be available in the ethernet interface.

$ sudo ifconfig eth0 trailers

4.   Setting a new transmission queue length  

The Linus ifconfig command-line tool allows you to set custom transmission queues for your interfaces. It will be particularly suitable for users with slow devices with high latency. A good example is ISDN and modem links. The example below demonstrates how you will set the eth0 interface’s transmission queue length to a different value.

$ sudo ifconfig eth0 transmission queue length 5000

In this example, Linux ifconfig will be setting the transmission queue length of the eth0 interface at 5000. If you want to save the value permanently, you have to rework the file/etc/RC.locale.

This can be done by opening the file through Linux text editor, then adding the highlighted lines to the document.

/sbin/ifconfig eth0 txqueuelen 5000

5.   Disabling trailers for the ethernet interface

It is pretty easy to disable the trailers for Linux’s ethernet interface. All you have to do is prepend a – before your option to disable the trailers from the command line. The following is an example of a Linux ifconfig command that is used to disable trailers for eth0.

$ sudo ifconfig eth0 -trailers

6.   Enabling network interface

The ifconfig command in Linux is used to enable or disable particular network interfaces. The command below illustrates how to enable the eth0 internet interface.

$ ifconfig eth0 up

The outlined command activates the eth0 interface in your system to enable ethernet communication. Note that it is necessary to ensure your interface is indeed eth0 if you want this process to work. The following command will work the same as the first command. This command works similarly with other network interfaces.

$ ifup eth0

7.   Viewing only IPv4 addresses

This command offers both class 6 and 4 IP addresses. The highlighted command below will help you only to list the IPv4 addresses. 

$ ifconfig | grep -w inet

Once you run the command, you will no longer have the IPv6 addresses in the output. This command will prove helpful in case you’re scripting your network’s interface configuration.

8.   Assigning IP addresses to interfaces

You can use the Linux ifconfig command-line tool to specify the IP of a particular network interface. Enter the IP you wish to determine, following this up with the interface name. To better understand this, see the example below.

$ sudo ifconfig eth0

To run the command, you will need sudo privilege because you will be changing a network interface explicitly. Rerun the command to see the subsequent changes in your address field.

9.   Viewing the broadcast address of interfaces

Broadcast addresses send messages to new hosts in a given network. Use the command below to discover the broadcast addresses of the network interfaces. 

$ ifconfig | grep broadcast

Once keyed in, the command will list the lines with the broadcast address.

10.  Viewing network interface masks

The following command will guide you on listing your network interfaces’ netmasks. You can also use this ifconfig command to filter the default output for particular information regarding your network masks.

$ ifconfig | grep netmask

In this scenario, the grep command cuts the lines containing the word “netmask”.

11.  Assigning multiple network parameters simultaneously

You might want to assign several network interface parameters for a given network. Linux ifconfig allows you as an administrator to execute all of this at once.  

Here, all you will be required to do is consecutively pass the arguments in the same line. This type of command has the same effects on eth0.


Managing network interfaces can be time-intensive, and you are likely to spend many hours handling them. It is best to master most of the above Linux utilities to become excellent at networking to make things more efficient. These are some of the top ifconfig commands, and you can use even directly in your terminal as much as firing up a virtual machine is the most recommended approach.

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I veture into the world of Technology I try to share what I know in the simplest way possible. Not a fan of coffee, a sweet addict and a self accredited 'master chef'.