How to enable networking in Centos7


1.Enter the Centos network card configuration file directory, the path is: /etc/sysconfig/network-scripts

cd /etc/sysconfig/network-scripts


2.Edit the network card file, the network card I use here is: ens33

vi ifcfg-ens33

3.Modify the configuration file onboot to yes, my network card information template

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.Save after modification (press esc, enter wq! and press Enter to save), restart the network service

service network restart


5.The ip is automatically allocated, and the network card information can be viewed through commands

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.