Study of ifplugstatus Command
Experiment:
Study of ifplugstatus Command
๐ฏ Aim
To understand and use the ifplugstatus command to detect the physical link status of network interfaces.
๐ Objective
By the end of this experiment, students will be able to:
- Check whether a network cable is connected or not
- Monitor link status of interfaces
- Differentiate between physical and logical connectivity
๐ Theory
The ifplugstatus command is used to:
- Detect whether a network interface has a physical connection (link)
- Report if the Ethernet cable is plugged in or unplugged
It works with the ifplugd daemon, which monitors Ethernet devices for plug/unplug events.
๐ Unlike ifconfig, which shows configuration, ifplugstatus focuses on physical connectivity status.
๐งพ Syntax
Common Options:
-
-a→ Check all interfaces -
-v→ Verbose output -
-q→ Quiet mode (useful in scripts)
๐งฐ Prerequisites
- Linux system
-
ifplugdpackage installed
Installation (if needed):
๐ฌ Procedure & Commands
1️⃣ Check Status of All Interfaces
๐ Displays link status of all network interfaces.
2️⃣ Check Specific Interface
๐ Replace eth0 with your interface name.
3️⃣ Verbose Output
๐ Provides detailed information.
4️⃣ Quiet Mode (for scripting)
๐ Returns only status (no output, useful in shell scripts).
๐ Sample Output
๐ Output Interpretation
| Output | Meaning |
|---|---|
| link beat detected | Cable is connected |
| unplugged | Cable is not connected |
| inactive | Interface is disabled |
๐ Exercises for Students
-
Run
ifplugstatus -aand note all interfaces. - Disconnect the Ethernet cable and observe changes.
- Reconnect the cable and verify status updates.
-
Compare output with
ifconfigorip addr. -
Use
ifplugstatusin a simple shell script to detect connection.
๐ก Example Script
❓ Viva Questions
-
What is the purpose of
ifplugstatus? -
Difference between
ifplugstatusandifconfig? - What is “link beat”?
- Why is this command useful in networking?
⚠️ Precautions
- Works mainly for wired Ethernet interfaces
- May not work reliably for Wi-Fi interfaces
-
Ensure
ifplugdservice is installed and running
✅ Result
The ifplugstatus command helps detect physical connectivity of network interfaces, making it useful for troubleshooting cable connections and network availability.
Comments
Post a Comment