Page 1 of 1

dhclient.lease file is empty on first boot

Posted: 2018/09/05 09:07:48
by nupurpriya
Hi,

After installing the CentOS 7 ISO, and configuring dhclient, I restarted "network" service. But my resolv.conf is empty, however, I got IP from DHCP server. After digging I find out that dhclient. lease file was also empty. when I ran dhclient eth0 command, dhclient. lease file got updated with proper info and also my resolv.conf got updated with DNS entries.

So my question is, why it is not getting updated on network restart, as suggested in all configuration documentation. How could I automate this process for first boot? The same kind of setup I had with CentOS 6, but there I never had to run dhclient command to make it work. What has been changed in 7 which could be possibly doing it? Please help.

Re: dhclient.lease file is empty on first boot

Posted: 2018/09/06 08:34:37
by jlehtone
nupurpriya wrote:
2018/09/05 09:07:48
After installing the CentOS 7 ISO, and configuring dhclient, I restarted "network" service.
The default for CentOS 7 is to install NetworkManager service, with config details set in the Anaconda installer.

https://wiki.centos.org/FAQ/CentOS7


How did your install differ from the default?

Re: dhclient.lease file is empty on first boot

Posted: 2018/09/06 09:52:31
by TrevorH
And NetworkManager keeps its leases file in a different place than a non-NM system.

Re: dhclient.lease file is empty on first boot

Posted: 2018/09/06 11:56:43
by jlehtone
However, /etc/resolv.conf in its usual place should start

Code: Select all

# Generated by NetworkManager
If NM is in use and if it does something fishy, then its logs could tell what:

Code: Select all

sudo journalctl -u NetworkManager.service
That should be quite verbose about what NM gets from dhcpd.

Other info commands:

Code: Select all

nmcli
nmcli dev
nmcli dev show
nmcli con show
ip ro
systemctl status NetworkManager
systemctl status network

Re: dhclient.lease file is empty on first boot

Posted: 2018/09/06 12:21:09
by nupurpriya
How did your install differ from the default?
I am using a custom ISO and custom application for touchless installation.

Re: dhclient.lease file is empty on first boot

Posted: 2018/09/06 12:29:32
by jlehtone
Yes, a good kickstart saves a lot of work, but you surely understand that even psychics can have trouble to see how you have customized your network settings.

Re: dhclient.lease file is empty on first boot

Posted: 2018/09/10 06:08:21
by nupurpriya
Hi,

Could you please point me to some documentation, on how to configure anaconda installer for this task

Re: dhclient.lease file is empty on first boot

Posted: 2018/09/10 07:35:20
by TrevorH
You can find the documentation for kickstart syntax and options on https://access.redhat.com/documentation ... yntax.html

Re: dhclient.lease file is empty on first boot

Posted: 2018/09/14 07:38:07
by nupurpriya
Thanks for the response.

I have one more query, I included all the network information and everything in the interface config file through ks file, It is getting updated as expected, only this is resolv.conf is not getting updated and comes out to be blank after boot up.
Resolv.conf is getting updated in two cases:
1. When I am running "dhclient eth0"
2. After coming up, I need to stop NetworkManager and restart network service.

In both the cases, resolv.conf is getting updated by dhclient-script, unlike on standard systems, where it is created by NetworkManager.

Can anyone point out, what could be possible mistakes I would be doing here? Is there anyway, I can stop NetworkManager by default when the system comes up and restart network automatically.

Re: dhclient.lease file is empty on first boot

Posted: 2018/09/15 09:54:21
by jlehtone
"I don't want foo.service to start on boot"

Code: Select all

systemctl disable foo.service
"I want foo.service to start on boot"

Code: Select all

systemctl enable foo.service
You can run these in the POST section of kickstart.