Skip to content
Related Articles

Related Articles

ifconfig command in Linux with Examples
  • Last Updated : 18 May, 2020

ifconfig(interface configuration) command is used to configure the kernel-resident network interfaces. It is used at the boot time to set up the interfaces as necessary. After that, it is usually used when needed during debugging or when you need system tuning. Also, this command is used to assign the IP address and netmask to an interface or to enable or disable a given interface.

Syntax:

ifconfig [...OPTIONS] [INTERFACE]

Newer versions of some Linux distributions don’t have ifconfig command pre-installed. So, in case, there is an error “ifconfig: command not found”, Then execute the following command to install ifconfig.

For Debian, Ubuntu, and related Linux distributions.

sudo apt-get install net-tools

For CentOS or RPM(RedHat Package Manager) based Linux



yum install net-tools

This will install ifconfig along with some other networking commands like arp, route, ipmaddr.

Options:

  • -a : This option is used to display all the interfaces available, even if they are down.

    Syntax:

    ifconfig -a

    Output:

  • -s : Display a short list, instead of details.

    Syntax:

    ifconfig -s

    Output:

  • -v : Run the command in verbose mode – log more details about execution.

    Syntax:



    ifconfig -v

    Output:

  • up : This option is used to activate the driver for the given interface.

    Syntax:

    ifconfig interface up
  • down : This option is used to deactivate the driver for the given interface.

    Syntax:

    ifconfig interface down
  • add addr/prefixlen : This option is used to add an IPv6 address to an interface.

    Syntax:

    ifconfig interface add addr/prefixlen
  • del addr/prefixlen : This option is used to remove an IPv6 address to an interface.

    Syntax:

    ifconfig interface del addr/prefixlen
  • [-]arp : This option is used to enable/disable the use of ARP protocol on an interface.

    Syntax:

    ifconfig interface [-]arp
  • [-]promisc : This option is used to enable/disable the promiscuous mode on an interface. If it is selected, all the packets on the network will be received by the interface.

    Syntax:

    ifconfig interface [-]promisc
  • [-]allmulti : This option is used to enable/disable all-multicast mode for an interface. If it is selected, all the multicast packets will be received by the interface.

    Syntax:

    ifconfig interface [-]allmulti
  • mtu N : The user uses this parameter to set the Maximum Transfer Unit(MTU).

    Syntax:

    ifconfig interface [-]allmulti
  • –help : Display help related to ifconfig command.

    Syntax:

    ifconfig --help

    Output:

My Personal Notes arrow_drop_up
Recommended Articles
Page :