Re: Start keepalived without IP on interface?
Quentin Armitage <[email protected]> Fri, 29 Jun 2018 18:15:50 +0100
| Newsgroups | gmane.linux.keepalived.devel |
|---|---|
| Organization | The Armitage family |
| Message-ID | <[email protected]> |
--===============0575814252660930707== Content-Type: multipart/alternative; boundary="=-iAwJnu6zRQTz3HRBm4cj" --=-iAwJnu6zRQTz3HRBm4cj Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Paul, There seems to be a bug with the creating of pid file names; I'll have a look at it. I can't see any advantage in running different instances of keepalived for each interface; I think it just complicates things. keepalived has been tested running with 500 vrrp instances and that works fine. Quentin On Fri, 2018-06-29 at 17:14 +0100, Paul Gildea wrote: > Hi, > I've tried v2.0.5 and that worked great for my interface not having > an IP, keepalived starts in a FAULT state and moves to MASTER when it > gets an IP, great, thanks! > > For the other issue, I retested on v2.0.5 and got logs this time > which indicate I couldn't run a second daemon for some reason: > > paul@paul:/etc$ sudo keepalived -f /etc/keepalived2.conf -l -n -p > /var/run/test.pid > Fri Jun 29 17:06:41 2018: Starting Keepalived v2.0.5 (06/29,2018) > Fri Jun 29 17:06:41 2018: WARNING - keepalived was build for newer > Linux 3.13.11, running on Linux 3.13.0-30-generic #55-Ubuntu SMP Fri > Jul 4 21:40:53 UTC 2014 > Fri Jun 29 17:06:41 2018: Opening file '/etc/keepalived2.conf'. > Fri Jun 29 17:06:41 2018: daemon is already running > > I was thinking of having a keepalive daemon running for every > interface (up a dozen interfaces or more) and each would have it's > own config file. Maybe everything should be in one config/daemon > instance. > I'll look into your above suggestion to try and understand it better, > thanks! > > -- > Paul > On 29 June 2018 at 15:34, Quentin Armitage <[email protected]> > wrote: > > Paul, > > > > Yes it should be possible to run more than one instance of > > keepalived on the same host, and certainly specifying a separate > > pid file iswhat is needed. There is a complication though if you > > want to open the same socket (e.g. raw socket protocol 112) on the > > same device. > > > > What I do to run more than one instance of keepalived on the same > > host is to use network namespaces. The script test/mk_if will add > > dummy interfaces in network namespaces high, medium and low. If you > > run it as test/mk_if add 0 10, it will add eth0..eth9 in high, > > medium and low, with the eth0s connected, etc (use interface br0 > > etc in medium). > > > > If your keepalived configuration file add: > > @high net_namespace high > > @medium net_namespace medium > > @low net_namespace low > > > > And when you run keepalived, specify -i high or -i low to say which > > namespace you want to be in (you won't need to specify the pid > > files if you use -i). > > > > @high etc is conditional configuration, and a line starting @high > > will only be used if -i high has been specified. @^high ... means > > include if not high. > > > > You can also do things such as in a vrrp instance: > > @high priority 100 > > @medium priority 90 > > @low priority 80 > > > > so that the same configuration file can be used on multiple > > systems. > > > > I hope this helps, > > > > Quentin > > > > P.S. Instread of --dont-fork and --log-console you might like to > > use -gLOG_FILE -G --flush-log-file and then you could do tail -f > > LOG_FILE (the log files are created with _vrrp, _check, _bfd and > > high/medium/low (i.e. what is specified with -i ) added to their > > names). > > > > On Fri, 2018-06-29 at 15:18 +0100, Paul Gildea wrote: > > > 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]. > > > uk> 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 list > > > > > [email protected] > > > > > https://lists.sourceforge.net/lists/listinfo/keepalived-devel --=-iAwJnu6zRQTz3HRBm4cj Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable <html><head></head><body bgcolor=3D"#fcfcfc" text=3D"#8b8e8f" link=3D"#4a90= d9" vlink=3D"#8b8e8f"><div>Paul,</div><div><br></div><div>There seems to be= a bug with the creating of pid file names; I'll have a look at it.</div><d= iv><br></div><div>I can't see any advantage in running different instances = of keepalived for each interface; I think it just complicates things. keepa= lived has been tested running with 500 vrrp instances and that works fine.<= /div><div><br></div><div>Quentin</div><div><br></div><div>On Fri, 2018-06-2= 9 at 17:14 +0100, Paul Gildea wrote:</div><blockquote type=3D"cite" style= =3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div= dir=3D"ltr">Hi,<div><br></div><div>I've tried v2.0.5 and that worked great= for my interface not having an IP, keepalived starts in a FAULT state and = moves to MASTER when it gets an IP, great, thanks!</div><div><br></div><div= >For the other issue, I retested on v2.0.5 and got logs this time which ind= icate I couldn't run a second daemon for some reason:</div><div><br></div><= div><div>paul@paul:/etc$ sudo keepalived -f /etc/keepalived2.conf -l= -n -p /var/run/test.pid</div><div>Fri Jun 29 17:06:41 2018: Starting Keepa= lived v2.0.5 (06/29,2018)</div><div>Fri Jun 29 17:06:41 2018: WARNING - kee= palived was build for newer Linux 3.13.11, running on Linux 3.13.0-30-gener= ic #55-Ubuntu SMP Fri Jul 4 21:40:53 UTC 2014</div><div>Fri Jun 29 17:06:41= 2018: Opening file '/etc/keepalived2.conf'.</div><div>Fri Jun 29 17:06:41 = 2018: daemon is already running</div></div><div><br></div><div>I was thinki= ng of having a keepalive daemon running for every interface (up a dozen int= erfaces or more) and each would have it's own config file. Maybe everything= should be in one config/daemon instance.</div><div>I'll look into your abo= ve suggestion to try and understand it better, thanks!</div><div><br></div>= <div>--</div><div>Paul</div></div><div class=3D"gmail_extra"><br><div class= =3D"gmail_quote">On 29 June 2018 at 15:34, Quentin Armitage <span dir=3D"lt= r"><<a href=3D"mailto:[email protected]" target=3D"_blank">quentin= @armitage.org.uk</a>></span> wrote:<br><blockquote type=3D"cite" style= =3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div= bgcolor=3D"#ffffff" text=3D"#2e3436" link=3D"#2a76c6" vlink=3D"#2e3436"><d= iv>Paul,</div><div><br></div><div>Yes it should be possible to run more tha= n one instance of keepalived on the same host, and certainly specifying a s= eparate pid file iswhat is needed. There is a complication though if you wa= nt to open the same socket (e.g. raw socket protocol 112) on the same devic= e.</div><div><br></div><div>What I do to run more than one instance of keep= alived on the same host is to use network namespaces. The script test/mk_if= will add dummy interfaces in network namespaces high, medium and low. If y= ou run it as test/mk_if add 0 10, it will add eth0..eth9 in high, medium an= d low, with the eth0s connected, etc (use interface br0 etc in medium).</di= v><div><br></div><div>If your keepalived configuration file add:</div><div>= @high net_namespace high</div><div>@medium net_namespace medium</div><div>@= low net_namespace low</div><div><br></div><div>And when you run keepalived,= specify -i high or -i low to say which namespace you want to be in (you wo= n't need to specify the pid files if you use -i).</div><div><br></div><div>= @high etc is conditional configuration, and a line starting @high will only= be used if -i high has been specified. @^high ... means include if not hig= h.</div><div><br></div><div>You can also do things such as in a vrrp instan= ce:</div><div>@high priority 100</div><div>@medium priority 90</div><div>@l= ow priority 80</div><div><br></div><div>so that the same configuration file= can be used on multiple systems.</div><div><br></div><div>I hope this help= s,</div><div><br></div><div>Quentin</div><div><br></div><div>P.S. Instread = of --dont-fork and --log-console you might like to use -gLOG_FILE -G --flus= h-log-file and then you could do tail -f LOG_FILE (the log files are create= d with _vrrp, _check, _bfd and high/medium/low (i.e. what is specified with= -i ) added to their names).</div><div><div class=3D"h5"><div><br></div><di= v>On Fri, 2018-06-29 at 15:18 +0100, Paul Gildea wrote:</div><blockquote ty= pe=3D"cite" style=3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;paddi= ng-left:1ex"><div dir=3D"ltr">Thanks Quentin, I'll download and try that. S= eems promising.<div>Another question, is it possible to run multiple instan= ces 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.</div><div><font face=3D"monos= pace, monospace"><br></font></div><div><div><font face=3D"monospace, monosp= ace">paul@paul:/etc$ keepalived -f /etc/keepalived2.conf --dont-fork --log-= console -p /var/run/test.pid</font></div><div><font face=3D"monospace, mono= space">paul@paul:/etc$ </font></div></div><div><div><font face=3D"mono= space, monospace">paul@paul:/etc$ ps ax | grep keep</font></div><div><font = face=3D"monospace, monospace">18248 pts/39 Z 0:00 [keep= alived] <defunct></font></div><div><font face=3D"monospace, monospace= ">21726 ? Ss 0:00 /usr/sbin/keepali= ved -f /etc/keepalived.conf</font></div><div><font face=3D"monospace, monos= pace">21727 ? S 0:00 /usr/sb= in/keepalived -f /etc/keepalived.conf</font></div><div><font face=3D"monosp= ace, monospace">21728 ? S 0:= 00 /usr/sbin/keepalived -f /etc/keepalived.conf</font></div></div><div><fon= t face=3D"arial, helvetica, sans-serif"><br></font></div><div><font face=3D= "arial, helvetica, sans-serif">--</font></div><div><font face=3D"arial, hel= vetica, sans-serif">Paul</font></div><div><br></div></div><div class=3D"gma= il_extra"><br><div class=3D"gmail_quote">On 29 June 2018 at 12:10, Quentin = Armitage <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" t= arget=3D"_blank">[email protected]</a>></span> wrote:<br><blockquo= te type=3D"cite" style=3D"margin:0 0 0 .8ex; border-left:2px #729fcf 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 "dynamic" interfaces, in other words using an interface that= doesn't exist when keepalived starts, but is subsequently created. You mig= ht need to add the keyword "dynamic_interfaces" in the global_defs section = of your configuration.</div><div><br></div><div>To be honest, I'm not sure = if it will work, since I have never thought about this situation. If it doe= sn't work, then I think keepalived should be modified so that the vrrp inst= ance is in fault state until the underlying interface has an address.</div>= <div><br></div><div>Quentin Armitage</div><div><div class=3D"m_528780245122= 0458545h5"><div><br></div><div>On Fri, 2018-06-29 at 11:02 +0100, Paul Gild= ea wrote:</div></div></div><blockquote type=3D"cite" style=3D"margin:0 0 0 = .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div><div class=3D"m_= 5287802451220458545h5"><div dir=3D"ltr"><div>I'm new to keepalived. I want = to use keepalived on an interface that will get an IP at some point but wil= l 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 sour= ce IP address to use when sending VRRP packets. If this is not possible I p= resume I could set up a dummy IP and remove it after keepalived starts or s= cript keepalived to start after the interface gets a valid IP, just wonderi= ng is it possible to start without said IP and I just can't find out how to= do it. </div><div><br></div><div>Conf:</div><div><br></div><div>! Con= figuration File for keepalived</div><div><br></div><div> vrrp_= instance VI_1 {</div><div> state MASTER</div><di= v> interface eth0</div><div> = virtual_router_id 51</div><div> priority= 150</div><div> advert_int 1</div><div> &n= bsp; authentication {</div><div> &= nbsp; auth_type PASS</div><div> &n= bsp; auth_pass pwd</div><div> }</div><div> = virtual_ipaddress {</div><div> &n= bsp; 192.168.0.13</div><div> }</div= ><div> notify /etc/state_change.py</div><div>&nb= sp; }</div><div><br></div><div>Log:</div><div><br></div><div> = keepalived -f /etc/keepalived.conf --log-console --dont-fork <= /div><div> Thu Jun 28 11:25:53 2018: Starting Keepalived v1.4.= 4 (05/08,2018) </div>= <div> Thu Jun 28 11:25:53 2018: Running on Linux 4.7.8 #9 SMP = Wed Jun 27 17:25:18 IST </div><div> 2018 (built for Linux= 4.7.8) &nbs= p; &n= bsp; </div><div> Thu Jun 28 = 11:25:53 2018: Opening file '/etc/keepalived.conf'. &n= bsp; </div><div> Thu Jun 28 = 11:25:53 2018: Starting Healthcheck child process, pid=3D18886  = ; </div><div> Thu Jun 28 11:25:53 2018: Sta= rting VRRP child process, pid=3D18887 &n= bsp; </div><div> Thu Jun 28 11:25:53 2018: Openin= g file '/etc/keepalived.conf'. &n= bsp; </div><div> Thu Jun 28 11:25:53 2018: Regist= ering Kernel netlink reflector &n= bsp; </div><div> Thu Jun 28 11:25:53 2018: Regist= ering Kernel netlink command channel &nb= sp;</div><div> Thu Jun 28 11:25:53 2018: Registering gratuitou= s ARP shared channel </div><= div> Thu Jun 28 11:25:53 2018: Opening file '/etc/keepalived.c= onf'. </div><= div> Thu Jun 28 11:25:53 2018: WARNING - default user 'keepali= ved_script' for script </div><div> execution does not exi= st - please create. = &nbs= p; </div><div> Thu Jun 28 11:25:53 2018: (VI_1): Cannot f= ind an IP address to use for interface</div><div> eth0 &= nbsp; = &nbs= p; &n= bsp; </div><div> Thu Jun 28 1= 1:25:54 2018: Stopped &nbs= p; &n= bsp; </div><div> Thu Jun 28 1= 1:25:54 2018: Keepalived_vrrp exited with permanent error CONFIG. Te</div><= div> rminating  = ; &nb= sp; &= nbsp; </div><div> &nbs= p; Thu Jun 28 11:25:54 2018: Stopping &n= bsp; = </div><div> Th= u Jun 28 11:25:54 2018: Stopped </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'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"= >[email protected]<wbr>orge.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-deve<wbr>l</a> </pre></blockquote></div></blockquote></div><br></div> </blockquote></div></div></div></blockquote></div><br></div> </blockquote></body></html> --=-iAwJnu6zRQTz3HRBm4cj-- --===============0575814252660930707== 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 --===============0575814252660930707== 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 --===============0575814252660930707==--