Study and Use of ifconfig Command

 

 Experiment

 Study and Use of ifconfig Command

🎯 Aim

To familiarize students with the ifconfig command in Linux for viewing and configuring network interfaces.


πŸ“˜ Objective

By the end of this experiment, students will be able to:

  • Display network interface details
  • Enable/disable network interfaces
  • Assign IP addresses manually
  • Understand key networking parameters

🧰 Prerequisites

  • Linux system (e.g., Ubuntu/Debian/Kali)
  • Basic terminal knowledge
  • Root or sudo privileges

πŸ“– Theory

The ifconfig (interface configuration) command is used to:

  • View network interface configuration
  • Assign IP addresses
  • Enable or disable interfaces

⚠️ Note: On modern systems, ifconfig is deprecated and replaced by the ip command (from iproute2), but it is still widely used for learning and legacy systems.


🧾 Syntax

ifconfig [interface] [options]
  • interface → Network interface name (e.g., eth0, wlan0)
  • options → Actions like up, down, assigning IP, etc.

πŸ”¬ Procedure & Commands

1️⃣ Display All Network Interfaces

ifconfig

πŸ‘‰ Shows:

  • Interface names
  • IP address
  • MAC address
  • Packet statistics

2️⃣ Display Specific Interface

ifconfig eth0

πŸ‘‰ Replace eth0 with your interface name.


3️⃣ Enable a Network Interface

sudo ifconfig eth0 up

πŸ‘‰ Activates the interface.


4️⃣ Disable a Network Interface

sudo ifconfig eth0 down

πŸ‘‰ Deactivates the interface.


5️⃣ Assign an IP Address

sudo ifconfig eth0 192.168.1.10

πŸ‘‰ Assigns a static IP.


6️⃣ Assign IP with Netmask

sudo ifconfig eth0 192.168.1.10 netmask 255.255.255.0

7️⃣ Change MAC Address

sudo ifconfig eth0 hw ether 00:11:22:33:44:55

8️⃣ Check Packet Statistics

ifconfig eth0

πŸ‘‰ Look for:

  • RX packets (received)
  • TX packets (transmitted)

πŸ“Š Sample Output (Important Fields Explained)

  • inet → IP address
  • netmask → Subnet mask
  • broadcast → Broadcast address
  • ether → MAC address
  • RX/TX → Data packets

πŸ“ Exercises for Students

  1. List all network interfaces on your system.
  2. Identify your system’s IP address.
  3. Disable and re-enable a network interface.
  4. Assign a temporary IP address and verify it.
  5. Observe packet count changes after browsing the web.

❓ Viva Questions

  • What is the purpose of ifconfig?
  • Difference between ifconfig and ip command?
  • What is a MAC address?
  • What happens when an interface is brought down?

⚠️ Precautions

  • Use sudo carefully to avoid misconfiguration
  • Do not change IP settings on production systems
  • Always verify interface name before executing commands

✅ Result

The ifconfig command helps in managing and monitoring network interfaces. It is a fundamental tool for understanding Linux networking basics.

Comments

Popular posts from this blog

Networks Lab PCCSL507 Semester 5 KTU CS 2024 Scheme - Dr Binu V P

Analysis of HTTP Protocol using Wireshark