Centos7开启网络


1.进入Centos网卡配置文件目录,路径为:/etc/sysconfig/network-scripts

cd /etc/sysconfig/network-scripts

2.编辑网卡文件,我这里使用的网卡为:ens33

vi ifcfg-ens33

3.修改配置文件onboot为yes,我的网卡信息模板

TYPE=Ethernet                                                                   
PROXY_METHOD=none                                                               
BROWSER_ONLY=no                                                                 
BOOTPROTO=dhcp                                                                  
DEFROUTE=yes                                                                    
IPV4_FAILURE_FATAL=no                                                           
IPV6INIT=yes                                                                    
IPV6_AUTOCONF=yes                                                               
IPV6_DEFROUTE=yes                                                               
IPV6_FAILURE_FATAL=no                                                           
IPV6_ADDR_GEN_MODE=stable-privacy                                               
NAME=ens33                                                                      
UUID=7b1fcf2f-baa6-4e6b-8b38-158b54c09c68                                       
DEVICE=ens33                                                                    
ONBOOT=yes                                                                      

4.修改好后保存(按下esc,输入wq!然后回车即可保存),重启网络服务

service network restart

使用的是自动分配ip,可以通过命令查看网卡信息

ip addr
Was this helpful?

I hope to help every developer quickly find the commands they need. Of course, you can also add your own commonly used commands for easy searching.