Re: Start keepalived without IP on interface?

Paul Gildea <[email protected]> Fri, 29 Jun 2018 15:18:45 +0100
Newsgroups gmane.linux.keepalived.devel
Message-ID <CAP3D3gdUsUXhb5fXOScrjE4_P=VcoJypXv5U3k7jm0dUo72e9Q@mail.gmail.com>
--===============1780357582387931780==
Content-Type: multipart/alternative; boundary="000000000000b3cbbb056fc886aa"

--000000000000b3cbbb056fc886aa
Content-Type: text/plain; charset="UTF-8"

Thanks Quentin, I'll download and try that. Seems promising.
Another question, is it possible to run multiple instances of the keepalive
daemon on the same host? I tried setting a pidfile for it and the command
seemed to take (no errors), however the second instance didn't start and
there were no logs printed.

paul@paul:/etc$ keepalived -f /etc/keepalived2.conf --dont-fork
--log-console -p /var/run/test.pid
paul@paul:/etc$
paul@paul:/etc$ ps ax | grep keep
18248 pts/39   Z    0:00 [keepalived] <defunct>
21726 ?        Ss    0:00 /usr/sbin/keepalived -f /etc/keepalived.conf
21727 ?        S      0:00 /usr/sbin/keepalived -f /etc/keepalived.conf
21728 ?        S      0:00 /usr/sbin/keepalived -f /etc/keepalived.conf

--
Paul


On 29 June 2018 at 12:10, Quentin Armitage <[email protected]> wrote:

> Can you try keepalived v2.0.5. The version 2.0.x series supports "dynamic"
> interfaces, in other words using an interface that doesn't exist when
> keepalived starts, but is subsequently created. You might need to add the
> keyword "dynamic_interfaces" in the global_defs section of your
> configuration.
>
> To be honest, I'm not sure if it will work, since I have never thought
> about this situation. If it doesn't work, then I think keepalived should be
> modified so that the vrrp instance is in fault state until the underlying
> interface has an address.
>
> Quentin Armitage
>
> On Fri, 2018-06-29 at 11:02 +0100, Paul Gildea wrote:
>
> I'm new to keepalived. I want to use keepalived on an interface that will
> get an IP at some point but will not have one initially, can I set this up
> somehow in the config? If I try to start it now keepalived errors out as
> keepalived doesn't know what source IP address to use when sending VRRP
> packets. If this is not possible I presume I could set up a dummy IP and
> remove it after keepalived starts or script keepalived to start after the
> interface gets a valid IP, just wondering is it possible to start without
> said IP and I just can't find out how to do it.
>
> Conf:
>
> ! Configuration File for keepalived
>
>     vrrp_instance VI_1 {
>         state MASTER
>         interface eth0
>         virtual_router_id 51
>         priority 150
>         advert_int 1
>         authentication {
>             auth_type PASS
>             auth_pass pwd
>         }
>         virtual_ipaddress {
>            192.168.0.13
>         }
>         notify /etc/state_change.py
>     }
>
> Log:
>
>     keepalived -f /etc/keepalived.conf --log-console --dont-fork
>     Thu Jun 28 11:25:53 2018: Starting Keepalived v1.4.4 (05/08,2018)
>
>     Thu Jun 28 11:25:53 2018: Running on Linux 4.7.8 #9 SMP Wed Jun 27
> 17:25:18 IST
>     2018 (built for Linux 4.7.8)
>
>     Thu Jun 28 11:25:53 2018: Opening file '/etc/keepalived.conf'.
>
>     Thu Jun 28 11:25:53 2018: Starting Healthcheck child process,
> pid=18886
>     Thu Jun 28 11:25:53 2018: Starting VRRP child process, pid=18887
>
>     Thu Jun 28 11:25:53 2018: Opening file '/etc/keepalived.conf'.
>
>     Thu Jun 28 11:25:53 2018: Registering Kernel netlink reflector
>
>     Thu Jun 28 11:25:53 2018: Registering Kernel netlink command channel
>
>     Thu Jun 28 11:25:53 2018: Registering gratuitous ARP shared channel
>
>     Thu Jun 28 11:25:53 2018: Opening file '/etc/keepalived.conf'.
>
>     Thu Jun 28 11:25:53 2018: WARNING - default user 'keepalived_script'
> for script
>     execution does not exist - please create.
>
>     Thu Jun 28 11:25:53 2018: (VI_1): Cannot find an IP address to use for
> interface
>      eth0
>
>     Thu Jun 28 11:25:54 2018: Stopped
>
>     Thu Jun 28 11:25:54 2018: Keepalived_vrrp exited with permanent error
> CONFIG. Te
>     rminating
>
>     Thu Jun 28 11:25:54 2018: Stopping
>
>     Thu Jun 28 11:25:54 2018: Stopped
>
> Thanks,
>
> --
> Paul
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
> _______________________________________________
> Keepalived-devel mailing [email protected]://lists.sourceforge.net/lists/listinfo/keepalived-devel
>
>

