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,
ifconfigis deprecated and replaced by theipcommand (fromiproute2), but it is still widely used for learning and legacy systems.
π§Ύ Syntax
-
interface→ Network interface name (e.g.,eth0,wlan0) -
options→ Actions like up, down, assigning IP, etc.
π¬ Procedure & Commands
1️⃣ Display All Network Interfaces
π Shows:
- Interface names
- IP address
- MAC address
- Packet statistics
2️⃣ Display Specific Interface
π Replace eth0 with your interface name.
3️⃣ Enable a Network Interface
π Activates the interface.
4️⃣ Disable a Network Interface
π Deactivates the interface.
5️⃣ Assign an IP Address
π Assigns a static IP.
6️⃣ Assign IP with Netmask
7️⃣ Change MAC Address
8️⃣ Check Packet Statistics
π 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
- List all network interfaces on your system.
- Identify your system’s IP address.
- Disable and re-enable a network interface.
- Assign a temporary IP address and verify it.
- Observe packet count changes after browsing the web.
❓ Viva Questions
-
What is the purpose of
ifconfig? -
Difference between
ifconfigandipcommand? - What is a MAC address?
- What happens when an interface is brought down?
⚠️ Precautions
-
Use
sudocarefully 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
Post a Comment