Linux ifconfig command
Linux ifconfig command
The Linux ifconfig command is used to configure and display information about network interfaces on a Linux machine.
ifconfig command
The ifconfig command displays the configuration of the assigned network interface to the server. This includes the MAC address, IPv4 address, IPv6 address, default gateway, transferred and received packet sizes and dropouts, MTU or maximum transmission unit that states the maximum packet size the network interface can transfer, etc.
Syntax
The general syntax of the command is as follows:
$ ifconfig [interface] [options]
If you run ifconfig without any arguments, it will display information about all active network interfaces on your system.
You can provide the interface name as an argument if you want information about a specific interface.
For example:
$ ifconfig eth0
Replace eth0 with the actual interface name you want to inspect.
To configure an interface, you can use the ifconfig command with additional arguments. For example, to set the IP address of an interface, you can use:
$ sudo ifconfig eth0 192.168.1.6
Replace eth0 with the actual interface name and 192.168.1.6 with the desired IP address.
The Windows equivalent of this command is:
- ipconfig command.
Note that ifconfig has been deprecated in many Linux distributions in favor of the new ip command.