--000000000000b3cbbb056fc886aa
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thanks Quentin, I&#39;ll download and try that. Seems prom=
ising.<div>Another question, is it possible to run multiple instances of th=
e keepalive daemon on the same host? I tried setting a pidfile for it and t=
he command seemed to take (no errors), however the second instance didn&#39=
;t start and there were no logs printed.</div><div><font face=3D"monospace,=
 monospace"><br></font></div><div><div><font face=3D"monospace, monospace">=
paul@paul:/etc$ keepalived -f /etc/keepalived2.conf --dont-fork --log-conso=
le -p /var/run/test.pid</font></div><div><font face=3D"monospace, monospace=
">paul@paul:/etc$=C2=A0</font></div></div><div><div><font face=3D"monospace=
, monospace">paul@paul:/etc$ ps ax | grep keep</font></div><div><font face=
=3D"monospace, monospace">18248 pts/39 =C2=A0 Z =C2=A0 =C2=A00:00 [keepaliv=
ed] &lt;defunct&gt;</font></div><div><font face=3D"monospace, monospace">21=
726 ? =C2=A0 =C2=A0 =C2=A0 =C2=A0Ss =C2=A0 =C2=A00:00 /usr/sbin/keepalived =
-f /etc/keepalived.conf</font></div><div><font face=3D"monospace, monospace=
">21727 ? =C2=A0 =C2=A0 =C2=A0 =C2=A0S =C2=A0 =C2=A0 =C2=A00:00 /usr/sbin/k=
eepalived -f /etc/keepalived.conf</font></div><div><font face=3D"monospace,=
 monospace">21728 ? =C2=A0 =C2=A0 =C2=A0 =C2=A0S =C2=A0 =C2=A0 =C2=A00:00 /=
usr/sbin/keepalived -f /etc/keepalived.conf</font></div></div><div><font fa=
ce=3D"arial, helvetica, sans-serif"><br></font></div><div><font face=3D"ari=
al, helvetica, sans-serif">--</font></div><div><font face=3D"arial, helveti=
ca, sans-serif">Paul</font></div><div><br></div></div><div class=3D"gmail_e=
xtra"><br><div class=3D"gmail_quote">On 29 June 2018 at 12:10, Quentin Armi=
tage <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" targe=
t=3D"_blank">[email protected]</a>&gt;</span> wrote:<br><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;=
padding-left:1ex"><div bgcolor=3D"#ffffff" text=3D"#2e3436" link=3D"#2a76c6=
" vlink=3D"#2e3436"><div>Can you try keepalived v2.0.5. The version 2.0.x s=
eries supports &quot;dynamic&quot; interfaces, in other words using an inte=
rface that doesn&#39;t exist when keepalived starts, but is subsequently cr=
eated. You might need to add the keyword &quot;dynamic_interfaces&quot; in =
the global_defs section of your configuration.</div><div><br></div><div>To =
be honest, I&#39;m not sure if it will work, since I have never thought abo=
ut this situation. If it doesn&#39;t work, then I think keepalived should b=
e modified so that the vrrp instance is in fault state until the underlying=
 interface has an address.</div><div><br></div><div>Quentin Armitage</div><=
