In Linux, ifconfig
is a command-line utility used for configuring and managing network interfaces. It allows you to view interface configurations, enable/disable interfaces, assign IP addresses, and more. While commonly used, ifconfig
is now often deprecated in favor of the ip
command, which offers more features and flexibility.
Here's a summary of key ifconfig
functions:
- Running
ifconfig
without any arguments displays information about all active network interfaces, including their IP addresses, netmasks, and other details. - You can enable or disable a network interface using
ifconfig interface up
orifconfig interface down
, respectively. - You can assign an IP address to an interface using
ifconfig interface inet [ip_address]
. - You can configure the netmask for an interface using
ifconfig interface netmask [subnet_mask]
. ifconfig
can help diagnose network issues by providing insights into interface status and configuration.
Example Usage:
ifconfig
: Displays all active interface configurations.ifconfig eth0 up
: Enables the interface namedeth0
.ifconfig eth0 down
: Disables the interface namedeth0
.ifconfig eth0 192.168.1.10 netmask 255.255.255.0
: Assigns the IP address192.168.1.10
and netmask255.255.255.0
to the interfaceeth0
.