Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Configure Network Connection Using ‘nmcli’ Tool - DesignLinux

May 29 2020
designlinux 0 Comments

Abbreviated as nmcli, the network manager command-line interface is a nifty and easy to use tool that saves you lots of time when you need to configure an IP address.

Read Also: How to Configure IP Network with ‘nmtui’ Graphical Tool

To display all the active network interfaces on your Linux system execute the command.

$ nmcli connection show
OR
$ nmcli con show

Note that con is the truncated form of connection and you will still end up with the same result as shown.

Check Active Network Interfaces

Check Active Network Interfaces

Also, you can run the command below to display both active and inactive interfaces.

$ nmcli dev status
Check All Network Interfaces

Check All Network Interfaces

Set Static IP Address Using nmcli Tool

Using nmcli tool, you can modify a network interface to use a static IP address. In this example, we will modify the network interface enps03 to use a static IP.

But first, let’s check the IP address using IP command.

$ ip addr
Check Network IP Address

Check Network IP Address

The current IP address is 192.168.2.104 with a CIDR of /24. We are going to configure a static IP with the following values:

IP address:		 192.168.2.20/24
Default gateway:	 192.168.2.1
Preferred DNS:		  8.8.8.8
IP addressing 		  static

First, run the command below to set up the IP address.

$ nmcli con mod enps03 ipv4.addresses 192.168.2.20/24

Next, configure the default gateway as shown:

$ nmcli con mod enps03 ipv4.gateway 192.168.2.1

Then set up the DNS server:

$ nmcli con mod enps03 ipv4.dns “8.8.8.8”

Next , change the addressing from DHCP to static.

$ nmcli con mod enps03 ipv4.method manual
Set Static IP in RHEL 8

Set Static IP in RHEL 8

To save the changes, run the command

$ nmcli con up enps03
Active IP Address of Network

Active IP Address of Network

The changes will be written to /etc/sysconfig/network-scripts/ifcfg-enps03 file.

To confirm the IP, once again run the command:

$ ip addr enps03
Check IP Address

Check IP Address

Additionally, you can view the /etc/sysconfig/network-scripts/ifcfg-enps03 file using cat command.

$ cat /etc/sysconfig/network-scripts/ifcfg-enps03
View Network Interface File

View Network Interface File

And this concludes this guide on configuring network connection using ‘nmcli’ command-line tool on Linux. We hope you found this guide helpful.

Sharing is Caring…
Share on FacebookShare on TwitterShare on LinkedinShare on Reddit

Related

Tags: Networking Tips

How to Install TeamViewer on Ubuntu

Prev Post

25 Things to Do After Installing Ubuntu 20.04 LTS (Focal Fossa)

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 401
  • 655,283

DesignLinux.com © All rights reserved

Go to mobile version