What is ifconfig
ifconfig is a commandline tool used to display IP address information. It is used to configure network interfaces and to troubleshoot network connectivity issues.
The most simple usage is to execute the command without any arguments. It will output the statuses of all currently active interfaces.
Output can be limited to just one interface by specifying its name as the command argument.
In order to display information about all the network interfaces including the ones which are currently down:
In order to display detailed information about a network interface, a
v option should be used:
ifconfig -v en0
In order to shut down a network interface:
ifconfig down en0
In order to activate a network interface:
ifconfig up en0
In order to assign a static IP address, the network interface should be shut down, IP address, subnet mask, and default gateway entered manually and then the network interface should be activated back again.
ifconfig is considered officially deprecated,
ip command should be used insted.