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

Zen coding for editplus example code description

For example, he enters: XML/HTML Code div#page>...

Issues with locking in MySQL

Lock classification: From the granularity of data...

Introduction to HTML Chinese Character Encoding Standard

In HTML, you need to specify the encoding used by...

Sample code for implementing form validation with pure CSS

In our daily business, form validation is a very ...

Difference between MySQL btree index and hash index

In MySQL, most indexes (such as PRIMARY KEY, UNIQ...

How to deploy LNMP architecture in docker

Environmental requirements: IP hostname 192.168.1...

How to build svn server in linux

1: Install SVN yum install -y subversion 2. Creat...

js to achieve simulated shopping mall case

Friends who are learning HTML, CSS and JS front-e...

Solution for mobile browsers not supporting position: fix

The specific method is as follows: CSS Code Copy ...

Steps to install MySQL 5.7 in binary mode and optimize the system under Linux

This article mainly introduces the installation/st...

Tutorial on installing mysql5.7.18 on windows10

This tutorial shares the installation and configu...

Detailed explanation of MYSQL log and backup and restore issues

This article shares MYSQL logs and backup and res...