<div dir="ltr"><div>Try this:</div><div><br></div><div><div>protocol device {</div><div> scan time 10; # Scan interfaces every 10 seconds</div><div> primary "lo" 127.0.0.1;</div><div>}</div></div></div><div class="gmail_extra">
<br clear="all"><div><br>-- Eric Cables</div>
<br><br><div class="gmail_quote">On Sun, Aug 3, 2014 at 3:11 PM, Pavlos Parissis <span dir="ltr"><<a href="mailto:pavlos.parissis@gmail.com" target="_blank">pavlos.parissis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I am building a solution where I have N HAProxy servers which have BGP<br>
and BFD sessions with 2 upstream routers. Bird runs on all HAProxy<br>
servers and announces the same prefixes via BGP. I am using ECMP on<br>
upstream routes to balance incoming traffic to these HAProxy servers,<br>
which balance traffic to N backend servers.<br>
<br>
I need to advertise/withdraw several IP prefixes within the same range<br>
(<a href="http://192.168.200.0/24" target="_blank">192.168.200.0/24</a>) based on the health of a service, in this case the<br>
frontend on HAProxy. These IPs are assigned only the loopback interface.<br>
<br>
The problem I am facing is that when I adjust a filter in order to<br>
withdraw the route, all routes are withdrawn and the remaining are<br>
announced again. According to the doc if a reload on bird brings a new<br>
configuration for a protocol, that protocol will be restarted. So, it is<br>
expected behavior.<br>
<br>
Below is the log[1] after I removed '192.168.200.1' from prefix set<br>
anycast_prefixes in loopback_ACL filter and reloaded bird.<br>
I was monitoring BGP protocols in a loop running<br>
bird show protocols all "bgp8" and saw that<br>
'export updates' counter was increased from 2 to 3 and 'export<br>
withdraws' counter was increased from 0 to 2.<br>
<br>
Is there a way to withdraw to a route from a list without effecting the<br>
rest routes from the list?<br>
<br>
The only way I have found so far, it was by removing the specific IP<br>
from the loopback interface. But, this solution prevents a<br>
reload/restart on HAProxy as it can't bind anymore to the socket<br>
<br>
<br>
Cheers,<br>
Pavlos<br>
<br>
[1]<br>
23:37:52 <INFO> Reconfiguration requested by SIGHUP<br>
23:37:52 <INFO> Reconfiguring<br>
23:37:52 <TRACE> direct1: Reconfigured<br>
23:37:52 <INFO> Reloading protocol direct1<br>
23:37:52 <INFO> Restarting protocol direct1<br>
23:37:52 <TRACE> direct1: Shutting down<br>
23:37:52 <TRACE> direct1: State changed to flush<br>
23:37:52 <TRACE> bgp_peer1: Reconfigured<br>
23:37:52 <TRACE> bgp_peer2: Reconfigured<br>
23:37:52 <INFO> Reconfigured<br>
23:37:52 <TRACE> direct1 > removed [sole] <a href="http://192.168.200.1/32" target="_blank">192.168.200.1/32</a> dev lo<br>
23:37:52 <TRACE> direct1 > removed [sole] <a href="http://192.168.200.2/32" target="_blank">192.168.200.2/32</a> dev lo<br>
23:37:52 <TRACE> direct1: State changed to down<br>
23:37:52 <TRACE> direct1: Starting<br>
23:37:52 <TRACE> direct1: Connected to table master<br>
23:37:52 <TRACE> direct1: State changed to feed<br>
23:37:52 <TRACE> direct1 < primary address <a href="http://192.168.200.1/32" target="_blank">192.168.200.1/32</a> on interface<br>
lo added<br>
23:37:52 <TRACE> direct1 > filtered out <a href="http://192.168.200.1/32" target="_blank">192.168.200.1/32</a> dev lo<br>
23:37:52 <TRACE> direct1 < secondary address <a href="http://127.0.0.0/8" target="_blank">127.0.0.0/8</a> on interface lo<br>
added<br>
23:37:52 <TRACE> direct1 < secondary address <a href="http://192.168.200.2/32" target="_blank">192.168.200.2/32</a> on<br>
interface lo added<br>
23:37:52 <TRACE> direct1 > added [best] <a href="http://192.168.200.2/32" target="_blank">192.168.200.2/32</a> dev lo<br>
23:37:52 <TRACE> bgp_peer2 < filtered out <a href="http://192.168.200.2/32" target="_blank">192.168.200.2/32</a> dev lo<br>
23:37:52 <TRACE> bgp_peer1 < filtered out <a href="http://192.168.200.2/32" target="_blank">192.168.200.2/32</a> dev lo<br>
23:37:52 <TRACE> direct1 < primary address <a href="http://192.168.80.0/20" target="_blank">192.168.80.0/20</a> on interface<br>
eth0 added<br>
23:37:52 <TRACE> direct1: State changed to up<br>
23:37:54 <TRACE> bgp_peer2: Sending KEEPALIVE<br>
23:37:54 <TRACE> bgp_peer1: Sending KEEPALIVE<br>
23:37:54 <TRACE> bgp_peer2: Got KEEPALIVE<br>
23:37:56 <TRACE> bgp_peer1: Got KEEPALIVE<br>
<br>
<br>
bird.conf<br>
# Override router ID<br>
router id 192.168.88.194;<br>
<br>
# Listens only on eth0's IP<br>
listen bgp address 192.168.88.194;<br>
<br>
filter loopback_ACL<br>
prefix set anycast_prefixes;<br>
{<br>
anycast_prefixes = [<br>
<a href="http://192.168.200.1/32" target="_blank">192.168.200.1/32</a>,<br>
<a href="http://192.168.200.2/32" target="_blank">192.168.200.2/32</a><br>
];<br>
if net ~ anycast_prefixes then accept;<br>
else reject;<br>
}<br>
<br>
<br>
filter anycast_range {<br>
if net ~ [ <a href="http://192.168.200.0/24" target="_blank">192.168.200.0/24</a> ] then accept;<br>
else reject;<br>
}<br>
<br>
protocol direct {<br>
interface "lo";<br>
debug all;<br>
import filter loopback_ACL;<br>
export none;<br>
}<br>
<br>
protocol kernel kernel1 {<br>
disabled yes;<br>
}<br>
<br>
protocol device {<br>
scan time 10;<br>
# TODO do I need this?<br>
}<br>
<br>
protocol static {<br>
disabled yes;<br>
}<br>
<br>
protocol bfd {<br>
interface "eth0" {<br>
min rx interval 500 ms;<br>
min tx interval 500 ms;<br>
idle tx interval 1000 ms;<br>
multiplier 3;<br>
};<br>
}<br>
<br>
template bgp BGP_PEERS {<br>
bfd on;<br>
debug all;<br>
import none;<br>
export filter anycast_range;<br>
direct;<br>
hold time 30;<br>
startup hold time 240;<br>
connect retry time 120;<br>
keepalive time 10;<br>
start delay time 5;<br>
error wait time 60, 300;<br>
error forget time 300;<br>
disable after error off;<br>
next hop self;<br>
path metric 1;<br>
default bgp_med 0;<br>
default bgp_local_pref 0;<br>
}<br>
<br>
protocol bgp bgp_peer1 from BGP_PEERS {<br>
disabled no;<br>
description "My-BGP-Peer1";<br>
local as 46111;<br>
neighbor 192.168.95.252 as 46111;<br>
source address 192.168.88.194;<br>
}<br>
<br>
protocol bgp bgp_peer2 from BGP_PEERS {<br>
disabled no;<br>
description "My-BGP-Peer2";<br>
local as 46111;<br>
neighbor 192.168.95.253 as 46111;<br>
source address 192.168.88.194;<br>
}<br>
<br>
</blockquote></div><br></div>