In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to use the nmcli command to manage the network in the Linux of the RedHat department". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use the nmcli command to manage the network in the Linux of the RedHat department.
The default network service in Red Hat Enterprise Linux 7 and CentOS 7 is provided by NetworkManager, which is a daemon that dynamically controls and configures the network. It is used to keep current network devices and connections working, while also supporting traditional ifcfg type configuration files.
NetworkManager can be used for the following types of connections: Ethernet,VLANS,Bridges,Bonds,Teams,Wi-Fi,mobile boradband (such as Mobile 3G) and IP-over-InfiniBand. For these network types, NetworkManager can configure their network aliases, IP addresses, static routes, DNS,VPN connections, and many other special parameters.
You can use the command line tool nmcli to control NetworkManager.
Nmcli usage
The code is as follows:
# 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:
The code is as follows:
# nmcli general status
This command prints out all the states of the NetworkManager.
The code is as follows:
# nmcli connection show
Show all connections.
The code is as follows:
# nmcli connection show-a
Only currently active connections are displayed.
The code is as follows:
# nmcli device status
List the devices identified by NetworkManager and their status.
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:
The code is as follows:
# nmcli device disconnect eno16777736
The following command is used to start the interface:
The code is as follows:
# nmcli device connect eno16777736
Add Ethernet connection to static IP
The following command adds an Ethernet connection to a static IP address:
The code is as follows:
# 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).
The code is as follows:
# 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:
The code is as follows:
# nmcli connection modify NEW ipv4.dns "8.8.8.8 8.8.4.4"
The following command starts a new Ethernet connection:
The code is as follows:
# nmcli connection up NEW ifname eno16777736
View the configuration information for the new connection:
The code is as follows:
# nmcli-p connection show NEW
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
The code is as follows:
# nmcli connection add type ethernet con-name NEW_DHCP ifname eno16777736
At this point, I believe you have a deeper understanding of "how to use nmcli commands in RedHat Linux to manage the network". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.