div><div class=3D"h5"><div><br></div><div>On Fri, 2018-06-29 at 11:02 +0100=
, Paul Gildea wrote:</div></div></div><blockquote type=3D"cite" style=3D"ma=
rgin:0 0 0 .8ex;border-left:2px #729fcf solid;padding-left:1ex"><div><div c=
lass=3D"h5"><div dir=3D"ltr"><div>I&#39;m new to keepalived. I want to use =
keepalived on an interface that will get an IP at some point but will not h=
ave one initially, can I set this up somehow in the config? If I try to sta=
rt it now keepalived errors out as keepalived doesn&#39;t know what source =
IP address to use when sending VRRP packets. If this is not possible I pres=
ume I could set up a dummy IP and remove it after keepalived starts or scri=
pt keepalived to start after the interface gets a valid IP, just wondering =
is it possible to start without said IP and I just can&#39;t find out how t=
o do it.=C2=A0</div><div><br></div><div>Conf:</div><div><br></div><div>! Co=
nfiguration File for keepalived</div><div><br></div><div>=C2=A0 =C2=A0 vrrp=
_instance VI_1 {</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 state MASTER</div><d=
iv>=C2=A0 =C2=A0 =C2=A0 =C2=A0 interface eth0</div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 virtual_router_id 51</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 prior=
ity 150</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 advert_int 1</div><div>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 authentication {</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 auth_type PASS</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 auth_pass pwd</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 }</div><div>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 virtual_ipaddress {</div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0192.168.0.13</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
}</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 notify /etc/state_change.py</div><d=
iv>=C2=A0 =C2=A0 }</div><div><br></div><div>Log:</div><div><br></div><div>=
=C2=A0 =C2=A0 keepalived -f /etc/keepalived.conf --log-console --dont-fork =
=C2=A0</div><div>=C2=A0 =C2=A0 Thu Jun 28 11:25:53 2018: Starting Keepalive=
d v1.4.4 (05/08,2018) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=
=A0</div><div>=C2=A0 =C2=A0 Thu Jun 28 11:25:53 2018: Running on Linux 4.7.=
8 #9 SMP Wed Jun 27 17:25:18 IST=C2=A0</div><div>=C2=A0 =C2=A0 2018 (built =
for Linux 4.7.8) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=
=A0 Thu Jun 28 11:25:53 2018: Opening file &#39;/etc/keepalived.conf&#39;. =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</div><div>=
=C2=A0 =C2=A0 Thu Jun 28 11:25:53 2018: Starting Healthcheck child process,=
 pid=3D18886 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 Thu =
Jun 28 11:25:53 2018: Starting VRRP child process, pid=3D18887 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=A0 Thu J=
un 28 11:25:53 2018: Opening file &#39;/etc/keepalived.conf&#39;. =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =
=C2=A0 Thu Jun 28 11:25:53 2018: Registering Kernel netlink reflector =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</div><div>=C2=
=A0 =C2=A0 Thu Jun 28 11:25:53 2018: Registering Kernel netlink command cha=
nnel =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=A0 Thu =
Jun 28 11:25:53 2018: Registering gratuitous ARP shared channel =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 Thu Jun 28 11=
:25:53 2018: Opening file &#39;/etc/keepalived.conf&#39;. =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=A0 Thu J=
un 28 11:25:53 2018: WARNING - default user &#39;keepalived_script&#39; for=
 script=C2=A0</div><div>=C2=A0 =C2=A0 execution does not exist - please cre=
ate. =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</div><=
div>=C2=A0 =C2=A0 Thu Jun 28 11:25:53 2018: (VI_1): Cannot find an IP addre=
ss to use for interface</div><div>=C2=A0 =C2=A0 =C2=A0eth0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 Thu Jun 28 11:25:54 =
2018: Stopped =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 Thu Jun 28 11:25:=
54 2018: Keepalived_vrrp exited with permanent error CONFIG. Te</div><div>=
=C2=A0 =C2=A0 rminating =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=
=A0 Thu Jun 28 11:25:54 2018: Stopping =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=
=A0 Thu Jun 28 11:25:54 2018: Stopped=C2=A0</div><div><br></div><div>Thanks=
,</div><div><br></div><div>--</div><div>Paul</div></div>
</div></div><pre>------------------------------<wbr>-----------------------=
-------<wbr>------------------
Check out the vibrant tech community on one of the world&#39;s most
engaging tech sites, Slashdot.org! <a href=3D"http://sdm.link/slashdot" tar=
get=3D"_blank">http://sdm.link/slashdot</a></pre><pre>_____________________=
_________<wbr>_________________
Keepalived-devel mailing list
<a href=3D"mailto:[email protected]" target=3D"_blank"=
>Keepalived-devel@lists.<wbr>sourceforge.net</a>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/keepalived-devel" t=
arget=3D"_blank">https://lists.sourceforge.net/<wbr>lists/listinfo/keepaliv=
ed-<wbr>devel</a>
</pre></blockquote></div></blockquote></div><br></div>

--000000000000b3cbbb056fc886aa--


--===============1780357582387931780==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
--===============1780357582387931780==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Keepalived-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/keepalived-devel

--===============1780357582387931780==--