Home >Operation and Maintenance >CentOS >How to set a static IP address in centos7

How to set a static IP address in centos7

王林
王林Original
2020-05-19 16:31:116262browse

How to set a static IP address in centos7

1. Open the network card configuration file

vim /etc/sysconfig/network-scripts/ifcfg-ens32

2. Modify the following configuration options

(1) bootproto=static

(2)onboot=yes

(3) Add a few lines at the end, IP address, subnet mask, gateway, dns server

IPADDR=192.168.1.160
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=119.29.29.29
DNS2=8.8.8.8

3. Restart the network service

[root@mini ~]# systemctl restart network

Recommended tutorial: centos tutorial

The above is the detailed content of How to set a static IP address in centos7. 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