ifconfig

Linux · Network · reference only

What it does

Shows and configures network interfaces with the classic syntax. It is obsolete compared with ip, but still appears in many manuals.

Syntax

ifconfig [interfaz] [opciones]

Options and parameters

  • -a

    Shows all interfaces, including the ones that are down.

  • -s

    Shows a short table with per-interface statistics.

  • up

    Brings the interface up.

  • down

    Brings the interface down.

  • netmask máscara

    Sets the netmask.

  • mtu N

    Changes the maximum packet size.

Usage examples

  • ifconfig

    Shows the active interfaces with their IP address.

  • ifconfig eth0

    Shows only the data of the eth0 interface.

  • sudo ifconfig eth0 down

    Turns the eth0 interface off.

  • sudo ifconfig eth0 192.168.1.50 netmask 255.255.255.0

    Assigns an address and a netmask to eth0 temporarily.

Notes and common mistakes

  • It ships in the net-tools package, which is not installed by default on Debian 12: sudo apt install net-tools.
  • The modern equivalent is ip addr; changes made with ifconfig do not survive a reboot.

Related commands