ifconfig
Overview
The ifconfig (interface configuration) command is used to configure, control, and query network interface parameters. While newer systems prefer the ip command, ifconfig is still widely used for network interface management.
Syntax
ifconfig [interface] [options]Common Options
| Option | Description |
|---|---|
up |
Activate interface |
down |
Deactivate interface |
netmask addr |
Set netmask address |
broadcast addr |
Set broadcast address |
-a |
Display all interfaces |
mtu N |
Set MTU size |
metric N |
Set interface metric |
promisc |
Set/clear promiscuous mode |
Key Use Cases
- Configure network interfaces
- View network interface status
- Enable/disable interfaces
- Set IP addresses
- Troubleshoot network issues
Examples with Explanations
Example 1: View All Interfaces
ifconfig -aShows all network interfaces, including inactive ones
Example 2: Configure IP Address
ifconfig eth0 192.168.1.100 netmask 255.255.255.0Sets IP address and netmask for eth0
Example 3: Enable/Disable Interface
ifconfig eth0 up
ifconfig eth0 downActivates/deactivates the eth0 interface
Understanding Output
Standard output fields: - Interface name - Link status (UP/DOWN) - Hardware address (MAC) - IP address - Broadcast address - Netmask - MTU size - RX/TX statistics
Common Usage Patterns
Check interface status:
ifconfig eth0Set temporary IP:
ifconfig eth0 192.168.1.100Enable promiscuous mode:
ifconfig eth0 promisc
Performance Analysis
- No real-time monitoring
- Static configuration tool
- Consider using
ipcommand - Check interface statistics
- Monitor packet errors