ifconfig – Simple Guide

What is ifconfig?

ifconfig (interface configuration) is a Linux/Unix command used to view and configure network interfaces on a system.

It shows details like IP address, MAC address, interface status, and packet statistics.

Why is ifconfig used?

Basic ifconfig Usage

1. Display all network interfaces

ifconfig

2. Display a specific interface

ifconfig eth0

3. Bring an interface up or down

ifconfig eth0 up
ifconfig eth0 down

4. Assign IP address (temporary)

ifconfig eth0 192.168.1.10 netmask 255.255.255.0

Understanding ifconfig Output

ifconfig Troubleshooting (Common Issues)

1. Command not found

ifconfig: command not found

Cause: net-tools package not installed (common in modern Linux).

Fix:

sudo yum install net-tools
sudo apt install net-tools

2. Interface has no IP address

Cause: DHCP not assigned or interface down.

Fix:

ifconfig eth0 up
systemctl restart network

3. Network not working but interface is up

Possible causes: Wrong gateway, DNS issue, routing problem.

Check:

route -n
cat /etc/resolv.conf

Important Notes

Key Interview Points