[LINUX] CentOS 7 network initialization

Introduction

After installing CentOS7.7 How to configure network settings I think there is a part to worry about, so I will specify the procedure.

conditions

Condition: CentOS 7.7 is already installed Select Infrastructure Server for software at installation

procedure

Login

First, log in with an account that has administrator privileges.

CentOS7.7


localhost login:

Confirmation of administrator privileges

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


[root@localhost ~]#

Check NIC

Check the NIC information to be set.

CentOS7.7


[root@localhost ~]#nmcli d

Check network information

Check the C network information to be set.

CentOS7.7


[root@localhost ~]#nmcli c show 

network settings

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


[root@localhost ~]#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.)
[root@localhost ~]#nmcli c modify eth0 connection.autoconnect yes

#eth0 IP address and subnet settings
[root@localhost ~]#nmcli c modify eth0 ipv4.addresses 192.168.0.1/24 

#Setting the default gateway for eth0
[root@localhost ~]#nmcli c modify eth0 ipv4.gateway 192.168.0.254

#Disable DHCP for eth0
[root@localhost ~]#nmcli c modify eth0 ipv4.method manual

#DNS settings for eth0
[root@localhost ~]#nmcli c modify eth0 ipv4.dns 8.8.8.8

Restart NetworkManager service

Enter the following command to restart the NetworkManager service.

CentOS7.7


[root@localhost ~]#systemctl restart NetworkManager

Restart network services

Enter the following command to restart the network service

CentOS7.7


[root@localhost ~]#systemctl restart NetworkManager

Check for network settings updates

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


[root@localhost ~]#cat /etc/sysconfig/network-script/ifcfg-eth0

NIC activation confirmation

(Just in case) Check if the NIC is enabled with the following command.

CentOS7.7


#It is OK if eth0 is connected.
[root@localhost ~]#nmcli d 

Communication confirmation by PING

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.
[root@localhost ~]#ping 8.8.8.8

At the end

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

CentOS 7 network initialization
CentOS 7 basic settings after network settings
network
[RHEL / CentOS 8] Network settings memo
[CentOS] Network check / change command [RHEL]
Network settings and confirmation in CentOS7
Disable IPv6 on network interface on CentOS Linux 8
Relational Network
CentOS8 server construction (network opening and package update)