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
-aShows all interfaces, including the ones that are down.
-sShows a short table with per-interface statistics.
upBrings the interface up.
downBrings the interface down.
netmask máscaraSets the netmask.
mtu NChanges the maximum packet size.
Usage examples
ifconfigShows the active interfaces with their IP address.
ifconfig eth0Shows only the data of the eth0 interface.
sudo ifconfig eth0 downTurns the eth0 interface off.
sudo ifconfig eth0 192.168.1.50 netmask 255.255.255.0Assigns 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.