dhcpcd-discuss

Re: I: R: Persistent static IP, via CLI

Roy Marples

Sat Dec 19 16:47:15 2020

On 19/12/2020 16:06, Igor Pellegrini wrote:
It means don't remove the configuration when dhcpcd exists.
That is all.

Ooh, so the config is retained after reboot, but is not being written in the conf file.
I have issues in modifying/appending on the conf file with few additional options, rather than replacing it; because of not knowing if there's some incompatible previous instruction that would need to be removed. I just hoped dhcpcd offered an easy way to edit the file programmatically.

No it literally means when dhcpcd exit

Like so:

# Start dhcpcd
dhcpcd eth0

# See an ip address
ip a

# Tell dhcpd to exit
dhcpcd -x eth0

# If persisent is not given you will not see the ip address you had earlier
ip a

In call cases, the lease file where all this was obtained from is preserved.
With dhcpcd-9 you can do this

dhcpcd -U4 </path/to/dhcpcd/eth0.lease

And it will dump the variables dhcpcd sets from the lease.


Armed of stubbornness and practically no knowledge of c++, I'm taking a look at dhcpcd-ui's `config.h`
   (https://github.com/rsmarples/dhcpcd-ui/blob/c7a290f660a209b3d57c992bb19ea2e4e52caef7/src/libdhcpcd/config.c#L221)
to understand if I can eventually reuse it 😅
Cross fingers 🤞🏼

libdhcpcd can be used by C (dhcpcd-gtk) and C++ (dhcpcd-qt) quite happily.

There is a Raspbian project which uses libdhcpcd as well for their own front end fork.

Roy

Follow-Ups:
R: I: R: Persistent static IP, via CLIIgor Pellegrini
References:
Persistent static IP, via CLIIgor Pellegrini
Re: Persistent static IP, via CLIRoy Marples
I: R: Persistent static IP, via CLIIgor Pellegrini
Archive administrator: postmaster@marples.name