A Brief Overview Of ifconfig Command

Broken Code
3 min readNov 14, 2021

Introduction:

ifconfig stands for interface configuration. It is one of the most used Linux commands. The ifconfig command is used for:

  1. displaying current network configuration information
  2. setting up an IP address, subnet mask, broadcast address and hardware address to a network interface
  3. enabling or disabling network interfaces

Displaying Network Configuration

ifconfig command in its simplest form will display all the active interface details. Basic information displayed upon using ifconfig is:

  1. IP address
  2. MAC address
  3. MTU ( Maximum Transmission Unit)

To display network settings of a specific interface use the command as:

ifconfig <interfaceName>

Enabling or Disabling the Interface

To disable the interface we use the command:

ifconfig <interfaceName> down

To enable a network interface we use the command:

ifconfig <interfaceName> up

Setting up IP Address, Subnet Mask and Broadcast Address

To assign an IP Address to network interface use the command:

ifconfig <interfaceName> <IP Address>

To assign subnet mask to network interface use the command:

ifconfig <interfaceName> netmask <Subnet Mask>

To assign a broadcast address to network interface use the command:

ifconfig <interfaceName> broadcast <Broadcast Address>

To assign an IP address, netmask and broadcast address all at once use the command:

ifconfig <interfaceName> <IP Address> netmask <Subnet Mask> broadcast <Broadcast Address>

Setting up MAC Address to an Interface

To change the MAC address of an Interface use the command:

ifconfig <interfaceName> hw ether <MAC address>

Finally in order to get more information about ifconfig command use commands like man ifconfig or ifconfig --help at the terminal.

--

--