ifconfig is a network management tool in Linux that we can use to check the IP addresses of Linux systems as well as configure network interfaces. It allows users to to configure, manage and query network interface parameters via command line interface or in a system configuration scripts. In this guide, we will see how to use this tool to make our network management tasks easier.

View network settings

The ifconfig command without any arguments displays the status of all the network interfaces associated with the Linux system.

#ifconfig

To display the above output in short format, use the -s option.

#ifconfig -s

List all network interfaces

The following command will display information of all active or inactive network interfaces on your system.

#ifconfig -a

View Network settings of an interface

The following command will display details of specific network interface.

#ifconfig <interface>

Enable/Disable Network interfaces

Use the following command to enable an interface:

#ifconfig <interface> up

Use the following command to disable an interface:

#ifconfig <interface>down

Assign an ip address to an interface

Use the following command with an interface name (eth0) and ip address that you want to set:

#ifconfig <interface> <ip_address>

Assign a Netmask to the interface

Using the “ifconfig” command with “netmask” argument and interface name as (eth0) allows you to define an netmask to an given interface.

# ifconfig <interface> netmask <netmask>

Enable/Disable Promiscuous mode

Promiscuous mode refers to an operational mode that allows a network adapter to access and view all packets in a network. In this mode, the adapter does not filter packets.

To enable promiscuous mode use the following command:

#ifconfig <interface> promisc

To disable promiscuous mode, use the following command:

#ifconfig <interface> - promisc

Change MTU value

You can change mtu (Maximum Transmission Unit) value using the following command:

#ifconfig <interface> mtu <value>

The following two tabs change content below.
Ruwantha Nissanka is a Professional Cyber Security Engineer from Sri lanka with having a demonstrated history of providing cyber security services for multiple organizations in Sri Lanka. He is a positive person who wants to believe the best in others and he likes to help, encourage people and make them feel good.