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

Share two ways to modify IP in Centos

藏色散人
Release: 2020-07-27 13:51:01
forward
3378 people have browsed it

The following column centos introductory tutorial will 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 current ip 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

root user. Enter the network configuration filenetwork-scripts directory. cd /etc/sysconfig/network-scripts/

Find the configuration file we need to modify

Use the

ls command 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

vim command (vi Commands can also be used),Configure the file,

We need to modify it

BOOTPROTO="static"That is, change dhcp to static, modify ONBOOT = "yes" means to set the network card to be enabled at boot, and add below 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 the service network restart command to restart the network service.

For more centos related technical articles, please visit the centos system tutorial column!

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!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template