Detailed explanation of nmcli usage in CentOS8

Detailed explanation of nmcli usage in CentOS8

Common nmcli commands based on RHEL8/CentOS8

# View IP (similar to ifconfig, ip addr)
nmcli
# Create a connection, configure a static IP (equivalent to configuring ifcfg, where BOOTPROTO=none, and start it with ifup)
nmcli c add type ethernet con-name ethX ifname ethX ipv4.addr 192.168.1.100/24 ​​ipv4.gateway 192.168.1.1 ipv4.method manual
# Create a connection and configure a dynamic IP (equivalent to configuring ifcfg, where BOOTPROTO=dhcp and ifup is used to start the connection)
nmcli c add type ethernet con-name ethX ifname ethX ipv4.method auto
# Modify ip (non-interactive)
nmcli c modify ethX ipv4.addr '192.168.1.200/24'
nmcli c up ethX
# Modify ip (interactive)
nmcli c edit ethX
nmcli> goto ipv4.addresses
nmcli ipv4.addresses> change
Edit 'addresses' value: 192.168.1.200/24
Do you also want to set 'ipv4.method' to 'manual'? [yes]: yes
nmcli ipv4> save
nmcli ipv4> activate
nmcli ipv4> quit
# Enable connection (equivalent to ifup)
nmcli c up ethX
# Stop connection (equivalent to ifdown)
nmcli c down
# Delete connection (similar to ifdown and delete ifcfg)
nmcli c delete ethX
# View the connection list nmcli c show
# View connection details nmcli c show ethX
# Reload all ifcfg or route to connection (will not take effect immediately)
nmcli c reload
# Reload the specified ifcfg or route to connection (will not take effect immediately)
nmcli c load /etc/sysconfig/network-scripts/ifcfg-ethX
nmcli c load /etc/sysconfig/network-scripts/route-ethX
# Connection takes effect immediately. There are three methods: nmcli c up ethX
nmcli d reapply ethX
nmcli d connect ethX
# View the device list nmcli d
# View all device detailed information nmcli d show
# View detailed information about the specified device nmcli d show ethX
# Activate the network card nmcli d connect ethX
# Disable wireless network (NM enables wireless network by default)
nmcli r all off
# Check the NM management status nmcli n
# Enable NM management nmcli n on
# Disable NM management (execute with caution)
nmcli n off
#Monitoring events nmcli m
# View the status of NM itself nmcli
# Check whether NM is available online nm-online

The ifcfg mentioned above refers to /etc/sysconfig/network-scripts/ifcfg-ethX and /etc/sysconfig/network-scripts/route-ethX

Summarize

The above is the introduction of nmcli usage in CentOS8 by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • CentOS7 uses yum to install mysql 8.0.12
  • When installing jdk1.8 on centos, there is no /lib/ld-linux.so.2: Cause analysis of this file
  • Detailed steps for installing and configuring MySQL 8.0 on CentOS
  • Detailed steps to install and configure k8s cluster in centos 7
  • Centos7.3 jre1.8 installation and configuration tutorial
  • Solution to E_INVALIDARG (0x80070057) when installing Centos6.8 in VirtualBox

<<:  The whole process of implementing the summary pop-up window with Vue+Element UI

>>:  Detailed graphic description of the database installation process of MySQL version 5.7.24

Recommend

CSS screen size adaptive implementation example

To achieve CSS screen size adaptation, we must fi...

JavaScript web page entry-level development detailed explanation

Part 3: ❤Three ways to overlook backend data rece...

Are the value ranges of int(3) and int(10) the same in mysql

Table of contents Question: answer: Reality: Know...

Explanation of the problem that JavaScript strict mode does not support octal

Regarding the issue that JavaScript strict mode d...

In-depth explanation of the maximum value of int in MySQL

Introduction I will write about the problem I saw...

How to define data examples in Vue

Preface In the development process, defining vari...

How to use Vue-router routing

Table of contents 1. Description 2. Installation ...

Solution to the problem of saving format in HTML TextArea

The format of textarea can be saved to the databas...

Detailed explanation of mkdir command in Linux learning

Table of contents Preface 1. Basic knowledge of f...

Vue makes a simple random roll call

Table of contents Layout part: <div id="a...

Tomcat parses XML and creates objects through reflection

The following example code introduces the princip...

Javascript uses the integrity attribute for security verification

Table of contents 1. Import files using script ta...