Linux (centos) configuration static IP

IP configuration path:
vim /etc/sysconfig/network-scripts/ifcfg-eth0

The configuration file of ifcfg-eth0 is as follows:

DEVICE=eth0            #设备名称
NAME=eth0         #网卡名称      
NM_CONTROLLED=yes  #是否可以由network manager图形管理工具托管,可不填
TYPE=Ethernet     ##接口类型,常见的有ETHERNET(以太网)、Bridge(桥接接口)
ONBOOT=yes     #开机启动
BOOTPROTO=static
USERCTL=no    #是否允许普通用户控制此网卡

#IP信息配置如下,根据实际情况填写
IPADDR=192.168.3.200
NETMASK=255.255.255.0
GATEWAY=192.168.3.1
DNS1=8.8.8.8      #第一DNS服务器指向;若/etc/resolve的配置文件也有,则此处优先
DNS2=208.67.222.222

Finally, restart the network card;

service network restart    #centos6\7通用,
systemctl restart network    #centos7专用
Published 21 original articles · liked 0 · visits 580

Guess you like

Origin blog.csdn.net/u014270566/article/details/105499163