dhclient.lease file is empty on first boot

Issues related to configuring your network
Post Reply
nupurpriya
Posts: 75
Joined: 2016/10/14 12:07:18

dhclient.lease file is empty on first boot

Post by nupurpriya » 2018/09/05 09:07:48

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.

User avatar
jlehtone
Posts: 2006
Joined: 2007/12/11 08:17:33
Location: Finland

Re: dhclient.lease file is empty on first boot

Post by jlehtone » 2018/09/06 08:34:37

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?

User avatar
TrevorH
Forum Moderator
Posts: 23653
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: dhclient.lease file is empty on first boot

Post by TrevorH » 2018/09/06 09:52:31

And NetworkManager keeps its leases file in a different place than a non-NM system.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
jlehtone
Posts: 2006
Joined: 2007/12/11 08:17:33
Location: Finland

Re: dhclient.lease file is empty on first boot

Post by jlehtone » 2018/09/06 11:56:43

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

nupurpriya
Posts: 75
Joined: 2016/10/14 12:07:18

Re: dhclient.lease file is empty on first boot

Post by nupurpriya » 2018/09/06 12:21:09

How did your install differ from the default?
I am using a custom ISO and custom application for touchless installation.

User avatar
jlehtone
Posts: 2006
Joined: 2007/12/11 08:17:33
Location: Finland

Re: dhclient.lease file is empty on first boot

Post by jlehtone » 2018/09/06 12:29:32

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.

nupurpriya
Posts: 75
Joined: 2016/10/14 12:07:18

Re: dhclient.lease file is empty on first boot

Post by nupurpriya » 2018/09/10 06:08:21

Hi,

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

User avatar
TrevorH
Forum Moderator
Posts: 23653
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: dhclient.lease file is empty on first boot

Post by TrevorH » 2018/09/10 07:35:20

You can find the documentation for kickstart syntax and options on https://access.redhat.com/documentation ... yntax.html
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

nupurpriya
Posts: 75
Joined: 2016/10/14 12:07:18

Re: dhclient.lease file is empty on first boot

Post by nupurpriya » 2018/09/14 07:38:07

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.

User avatar
jlehtone
Posts: 2006
Joined: 2007/12/11 08:17:33
Location: Finland

Re: dhclient.lease file is empty on first boot

Post by jlehtone » 2018/09/15 09:54:21

"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.

Post Reply