目录
一、打开网卡配置文件
vi /etc/sysconfig/network-scripts/ifcfg-ens33
![](https://img-blog.csdnimg.cn/img_convert/b22de3729188a868f315525700103c5f.png)
二、修改参数
(1)BOOTPROTO=static #dhcp:自动分配ip ,static:静态ip
![](https://img-blog.csdnimg.cn/img_convert/44b6484df4f3ea8e4ecf3dc477f342f6.png)
(2)ONBOOT=yes #开启启动必须是yes
![](https://img-blog.csdnimg.cn/img_convert/866fd839ae74c4162d792477eeb8c7e9.png)
三、 设置IP和掩码等
直接在最后面加上这几行就可以了
IPADDR=10.100.100.15 #IP地址
NETMASK=255.255.255.0 #掩码
GATEWAY=10.100.100.2 #网关
DNS1=10.100.100.2 #域名服务器1
DNS2=8.8.8.8 #域名服务器2
![](https://img-blog.csdnimg.cn/img_convert/91448b5ff87444b4321aec162f638117.png)
然后按(1)esc(2)shift+:(3)wq保存退出
![](https://img-blog.csdnimg.cn/img_convert/b498e8b2c8b3551b0082504f1ef313e2.png)
四、重启服务
systemctl restart network
![](https://img-blog.csdnimg.cn/img_convert/7101e5524b5b1b71986199fd18af6d18.png)