centos7 fixed host IP

I found that the ip of the previously configured Hadoop environment virtual machine system was automatically changed after a period of time, which made me very painful!

First, you can view and modify the virtual gateway address in the menu Edit -> Virtual Network Editor of VMware workstation.

There is a document ifcfg-eno33 after ls under the /etc/sysconfig/network-scripts/ directory in the system root directory (the numbers behind different machines will be different, and the numbers behind are subject to your own machine: for example, ifcfg-ens33 behind mine) , Edit the content of the file

Take mine as an example, enter the command "vi /etc/sysconfig/network-scripts/ifcfg-ens33" to edit

After entering, press the i key to enter the editing mode (insert shows that it can be modified currently)

After successfully entering edit mode:

Enter and change the value of BOOTPROTO=dhcp to static,
and add the following example form at the end:
DNS1=114.114.114.114 --dns address
IPADDR=192.168.49.128 --The ip address that needs to be set (mostly set the current virtual machine system ip , (Ifconfig command can be viewed))
NETMASK=255.255.255.0 --subnet mask
GATEWAY=192.168.49.1 --gateway

In order to confirm the success of saving, you can enter "vi /etc/sysconfig/network-scripts/ifcfg-ens33" again to view.

After ensuring success, enter the following command "systemctl restart network" or "service network restart" to restart the network service to serve it (CentOS6 network card restart method: service network restart).

Guess you like

Origin blog.csdn.net/qq_43750882/article/details/109602479