In this post, I will introduce how to change the IP address of CentOS 7 to static IP. Please refer to the following operations.
1. Enter the path /etc/sysconfig/network-scripts/, and confirm the name of the network configuration file, in this example, the name of the network configuration file is ifcfg-ens33.

2. Edit the file with the vi command. The BOOTPROTO parameter is dhcp, indicating that the current device obtains an IP address through DHCP. If you want to change the name, you can modify the DEVICE parameter, but we generally keep the default.

3. Modify BOOTPROTO to static, which means to set the device IP address to static configuration. And add the following parameters after:
IPADDR=192.168.3.10
GATEWAY=192.168.3.1
NETMASK=255.255.255.0
Indicates that the static IP address of the device is set to 192.168.3.10, the mask is 255.255.255.0, and the gateway is 192.168.3.1.

4. Save the file and restart the network service process. It should be noted that in CentOS 7, we can use the command systemctl restart network.

6. Check the IP address of the device, you can see that the IP address, gateway and mask of ens33 have been set.

