nmcli usage examples

Using nmcli may seem scary at the beginning. Spend a little time with it and you’ll like it. The best feature is that it supports tab-completion. Since nmcli is the default network manager in RHEL and it’s derivatives now, learning it will be beneficial. Some nmcli examples are given below. It’s got a good documentation just in case you need more help or something in particular. Just in case you weren’t aware, you can use nmtui which is a nice little ncurses-based tool which runs in the terminal and does the same job.

Starting and stopping network interfaces

# nmcli device connect <connection-name>
# nmcli device disconnect <connection-name>
VirtualBox screenshot of terminal running nmcli examples

VirtualBox screenshot of terminal running nmcli connect and disconnect examples

Add an Ethernet network connection which gets its IP address information from a DHCP server

Configuring a network connection to receive IP addresses information from a DHCP is pretty easy. Just create a new connection with a name, that’s it!

# nmcli connection add con-name "NAME"

Add an Ethernet network connection with a Static IP address

Split this one into 3 parts:

  1. Create a new connection
  2. Add the DNS info to it
  3. Activate the connection
# nmcli con add con-name "NAME" ifname enp0s3 type ethernet ip4 192.168.20.10/24 gw4 192.168.20.1
# nmcli con mod "NAME" ipv4.dns "192.168.20.1,8.8.8.8"
# nmcli con up "NAME" iface enp0s3

You may skip the gw4 argument if your connection doesn’t support it. It’s to specify a network gateway, which is usually your router’s address.

Create new network interface with nmcli. Check the command completion using the tab key.

 

How to tell if your CPU supports Virtualization in Linux

Pretty easy! If your processor is an Intel CPU, then the Virtualization Technology supported is called Virtual Machine Extensions, abbreviated as vmx

If your processor is an AMD, then it should have the Secure Virtual Machine abbreviated as svm.

Check it here in the following file – /proc/cpuinfo

You can either cat it’s contents on the terminal and check the cpu flag manually, or let grep handle the job for you.

cat /proc/cpuinfo

or

grep --color -Ei 'svm|vmx' /proc/cpuinfo

PS: Most of the guest installations in a virtual machine software will have these extensions disabled by default. The reason is that they don’t want you to do virtualization inside a virtualization or you can say, nested virtualization, which may not be supported by the virtual machine software you’re using.