How to modify IP in centos: 1. Check the current IP address of the system, and use the nmtui command to bring up the modification window, and then restart the network card; 2. Enter the network configuration file network-scripts directory, and then use the vim command to modify the file Just configure it.
Recommended: "centos tutorial"
Two ways for Centos to modify IP
Method 1:
View the currentip address of the system:ip add
##nmtui command brings up the modification window:nmtui
##Restart the network card:
/etc/init.d/network restart
##Or:
service network restart
Method 2:
Enter the network configuration file directory
##First, make sure you are in
rootOperate under the user. Enter the network configuration filenetwork-scriptsdirectory.cd /etc/sysconfig/network-scripts/
Find the configuration file we need to modify
Use the
lscommand to list the files in the directory. Among them, the"ifcfg-ens33"file is the network configuration file we need to modify.Modify the configuration file
Use the
vimcommand (viCommands can also be used),Configure the file,We need to modify it
BOOTPROTO="static"That is, changedhcptostatic, modifyONBOOT = "yes"means to set the network card to be enabled at boot, and addbelow the text.IPADDR=192.168.0.230#STATIC IP
##GATEWAY=192.168.0.1#Default Gateway
NETMASK=255.255.255.0#Subnet Mask
##DNS1=192.168.0.1#DNS Configuration
DNS2=8.8.8.8#Google Address
ESC: WQ, save and exit!
Restart the network service
Use theservice network restartcommand , restart the network service.
The above is the detailed content of How to modify IP in centos. For more information, please follow other related articles on the PHP Chinese website!