How to modify IP in centos

藏色散人
Release: 2020-11-03 16:53:03
Original
58362 people have browsed it

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.

How to modify IP in centos

Recommended: "centos tutorial"

Two ways for Centos to modify IP

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 you are in

root

Operate under the 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 , 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!

Related labels:
source:php.cn
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!