Home>Article>Operation and Maintenance> Share two ways to modify IP in Centos

Share two ways to modify IP in Centos

藏色散人
藏色散人 forward
2020-07-27 13:50:13 3273browse

The following columncentos introductory tutorialwill introduce to you two ways to modify IP in Centos. I hope it will be helpful to friends in need!

Share two ways to modify IP in Centos

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 to operate under the

rootuser. 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 to restart the network service.

For more centos related technical articles, please visit thecentos system tutorialcolumn!

The above is the detailed content of Share two ways to modify IP in Centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete