Linux ifconfig command

The ifconfig command is used in Linux and Unix-like operating systems to configure and display information about network interfaces. It allows you to view and modify network interface settings, such as IP addresses, netmasks, and network-related parameters.

However, it’s important to note that ifconfig has been deprecated in favor of the ip command, which provides more advanced and flexible network configuration options. Nonetheless, ifconfig is still widely used and available in many Linux distributions.

The basic syntax of the ifconfig command is as follows:

ifconfig [interface] [options]

Here, [interface] refers to the network interface you want to configure or display information for, such as eth0 or wlan0. If no interface is specified, ifconfig displays information for all active interfaces.

Some commonly used options with ifconfig include:

  • up: Activates the specified interface.
  • down: Deactivates the specified interface.
  • inet addr: Sets the IPv4 address for the interface.
  • netmask: Sets the netmask for the interface.
  • broadcast: Sets the broadcast address for the interface.
  • hw ether: Sets the MAC address (Ethernet address) for the interface.
  • promisc: Enables promiscuous mode on the interface.
  • mtu: Sets the Maximum Transmission Unit (MTU) size for the interface.

To use the ifconfig command, open a terminal and enter the command followed by the desired options and the interface name. Here are a few examples:

  1. Display information for all active network interfaces:
  1. Activate a specific interface:
ifconfig eth0 up
  1. Configure the IP address and netmask for an interface:
ifconfig eth0 inet netmask
  1. Set the MAC address for an interface:
ifconfig eth0 hw ether 00:11:22:33:44:55

These are just a few examples, and there are many more options and variations you can use with the ifconfig command. To explore additional options and information, you can refer to the ifconfig command’s manual page by typing man ifconfig in the terminal.