Ifconfig Command in Linux

The word 'ifconfig' stands for interface configuration. Ifconfig is used in Linux and Unix systems to debug, configure and manage network interfaces from the terminal.

Using ifconfig command you can assign IP address and netmask, display network configuration (including broadcast address, mac address, MTU), enable or disable an interface.

In this tutorial, we learn about ifconfig command and how to set different parameters on network interface.

Ifconfig Command Syntax

Let's check ifconfig command syntax

ifconfig [...OPTIONS] [INTERFACE]

We will explain the different options of ifconfig command in the following section.

1) Display All network interface information

If you run ifconfig command without any options it will give you the status of all interfaces which are in up status. From the output, we can find the assigned IP address and also many other interface details.

The following output shows ifconfig without any options:

$ sudo ifconfig
eth0 Link encap:Ethernet HWaddr 44:87:FC:A4:C5:DD
inet addr: Bcast: Mask:
inet6 addr: fe80::4687:fcff:fef4:458d/64 Scope:Link
RX packets:6053915 errors:0 dropped:11 overruns:0 frame:0
TX packets:757638 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:794654447 (757.8 MiB) TX bytes:2415435778 (2.2 GiB)

lo Link encap:Local Loopback
inet addr: Mask:
inet6 addr: ::1/128 Scope:Host
RX packets:3298 errors:0 dropped:0 overruns:0 frame:0
TX packets:3298 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:245808 (240.0 KiB) TX bytes:245808 (240.0 KiB)

If you want to see all interfaces information (including status up and down) then you have to use -a option.

$ sudo ifconfig -a

You can check specific interface (say eth0) details using below command:

$ sudo ifconfig eth0

To display a short list use -s option.

$ sudo ifconfig -s
eth0             1500   221107      0      0 0        310175      0      0      0 BMRU
lo              65536        0      0      0 0             0      0      0      0 LRU

Note: If you looking for MAC address binded to that interface you can find from the ifconfig output.

2) Enable or disable the network interface

For troubleshooting or debugging some system admin have to enable or disable the interface. The following command shows to enable and disable specific interface.

To enable interface eth0 run the following command:

$ sudo ifconfig eth0 up

To disable interface eth0 run the following command:

$ sudo ifconfig eth0 down

3) Assign IP address and Netmask to network interface

To assign IP address to an interface (eth0), use IP address followed by a specific interface name.

The following command set IP address '' to the interface 'eth0'. The second command set netmask '' to 'eth0' interface.

$ sudo ifconfig eth0
$ sudo ifconfig eth0 netmask

You can set both IP address and netmask using one command. The following example configures eth0 with ip address '' with netmask ''.

$ sudo ifconfig eth0 netmask

If you looking to set broadcast IP on the interface, use 'ifconfig eth0 broadcast' as shown below:

$ sudo ifconfig eth0 broadcast

4) Set IPV6 Address to network interface

To add ipv6 address to a interface (etho) use the following syntx:

ifconfig  inet6 add ipv6address>/prefixlength

For example,

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

5) How to Enable ARP protocol

ARP stands for the address resolution protocol, it is used for resolution of network layer addresses into link layer addresses.

To enable arp on eth0 interface, use the following command:

$ sudo ifconfig eth0 arp

6) How to Disable ARP protocol

To disable ARP on eth0 interface you have to add a hyphen (-) before arp option.

$ sudo ifconfig eth0 -arp

7) Change MAC address of interface

In order to change the MAC address, you should first disable the interface (NIC) and also make sure the hardware vendor supports this function. Alternative commands to change mac address are ip command and 'macchanger' utility.

The following command will change the MAC address for the interface (eth0) using the option hw ether.

$ sudo ifconfig eth0 down

$ sudo ifconfig eth0 hw ether 22:67:df:1c:11:4f

$ sudo ifconfig eth0 up

8) How to enable Promiscuous mode

In promiscuous mode is a mode of operation in which every data packet transmitted can be received and read by a network adapter. The promisc mode is mostly enabled to monitor network card traffic via tcpdump command or Wireshark.

The following command set eth0 in promiscuous mode:

$ sudo ifconfig eth0 promisc

To disable promiscuous mode use -promisc as following:

$ sudo ifconfig eth0 -promisc

9) Changing the MTU

MTU stands for Maximum Transmission Unit, it is the size of the largest block of data that can be transmitted as a single unit, the default value is 1500, you can change it as the below example

$ sudo ifconfig eth0 mtu 1700

10) Add Alias to network interface

You can create additional logical network interfaces known as alias using ifconfig command. The following command set alias interface (eth0:0) and new ip address (

$ sudo ifconfig eth0:0

You can delete alias by bringing down the interface as shown below:

$ sudo ifconfig eth0:0 down


In this tutorial, we learned how to use ifconfig command in Linux to view and set interface parameters. Ifconfig is one of the deprecated command within net-tools that has not been maintained for many years. The functionalities of many commands is retained with more features under iproute2 suite.

Leave a Comment