Enable Nic enable DHCP in Centos 7 to automatically obtain IP addresses
By default, Centos7 does not enable Nic configuration. That is to say, all network interfaces are available and the Internet cannot be accessed. Because I am locally installed, I don't want to spend a long time setting static IP addresses too slowly, directly enable the network function to automatically obtain the ip address, which is fast, simple, and does not waste time. After centos7 automatically obtains the IP address, it is much easier to set up the centos system through Terminal login program editing; later, I saw someone else's blog on the Internet and wrote it to myself.
I. View Nic Information
In centos 7, the IP address command is ip add.
The last line 00: 0c: 29: 58: 27: 57 is the mac address of the local Nic:
Ifcfg-eno16777736 this is the name of the local Nic, also need to use later;
2. Configure the NIC to enable the network connection
1
2
Cd/etc/sysconfig/network-scripts/# enter the network configuration file directory
Viifcfg-eno16777736 # edit the configuration file and add to modify the following content
HWADDR = 00: 0c: 29: 58: 27: 57
TYPE = Ethernet
BOOTPROTO = DHCP
DEFROUTE = yes
PEERDNS = yes
PEERROUTES = yes
20174_failure_fatal = no
IPV6INIT = yes
IPV6_AUTOCONF = yes
Required 6_defroute = yes
IPV6_PEERDNS = yes
20176_peerroutes = yes
20176_failure_fatal = no
NAME = eno16777736
UUID = 71557f7c-446c-4145-8151-1f52f07b8b12
ONBOOT = yes # enable network connection automatically
The mac address of the first line is added here, And the last line is changed to yes to enable the network connection.
Next, restart the NIC to make the NIC settings take effect. Last step: Save and modify the configuration.
: Wq! # Save and exit
Service network restart # restart the network