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

How to set a static IP address in centos7

藏色散人
Release: 2021-03-16 17:31:40
forward
6475 people have browsed it

The tutorial column of centos below will introduce to you how to set a static IP address in centos7. I hope it will be helpful to friends who need it!

1. View IP configuration information

ifconfig
Copy after login

As shown in the picture above, my em1 network card has been configured

2. Edit em1 The corresponding configuration file is located at /etc/sysconfig/network-scripts/ifcfg-your network card name

Operation: vim /etc/sysconfig/network-scripts/ifcfg- Your network card name, press the i key to enter editing. After editing, Esc exits editing→Shift q→!wq→x

Modify the configuration file as shown below

Parameter description:

BOOTPROTO= # 使用静态IP地址,默认为dhcp 
IPADDR=====yes  #设置网卡启动方式为 开机启动 并且可以通过系统服务管理器 systemctl 控制网卡
Copy after login

3 , modify /etc/sysconfig/network

# Created by anaconda
NETWORKING=yes
GATEWAY=19.37.33.1
Copy after login

4, restart the network service

service network restart;
Copy after login

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!

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