Home >Operation and Maintenance >CentOS >How to set a static IP address in centos7
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
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 控制网卡
3 , modify /etc/sysconfig/network
# Created by anaconda NETWORKING=yes GATEWAY=19.37.33.1
4, restart the network service
service network restart;
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!