CentOS 7 minimal doesn’t get an IP address from DHCP on startup
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.
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.