Study of nmcli Command

 

Experiment

Study of nmcli Command

๐ŸŽฏ Aim

To configure and manage network connections using the nmcli command in Linux.


๐Ÿ“˜ Objective

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

  • View network devices and connections
  • Connect to wired and wireless networks
  • Configure IP settings
  • Manage network profiles using CLI

๐Ÿ“– Theory

The nmcli (Network Manager Command Line Interface) is used to:

  • Control the NetworkManager service from the terminal
  • Manage network connections (wired, Wi-Fi, VPN)
  • Configure IP addresses, DNS, and gateways

๐Ÿ‘‰ It is a modern and powerful alternative to manual configuration using ifconfig or ip.

๐Ÿ‘‰ It works with:

  • Devices (hardware interfaces)
  • Connections (saved network profiles)

๐Ÿงพ Syntax

nmcli [OPTIONS] OBJECT COMMAND

Common OBJECTS:

  • device → Network interfaces
  • connection → Network profiles
  • general → NetworkManager status

๐Ÿงฐ Prerequisites

  • Linux system with NetworkManager
  • Root/sudo privileges for configuration

๐Ÿ”ฌ Procedure & Commands

1️⃣ Check NetworkManager Status

nmcli general status

2️⃣ List Network Devices

nmcli device status

3️⃣ Show All Connections

nmcli connection show

4️⃣ Display Device Details

nmcli device show

5️⃣ Connect to a Wi-Fi Network

nmcli device wifi connect "SSID_NAME" password "PASSWORD"

6️⃣ List Available Wi-Fi Networks

nmcli device wifi list

7️⃣ Bring Up a Connection

nmcli connection up "connection_name"

8️⃣ Bring Down a Connection

nmcli connection down "connection_name"

9️⃣ Add a New Connection (Static IP)

nmcli connection add type ethernet ifname eth0 con-name mynet ip4 192.168.1.10/24 gw4 192.168.1.1

๐Ÿ”Ÿ Modify Connection Settings

nmcli connection modify mynet ipv4.dns "8.8.8.8"

๐Ÿ–ฅ️ Sample Output

DEVICE     TYPE     STATE     CONNECTION eth0     ethernet     connected     Wired connection 1 wlan0     wifi     disconnected     --

๐Ÿ” Output Interpretation

FieldMeaning
DEVICE            Interface name
TYPE            Network type (ethernet/wifi)
STATE            Current status
CONNECTION            Active connection profile

๐Ÿ“ Exercises for Students

  1. List all network devices and identify their status.
  2. Display saved network connections.
  3. Connect to a Wi-Fi network using nmcli.
  4. Create a new connection with static IP.
  5. Bring a connection down and up again.

❓ Viva Questions

  • What is nmcli?
  • Difference between device and connection?
  • What is NetworkManager?
  • How does nmcli differ from ip command?
  • Why is nmcli useful in servers?

⚠️ Precautions

  • Requires root privileges for configuration
  • Incorrect settings may disconnect network
  • Ensure correct interface and connection names

✅ Result

The nmcli command is a powerful CLI tool for managing network configurations efficiently, especially in systems without a graphical interface.

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