ifconfig command on Linux (configures network interface)
The ifconfig command in Linux creates and configures network interfaces and their parameters. This operation is generally done during the system loading process. If no parameters are passed, it displays the settings of the active interfaces.
The ifconfig command is no longer used in distributions, the use of the ip command is preferred.
The ifconfig parameters can be:
- interface: It is the name of the network interface. This is usually the name of the driver followed by a unit number. For example, eth0 for the first ethernet network device;
- up: This parameter enables the network interface for use;
- down: This parameter disables the network interface;
- [-] arp: Enables or disables the use of the ARP (Address) protocol Resolution Protocol);
- [-] promisc: Enables or disables the promiscuous mode of an interface. In this mode it will receive all network packets;
- mtu num: Configures the MTU (Maximum Transfer Unit) to num on an interface;
- address: Configures an IP address for the interface;
- netmask mask: Configures a certain subnet mask for the interface.
Examples:
To configure the IP, mask, and broadcast of a network card:
To lift a network interface:
To view a particular network interface:
The ifconfig command can be used to verify IPv4 and IPv6 network addresses.