Enable Nic enable DHCP in Centos 7 to automatically obtain IP addresses

Source: Internet
Author: User
Tags network function

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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.