CentOS 7 minimal doesn’t get an IP address from DHCP on startup

23,414

Check that ONBOOT is set to yes in /etc/sysconfig/network-scripts/ifcfg-eno1677736.

And a quick fix in case it already is—although not the best one—would be to add ifdown eno1677736; ifup eno1677736 at the bottom of /etc/rc.d/rc.local.

Then save the file and make it executable:

chmod +x /etc/rc.d/rc.local

Now you’ll be running that command on every startup.

Share:
23,414

Related videos on Youtube

qin
Author by

qin

A Student in networking. Love programming.

Updated on September 18, 2022

Comments

  • qin
    qin almost 2 years

    I had install CentOS 7 minimal. The interface eno1677736 is up without an IP address when the OS starts up.

    I restart the interface and it can obtain IP from DHCP server if I run this command:

    ifdown eno1677736; ifup eno1677736
    

    But if I reboot the OS, interface will lose the IP address.

    My question is how to make the interface have an IP address automatically?

    I tried configuring DHCP client as explained here.

    • Dylan Rozendom
      Dylan Rozendom almost 8 years
      unix.stackexchange.com/questions/59789/… Have you tried it this way?
    • qin
      qin almost 8 years
      @DylanRz No, that way will use static ip address. But I must use ip from dhcp server.
    • Jeter-work
      Jeter-work almost 8 years
      That interface name does not look right. Why is it so long? Was that auto assigned by centos or manually based on some organizational standard?
    • qin
      qin almost 8 years
      @Xalorous it's assigned by centos. I just use a VMware Fusion vm.
    • Jeter-work
      Jeter-work almost 8 years
      Oh, ok. I'm still adjusting to the consistent device naming, expecting some other sort of string.
  • qin
    qin almost 8 years
    Oh, I have double check the ONBOOT before I ask. However I still left it no which I thought as on