4.3 Automating Network Services in Linux: A Guide to nmcli

I'm Vijay Kumar Singh, a Linux, DevOps, Cloud enthusiast learner and contributor in shell scripting, Python, networking, Kubernetes, Terraform, Ansible, Jenkins, and cloud (Azure, GCP, AWS) and basics of IT world. 💻✨ Constantly exploring innovative IT technologies, sharing insights, and learning from the incredible Hashnode community. 🌟 On a mission to build robust solutions and make a positive impact in the tech world. 🚀 Let's connect and grow together!
#PowerToCloud
Introduction:
Ensuring that essential network services start automatically at boot is crucial for maintaining connectivity and accessibility in Linux systems. nmcli, a command-line tool for managing NetworkManager, provides a straightforward way to configure network services to start automatically at boot. In this comprehensive guide, we'll explore how to use nmcli to enable network services, check their status, and ensure seamless connectivity after system reboot.
Checking and Starting NetworkManager Service: Before configuring network services to start at boot, it's essential to ensure that the NetworkManager service is running:
Checking Service Status (
systemctl status NetworkManager.service):systemctl status NetworkManager.serviceThis command checks the status of the NetworkManager service to determine if it's active or inactive.
Starting the Service (
sudo systemctl start NetworkManager.service):sudo systemctl start NetworkManager.serviceIf the NetworkManager service is inactive, use this command to start it manually.
Enabling Service at Boot (
sudo systemctl enable NetworkManager.service):sudo systemctl enable NetworkManager.serviceThis command enables the NetworkManager service to start automatically at boot, ensuring continuous network connectivity.
Configuring Network Services to Start Automatically: nmcli provides a convenient way to configure network services to start automatically at boot:
Listing Configured Connections (
nmcli connection show):nmcli connection showUse this command to list all connections configured for the system, along with their names, UUIDs, types, and devices.
Identifying the Device Name: From the list of connections, identify the device name associated with the network interface you want to configure.
Modifying Connection Settings (
sudo nmcli connection modify <device_name> autocnnect yes):sudo nmcli connection modify enp0s3 autocnnect yesReplace
<device_name>with the name of the network interface you identified. This command modifies the connection settings to enable automatic connection at boot.
Conclusion:
Automating network services to start at boot is essential for maintaining uninterrupted connectivity and accessibility in Linux systems. With nmcli, managing NetworkManager connections and configuring them to start automatically is straightforward and efficient. By following the steps outlined in this guide, you can ensure that essential network services are enabled and ready to go after each system reboot, minimizing downtime and enhancing productivity in your Linux environment.






