Home > System Tutorial > LINUX > body text

How to change the IP address in Centos7 system?

WBOY
Release: 2024-01-02 18:44:13
forward
1855 people have browsed it

This article mainly explains how to modify the IP address of Centos7

1. Enter the network configuration file directory

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

How to change the IP address in Centos7 system?

2. Find the configuration file we need to modify

Use the ls command to list the files in this directory. Among them, the file "ifcfg-ens33" (red box) is the network configuration file we need to modify.

How to change the IP address in Centos7 system?

3. Modify the configuration file

Use vim command (vi command is also available), to configure the file, we need to modify BOOTPROTO="static", that is, change dhcp to static, modify ONBOOT="yes", which means to set the network card to be enabled at boot, and add

below the text.

IPADDR=192.168.0.230 #staticIP

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 #GoogleAddress

The red box is the modified content, and the purple box is the content that needs to be added.

ESC WQ, save and exit!

How to change the IP address in Centos7 system?

4. Restart the network service

Use the service network restart command to restart the network service. (The red box is the command to restart the network service, and the blue box is the status of restarting the network service)

How to change the IP address in Centos7 system?

5. Check the effect of our changes

Because it is Centos7 now, we use the new command. We enter ip addr to view . (The red box is the view command, the blue box is the network card status)

How to change the IP address in Centos7 system?

related suggestion:

What should I do if centos7 does not have the ifconfig command?

The above is the detailed content of How to change the IP address in Centos7 system?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
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