In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
In CentOS 7, how to manage the network through the nmcli command, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
1. Nmcli usage
# nmcli [OPTIONS] OBJECT {COMMAND | help}
We can complete the command with the TAB key, and when you forget the syntax of this command, just press TAB to see the list of options.
Some examples of using nmcli:
# nmcli general status
This command prints out all the states of the NetworkManager.
# nmcli connection show
Show all connections.
# nmcli connection show-a
Only currently active connections are displayed.
# nmcli device status
List the devices identified by NetworkManager and their status.
2. Start / stop the network interface
Using the nmcli tool to start or stop the network interface is the same as ifconfig's up/down.
Use the following command to stop an interface:
# nmcli device disconnect eno16777736
The following command is used to start the interface:
# nmcli device connect eno16777736
3. Add the Ethernet connection of static IP
The following command adds an Ethernet connection to a static IP address:
# nmcli connection add type ethernet con-name NAME_OF_CONNECTION ifname interface-name ip4 IP_ADDRESS gw4 GW_ADDRESS
Change the NAME_OF_CONNECTION,IP_ADDRESS and GW_ADDRESS parameters according to the configuration you need (omit the last part if you don't need a gateway).
# nmcli connection add type ethernet con-name NEW ifname eno16777736 ip4 192.168.1.141 gw4 192.168.1.1
Use the following command to set up the DNS server:
# nmcli connection modify NEW ipv4.dns "8.8.8.8 8.8.4.4"
The following command starts a new Ethernet connection:
# nmcli connection up NEW ifname eno16777736
View the configuration information for the new connection:
# nmcli-p connection show NEW
4. Add a new connection using DHCP
Add new connections and use DHCP to automatically assign IP addresses, gateways, DNS, etc. All you have to do is remove the ip/gw address after the command line, and DHCP will automatically assign these parameters.
For example, configure a DHCP connection named NEW_DHCP on an eno 16777736 device
# nmcli connection add type ethernet con-name NEW_DHCP ifname eno16777736
This is the answer to the question about how to manage the network through the nmcli command in CentOS 7. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.