ifconfig command in Linux with Examples

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]

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

Full stack web developer | GCI 18 Mentor | JSec at IIITV Coding Club

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.