Skip to main content

ifconfig command

Detailed Explanation

ifconfig (interface configuration) is a legacy command-line utility used for network interface configuration, tuning, and debugging in Unix-like operating systems. It has been officially deprecated in most modern Linux distributions in favor of the ip command, but it is still widely recognized.

Basic Syntax

ifconfig [interface]
ifconfig interface [options] [address]

Common Flags/Options

OptionDescription
-aDisplay all interfaces, including those that are down.
upActivate the specified network interface.
downDeactivate the specified network interface.
promiscEnable promiscuous mode on the interface.
netmask <addr>Set the IP network mask for the interface.

Real-world Examples

Display information for all active interfaces:

ifconfig

Display information for a specific interface:

ifconfig eth0

Bring an interface down:

sudo ifconfig eth0 down

Bring an interface up:

sudo ifconfig eth0 up

Assign an IP address and netmask:

sudo ifconfig eth0 192.168.1.100 netmask 255.255.255.0