A configure network parameters nmtui
There are a Linux system to configure the network parameters are many ways in which the simplest and most direct way is to directly modify the network card configuration files, but this approach is also very easy to make mistakes, such as IPADDR, NETMASK, GATEWAY parameters such as name I believe very few people can fully Remember, once the input parameter name and error will cause the network service failed to start. nmtui text is a Linux system provides a configuration tool, now we have to configure the network parameters it by nmtui.
1, the implementation nmtui command nmtui
Edit a connection: Editing connection
Activate a connection: activate the connection
Set system hostname: Set the host name
select Set system hostname Enter, the first to set the hostname it. Enter the host name, and then press Tab to <ok> on the carriage. A confirmation box will pop up, OK you can.
Then select Edit a connection, the network parameters to configure it.
<add> option to add a DSL, Ethernet, Bond-peer connection, where we select the card name (ens32) to configure and press Enter.
The configuration of Ipv4 to manual, then <Show>
Enter the following diagram IP address, gateway, and the DNS, and select the IPv4 address and Automatically connect (automatic connection), click <ok>
Note: only edit box use spaces
after returning all the way to exit
Next we look at the NIC configuration file contents
OK, no problem NIC configuration.
Second, the management of network sessions through nmcli
Linux systems use NetworkManager to provide network services by default, this daemon is a dynamic network configuration management, allowing network devices stay connected. You can use NetworkManager nmcli commands to manage the service.
View card information nmcli d
view the connection information
check the specified network card to connect information nmcli connection show ens32
RHEL7 systems support network sessions, allowing users to quickly switch (similar to the regional technical firewalld firewall service) in multiple configuration files. If we are using a laptop, often in the company and at home two to use, then you can configure two network sessions through nmcli, a company network, a home network, simply activate the appropriate network used in different environments session, the network configuration information can be achieved automatically switched.
Create a corporate network session company, use the "connection add con-name type ifname " format, con-name parameter specifies the network session name for the company, ifname parameter specifies the name of the NIC is ens32, autoconnect no express this network session default does not automatically activated, and , ipv4.gateway and ipv4.dns parameter specifies the IP address, gateway and DNS addresses ipv4.addresses. nmcli connection add con-name company ifname ens32 autoconnect no type ethernet ipv4.addresses 192.168.2.211/24 ipv4.gateway 192.168.2.1 ipv4.dns 180.168.255.118
Create a home network sessions house, use dhcp automatically obtain an IP address, so there is no need to manually specify. nmcli connection add con-name house type ethernet ifname ens32
nmcli connection show
Use nmcli command-configured network session is permanent, the network session to enable house after work to go home, the card will be able to automatically obtain the IP address through DHCP. nmcli connection up house
Delete network sessionsnmcli connection delete house