After installing CentOS7.7 How to configure network settings I think there is a part to worry about, so I will specify the procedure.
Condition: CentOS 7.7 is already installed Select Infrastructure Server for software at installation
First, log in with an account that has administrator privileges.
CentOS7.7
localhost login:
Make sure the prompt is "#". If it is "$", log in as a user who does not have administrator privileges. Since it is, log in again as root.
CentOS7.7
[[email protected] ~]#
Check the NIC information to be set.
CentOS7.7
[[email protected] ~]#nmcli d
Check the C network information to be set.
CentOS7.7
[[email protected] ~]#nmcli c show
Enter the network setting command.
Here, the network settings are as follows. IP address: 192.168.0.1 Subnet: 255.255.255.0 Gateway: 192.168.0.254 DNS: 8.8.8.8 NIC: eth0
CentOS7.7
[[email protected] ~]#nmcli c mod eth0 ipv4.method manual ipv4.addresses 192.168.0.1/24 ipv4.gateway 192.168.0.254 ipv4.dns 8.8.8.8 connection.autoconnect yes
Of course, you can set them separately.
CentOS7.7
#Enabling the interface called eth0(If it is disabled, communication is not possible even if the IP address is set.)
[[email protected] ~]#nmcli c modify eth0 connection.autoconnect yes
#eth0 IP address and subnet settings
[[email protected] ~]#nmcli c modify eth0 ipv4.addresses 192.168.0.1/24
#Setting the default gateway for eth0
[[email protected] ~]#nmcli c modify eth0 ipv4.gateway 192.168.0.254
#Disable DHCP for eth0
[[email protected] ~]#nmcli c modify eth0 ipv4.method manual
#DNS settings for eth0
[[email protected] ~]#nmcli c modify eth0 ipv4.dns 8.8.8.8
Enter the following command to restart the NetworkManager service.
CentOS7.7
[[email protected] ~]#systemctl restart NetworkManager
Enter the following command to restart the network service
CentOS7.7
[[email protected] ~]#systemctl restart NetworkManager
Check if the network settings are set correctly.
It is OK if the following settings are reflected. BOOTPROTO = no (DHCP disabled) IPADDR = 192.168.0.1 (IP address) PREFIX = 24 (subnet) ONBOOT = yes (NIC enabled: enabled after reboot) GATEWAY = 192.168.0.254 (gateway) DNS1=8.8.8.8 (Google Public DNS)
CentOS7.7
[[email protected] ~]#cat /etc/sysconfig/network-script/ifcfg-eth0
(Just in case) Check if the NIC is enabled with the following command.
CentOS7.7
#It is OK if eth0 is connected.
[[email protected] ~]#nmcli d
Return to the CentOS screen and ping 8.8.8.8 (Google Public DNS).
CentOS7.7
#If the ping is successful, you have successfully connected to the external network.
#If it fails, you must first disable selinux settings and Firewalld services.
[[email protected] ~]#ping 8.8.8.8
If you have created CentOS 7.7 with a hypervisor, Check that the NIC value may be different.
Also, if communication is not possible even after enabling the NIC, If the NIC settings on the hypervisor side are disabled, or Even if the NIC is not assigned on the virtual machine in the first place Please check it because it is there.
The basic settings after network settings are as follows. Initial network settings for CentOS 7 after installation In addition, I referred to the following site. [How to set up the network with NetworkManager_CLI_ (nmcli) ](How to set up the network with http://www.maruko2.com/mw/NetworkManager_CLI(nmcli)_)
That is all.
Recommended Posts