ifconfig Linux Command
Displays or configures network interface parameters (deprecated, use ip).
What does ifconfig do?
Displays or configures network interface parameters (deprecated, use ip).
Syntax
ifconfig [interface]Practical example
ifconfig eth0Questions about ifconfig
How do I display all network interfaces?
Run `ifconfig` without arguments to see all active interfaces, or `ifconfig -a` to show all including inactive ones.
How do I assign an IP address with ifconfig?
Use `sudo ifconfig eth0 192.168.1.100 netmask 255.255.255.0 up` to set an IP address. This is deprecated; use `ip addr` instead.
How do I bring an interface up or down?
Use `sudo ifconfig eth0 up` to enable an interface, or `sudo ifconfig eth0 down` to disable it. The modern equivalent is `ip link set`.
Why is ifconfig deprecated?
ifconfig is part of the net-tools package which is no longer maintained. The `ip` command from iproute2 is the recommended modern replacement.
How do I install ifconfig on Debian/Ubuntu?
Run `sudo apt install net-tools` to install the net-tools package which includes ifconfig.
How do I view only a specific interface?
Use `ifconfig eth0` to show details for just the eth0 interface, including its IP address, MAC address, and statistics.
How do I set a temporary IP address?
Use `sudo ifconfig eth0 192.168.1.100/24 up` or `sudo ip addr add 192.168.1.100/24 dev eth0`. This resets on reboot.
How do I view the MAC address?
Run `ifconfig` and look for the 'ether' or 'HWaddr' field. You can also use `ip link show` to see MAC addresses.
Related Networking Commands
pingSends ICMP echo request packets to test network connectivity to a host.
ipModern replacement for ifconfig. Shows and manipulates routing, devices, and tunnels.
nmapNetwork exploration tool and port scanner (basic usage).
netstatDisplays network connections, routing tables, interface statistics, and more.
iwconfigDisplays and configures wireless network interface parameters.
ssModern replacement for netstat. Dumps socket statistics quickly.