dhclient on carp

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

dhclient on carp

Guy Godfroy
Hello,

So I read in 6.7 release note that it's finally possible to use dhclient
on CARP interface. That's great news.

However, I'm not sure how to use it on a hostname.if file. I tried to
replace inet instruction directly with dhcp:

     dhcp vhid 11 carpdev em1 pass xxxx description "test"


But that didn't do the trick: at boot time, none of my nodes carp were
in master state so dhclient didn't manage to get any lease.

So I have first to give a static IP to my carp in order to activate it,
and only then trigger dhcp:

     inet [...] vhid 11 carpdev em1 pass xxxx description "test"

     dhcp

It doesn't feel right. Is there a better way to do this?

Guy

Reply | Threaded
Open this post in threaded view
|

Re: dhclient on carp

Sebastian Benoit
Guy Godfroy([hidden email]) on 2020.07.22 14:59:53 +0200:

> Hello,
>
> So I read in 6.7 release note that it's finally possible to use dhclient
> on CARP interface. That's great news.
>
> However, I'm not sure how to use it on a hostname.if file. I tried to
> replace inet instruction directly with dhcp:
>
>     dhcp vhid 11 carpdev em1 pass xxxx description "test"
>
>
> But that didn't do the trick: at boot time, none of my nodes carp were
> in master state so dhclient didn't manage to get any lease.
>
> So I have first to give a static IP to my carp in order to activate it,
> and only then trigger dhcp:
>
>     inet [...] vhid 11 carpdev em1 pass xxxx description "test"
>
>     dhcp
>
> It doesn't feel right. Is there a better way to do this?

Maybe someone will correct me on this, but I don't think so.
carp(4) needs an ip address to come up, thats how the protocol works.

Just pick one, there are many (from rfc1918 private use of course).

Reply | Threaded
Open this post in threaded view
|

Re: dhclient on carp

David Gwynne-5
In reply to this post by Guy Godfroy


> On 22 Jul 2020, at 22:59, Guy Godfroy <[hidden email]> wrote:
>
> Hello,
>
> So I read in 6.7 release note that it's finally possible to use dhclient on CARP interface. That's great news.
>
> However, I'm not sure how to use it on a hostname.if file. I tried to replace inet instruction directly with dhcp:
>
>    dhcp vhid 11 carpdev em1 pass xxxx description "test"
>
>
> But that didn't do the trick: at boot time, none of my nodes carp were in master state so dhclient didn't manage to get any lease.
>
> So I have first to give a static IP to my carp in order to activate it, and only then trigger dhcp:
>
>    inet [...] vhid 11 carpdev em1 pass xxxx description "test"
>
>    dhcp
>
> It doesn't feel right. Is there a better way to do this?

hostname.if0 lines don't have to all be address configurations. generally netstart just passes the statements directly to ifconfig.

does something like the following work in hostname.carp0?

description "test"
vhid 11 carpdev em1 pass xxxx
dhcp

dlg

Reply | Threaded
Open this post in threaded view
|

Re: dhclient on carp

Guy Godfroy
Doesn't work better.
I guess Sebastian is right, carp has to be assigned an IP to come up.

Le 23/07/2020 à 03:15, David Gwynne a écrit :

>
>
>> On 22 Jul 2020, at 22:59, Guy Godfroy <[hidden email]> wrote:
>>
>> Hello,
>>
>> So I read in 6.7 release note that it's finally possible to use dhclient on CARP interface. That's great news.
>>
>> However, I'm not sure how to use it on a hostname.if file. I tried to replace inet instruction directly with dhcp:
>>
>>     dhcp vhid 11 carpdev em1 pass xxxx description "test"
>>
>>
>> But that didn't do the trick: at boot time, none of my nodes carp were in master state so dhclient didn't manage to get any lease.
>>
>> So I have first to give a static IP to my carp in order to activate it, and only then trigger dhcp:
>>
>>     inet [...] vhid 11 carpdev em1 pass xxxx description "test"
>>
>>     dhcp
>>
>> It doesn't feel right. Is there a better way to do this?
>
> hostname.if0 lines don't have to all be address configurations. generally netstart just passes the statements directly to ifconfig.
>
> does something like the following work in hostname.carp0?
>
> description "test"
> vhid 11 carpdev em1 pass xxxx
> dhcp
>
> dlg
>

Reply | Threaded
Open this post in threaded view
|

Re: dhclient on carp

David Gwynne-5


> On 23 Jul 2020, at 22:28, Guy Godfroy <[hidden email]> wrote:
>
> Doesn't work better.
> I guess Sebastian is right, carp has to be assigned an IP to come up.

yeah, i just read the code a bit. they have to be able to communicate to be able to elect which one is the active and which is the backup. i suggest using an address like one in 169.254.x.y/16 so the carps can elect.

>
> Le 23/07/2020 à 03:15, David Gwynne a écrit :
>>> On 22 Jul 2020, at 22:59, Guy Godfroy <[hidden email]> wrote:
>>>
>>> Hello,
>>>
>>> So I read in 6.7 release note that it's finally possible to use dhclient on CARP interface. That's great news.
>>>
>>> However, I'm not sure how to use it on a hostname.if file. I tried to replace inet instruction directly with dhcp:
>>>
>>>    dhcp vhid 11 carpdev em1 pass xxxx description "test"
>>>
>>>
>>> But that didn't do the trick: at boot time, none of my nodes carp were in master state so dhclient didn't manage to get any lease.
>>>
>>> So I have first to give a static IP to my carp in order to activate it, and only then trigger dhcp:
>>>
>>>    inet [...] vhid 11 carpdev em1 pass xxxx description "test"
>>>
>>>    dhcp
>>>
>>> It doesn't feel right. Is there a better way to do this?
>> hostname.if0 lines don't have to all be address configurations. generally netstart just passes the statements directly to ifconfig.
>> does something like the following work in hostname.carp0?
>> description "test"
>> vhid 11 carpdev em1 pass xxxx
>> dhcp
>> dlg
>