Home>Article>Operation and Maintenance> How to modify ip in centos

How to modify ip in centos

藏色散人
藏色散人 Original
2020-03-19 13:28:25 14531browse

How to modify ip in centos

How to modify ip in centos?

Two ways for Centos to modify IP

Method 1:

View the current ip address of the system: ip add

How to modify ip in centos

The nmtui command brings up the modification window: nmtui

How to modify ip in centos

How to modify ip in centos

How to modify ip in centos

##Restart the network card: /etc /init.d/network restart

How to modify ip in centos

Or: service network restart

How to modify ip in centos

##Method 2:

Enter the network configuration file directory

First, make sure to operate under the root user. Enter the network configuration file network-scripts directory.

cd /etc/sysconfig/network-scripts/

How to modify ip in centosFind the configuration file we need to modify

Use the ls command to list the files in this directory. The "ifcfg-ens33" file is the network configuration file we need to modify.

How to modify ip in centos

Modify the configuration file

Use the vim command (vi command is also available) to configure the file,

We need to modify BOOTPROTO="static", which means changing dhcp to static, modify ONBOOT="yes", which means setting the network card to be enabled at boot, and add it below the text.

IPADDR=192.168.0.230 #静态IP GATEWAY=192.168.0.1 #默认网关 NETMASK=255.255.255.0 #子网掩码 DNS1=192.168.0.1 #DNS 配置 DNS2=8.8.8.8 #谷歌地址

How to modify ip in centosESC: WQ, save and exit!

Restart the network service

Use the service network restart command to restart the network service.

Recommended video tutorial for learning Linux:

//m.sbmmt.com/course/list/33.html

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!

Statement:
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
Previous article:What does centos mean? Next article:What does centos mean?