Configuring Network Access on RHEL/CentOS 7.x Using nmcli
The NetworkManager command-line tool (nmcli) provides a command line way to configure networking by controlling NetworkManager. This section provides only an overview with some examples to help you learn how to use nmcli to configure network access on the virtual appliance.
In a departure from previous approaches to network interface configuration, NetworkManager deals with both connections and interfaces (also known as devices). Connections are configured with IP addresses, gateways, DNS servers, and then applied to interfaces (devices). This is a critical change from the past way of configuring network access on CentOS Linux.
First, there are two nmcli commands that are of general usefulness:
The nmcli d command lists all available network interfaces (devices).
The nmcli c command lists all available configurations.
Use the above two commands frequently as you are learning to use nmcli.
Follow the steps below to configure an IP address for an interface on your virtual appliance. Typically these commands are typed directly into the console of the virtual appliance. If you are already connected through the network (for example, by ssh), then making changes to the network interface configuration can be problematic, as you may also lose network connectivity (and thereby your ability to issue nmcli commands) at any point in the process.
Make sure that the interface does not block nmcli. The nmcli d command lists the existing interfaces. If the interface you want to configure is listed as unmanaged, then NetworkManager has been explicitly blocked from configuring this interface. Until you remove this blockage, no
Make sure that there is no current configuration for the interface that you want to configure. If you want the configuration
that you create to be the default for the interface and there are multiple configurations associated with an interface, it
may lead to confusion when the system reboots. The
If you see any output, you should remove the configuration
Create the configuration and associate it with the interface (device) in one command. This command only creates the configuration and associates it with the interface, it does not apply it to the interface.
Add the DNS server to the configuration for the interface (device):
Apply the configuration to the interface, which will bring up the interface if it was not already running:
Use the following command to examine information about a connection. You may examine information about a connection by using this command:
Use the command
After you configure the networking you must restart CPNR in order for the interfaces to be properly discovered by CPNR. Use the following commands to restart: /etc/init.d/nwreglocal restart (for Local RHEL/CentOS 6.x) or systemctl restart nwreglocal (for Local RHEL/CentOS 7.x), /etc/init.d/nwregregion restart (for Regional RHEL/CentOS 6.x) or systemctl restart nwregregion (for Regional RHEL/CentOS 7.x). If you fail to restart, it will result in a misconfigured registration at the regional.
To develop a complete understanding of the usage of nmcli, search the internet for online resources on nmcli and CentOS 7.4.