Score:0

How to manually purge dhcpd.lease?

cn flag

How do I manually purge ALL dhcpd.lease ?

Can I just sudo echo /dev/null > /var/lab/dhcpd/dhcpd.lease ?

It's a special use case of testing ground; we have an isolated LAN for developers to do test run. And after each testing session I'd need to reset everything to initial state, including DHCP lease records. The test session would take few days to just few hours, so I can't rely on dhcpd auto-purge.

The DHCP server is running on Rocky Linux 8 (X86-64).

[EDIT]

The command should be cat /dev/null | sudo tee /var/lab/dhcpd/dhcpd.lease. Thanks for the tip.

Romeo Ninov avatar
in flag
Does this answer your question? [How do I manually release a DHCP lease on the DHCP server itself?](https://serverfault.com/questions/739022/how-do-i-manually-release-a-dhcp-lease-on-the-dhcp-server-itself)
Jaromanda X avatar
ru flag
`echo /dev/null` will output the string `/dev/null` ... and `sudo command > file` won't do what you think, the output redirection is still as the current user ... perhaps you wanted `cat /dev/null | sudo tee /var/lab/dhcpd/dhcpd.lease` (after stopping the dhcp server of course)
RichardLiu avatar
cn flag
@JaromandaX yeah I mean `cat /dev/null`. Sorry for typo. Thanks for the `sudo tee` trick.
RichardLiu avatar
cn flag
@RomeoNinov It does, but in the hard way. I don't care about the lease record during test run at all and I don't want to *carefully* edit `dhcpd.lease` manually between each test run session. I just want to zap everything. Actually, I'm asking whether there is anything in the `dhcpd.lease` file that I shouldn't delete.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.