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

ifplugstatus [options] [interface]

Common Options:

  • -a → Check all interfaces
  • -v → Verbose output
  • -q → Quiet mode (useful in scripts)

๐Ÿงฐ Prerequisites

  • Linux system
  • ifplugd package installed

Installation (if needed):

sudo apt install ifplugd

๐Ÿ”ฌ Procedure & Commands

1️⃣ Check Status of All Interfaces

ifplugstatus -a

๐Ÿ‘‰ Displays link status of all network interfaces.


2️⃣ Check Specific Interface

ifplugstatus eth0

๐Ÿ‘‰ Replace eth0 with your interface name.


3️⃣ Verbose Output

ifplugstatus -v eth0

๐Ÿ‘‰ Provides detailed information.


4️⃣ Quiet Mode (for scripting)

ifplugstatus -q eth0

๐Ÿ‘‰ Returns only status (no output, useful in shell scripts).


๐Ÿ“Š Sample Output

eth0: link beat detected wlan0: unplugged

๐Ÿ” Output Interpretation

OutputMeaning
link beat detected    Cable is connected
unplugged    Cable is not connected
inactive    Interface is disabled

๐Ÿ“ Exercises for Students

  1. Run ifplugstatus -a and note all interfaces.
  2. Disconnect the Ethernet cable and observe changes.
  3. Reconnect the cable and verify status updates.
  4. Compare output with ifconfig or ip addr.
  5. Use ifplugstatus in a simple shell script to detect connection.

๐Ÿ’ก Example Script

#!/bin/bash if ifplugstatus eth0 | grep -q "link beat detected" then echo "Connected" else echo "Disconnected" fi

❓ Viva Questions

  • What is the purpose of ifplugstatus?
  • Difference between ifplugstatus and ifconfig?
  • 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 ifplugd service 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

Popular posts from this blog

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

Analysis of HTTP Protocol using Wireshark

Study and Use of ifconfig Command