Subject: Re: Re: nic hotplug ip renewal

From: daggs <[email-masked]>
Date: Fri, 22 Nov 2024 21:03:25 +0100

Greetings Natanael,

> Sent: Friday, November 22, 2024 at 2:00 PM
> From: "daggs" <[email-masked]>
> To: "Natanael Copa" <[email-masked]>
> Cc: ~alpine/[email-masked]
> Subject: Re: nic hotplug ip renewal
>
> Greetings Natanael,
>
> > Sent: Friday, November 22, 2024 at 12:19 PM
> > From: "Natanael Copa" <[email-masked]>
> > To: "daggs" <[email-masked]>
> > Cc: ~alpine/[email-masked]
> > Subject: Re: nic hotplug ip renewal
> >
> > On Fri, 22 Nov 2024 08:59:14 +0100
> > daggs <[email-masked]> wrote:
> >
> > > Greetings,
> > >
> > > I have this interface file:
> > > auto lo
> > > iface lo inet loopback
> > >
> > > allow-hotplug vnet0
> > > iface vnet0 inet dhcp
> > >
> > > when vnet0 get visible, there is no ip assignment, so I wrote a script that tries to run ifup on the adapter and when it success, it bails out.
> > > thing is, after the lease time is over (~10 hours of lease), the nic looses the ip, how can I configure the lease to be renewed when needed?
> > > I'm using openrc and eudev on alpine 3.20.x
> >
> > I think for this the simplest solution would be to use dhcpcd. Let
> > interfaces file only have lo interface and
> >
> >   apk add dhcpcd && rc-update add dhcpcd boot
> >
> > -nc
> >
>
> Didn't thought of adding dhcpcd as boot service, will try it.
>
> Thanks,
>
> Dagg

Tried it, after boot, the adapter doesn't get any ip.
I assume that it might be related to the fact that when dhcpcd is executed, the device doesn't exists, hence the hotplug.
I tried to look for config examples for /etc/dhcpcd.conf that supports dhcp but all I find are static ips.
Any idea where I can find dhcp config for /etc/dhcpcd.conf?

Thanks,
Eial