2

First at all:
I am new to BGP and the Bird internet routing daemon.

Situation:

ISP1 - R1 - SW1 - R3
             |
ISP2 - R2 - SW2 - R4

I have an eBGP instance for R1 and ISP1 and the same between R2 and ISP2. And also I have an iBGP Instance for R1 and R2 on both Routers.

Heres my sample config from R1 for iBGP:

protocol bgp bgp1 {
        local as 200000;                
        neighbor 10.0.0.2 as 200000; 
        multihop 1;                     
        keepalive time 5;                            
        source address 10.0.0.1;
}

And heres my sample config from R2 for iBGP:

protocol bgp bgp1 {
        local as 200000;                
        neighbor 10.0.0.1 as 200000; 
        multihop 1;                     
        keepalive time 5;                            
        source address 10.0.0.2;
}

Furthermore I have a keepalived cluster between R1 and R2 wich is the
default-gateway for R3 and R4.
Now, what if the link from R1 to ISP1 goes down? The Cluster wont change and
I don't have any connection to the internet.

I want to let the traffic flow even if this happens.My idea was to let
R1 send the whole traffic to R2 so that R2 sends it to the Internet.
My questions now are:
1) What is the best way to do this with Bird and iBGP?
2) Are there other and even better mechanisms?

Regards

2
  • I see the same setup I like to achieve, it's a nice post. For the most parts I understand everything but for the final routing to R3 + R4 I don't see how to route prefixes to them. Could you give an example how to setup the iBGP config to them? Kind regards, Richard
    – richard
    Sep 5, 2017 at 11:50
  • R3 and R4 form a cluster, too. Same with R1 and R2. So if you want to send smth to the subnet below R3 and R4 you need to send it to their cluster IP. EGP or IGP aren't needed here. Sep 6, 2017 at 13:32

2 Answers 2

2

I found the answer by myself:
If you want to create a failover between two Routers with the
bird internet routing daemon you need to follow the next steps:

1. Every router must be connected to an ISP: means 1 Router to 1 ISP
2. Form peers (BGP neighbor, eBGP) between your AS and the ISPs' AS
3. Form a peer (iBGP) between both of your Routers
4. Add a preference (highest preference wins)

Here's an example config:

# example ID, change at R2, e.g. 144.233.0.2
router id 144.233.0.1; 
debug protocols all;

# filtering routes
function avoid_martians() 
prefix set martians; 
{   
martians = [ 169.254.0.0/16+, 172.16.0.0/12+, 192.168.0.0/16+, 10.0.0.0/8+, 0.0.0.0/0 ];

  # Avoid RFC1918 and similar networks   
  if net ~ martians then return false;

  return true; 
  }

filter bgp_in {
        if ! (avoid_martians())
                then reject;
        accept; 
       }

# tell BGP about your routes to your systems
# change to 144.233.0.3 at R2
protocol static {
        route 144.233.0.0/22 via 144.233.0.2; 
        }

protocol kernel {
        learn;
        scan time 20;
        import filter bgp_in;
        export all; 
       }

protocol device {
        scan time 10; 
        }


protocol bgp iBGP_INSTANCE {
        local as 500000;                # local AS
        neighbor 144.233.0.3 as 500000; # iBGP peering to R2, change to 144.233.0.2 at R2 
        keepalive time 5;               # keepalive timer
        graceful restart;                    
        import filter bgp_in;
        export all;
        preference 150;                 # highest preference "wins", 100 at R2
        direct;
        gateway direct; 
        }

protocol bgp eBGP_INSTANCE {
        local as 500000;                
        neighbor 155.0.0.3 as 102;      # eBGP peering to ISP1, change at R2
        direct;                         
        keepalive time 5;               
        graceful restart;               
        import filter bgp_in;
        export all;
        hold time 10;
        preference 150;                # highest preference "wins", 100 at R2
        }


The config above creates two BGP instances.
One for the internal BGP (same AS as the other Router) and one external BGP (an other AS as the other Router).

As I commented in the config, the Router with the highest preference will be the "Master Router". The traffic now flows through R1 to ISP1.
But what if R1 doesn't get any update and/or keepalive message from the ISP?

The answer is simple:
R1 doesn't get any update from ISP1. Means, there is no route to the destination.
Now that R1 and R2 has formed a peer (iBGP), R1 gets updates from R2.
This means now that R1 has to send every traffic from below to R2 who sends it to the ISP2.

//edit: corrected typos

0

You can try to propagate the default route via OSPF - or -

if you send via iBGP to the second router all the routes advertised by the ISP, the packets will use the other router to route internet traffic in case the link on the primary router fails.

i.e.:

R1 routing table, with ISP1 up:

0.0.0.0/0 via ISP1 metric 100
0.0.0.0/0 via R2 metric 200

R2 routing table, with ISP2 up:

0.0.0.0/0 via ISP2 metric 100
0.0.0.0/0 via R1 metric 200

in case of ISP1 failure, R1 routing table will be:

0.0.0.0/0 via R2 metric 200

and so the packets will be routed to R2.

remember to establish iBGP peering on a loopback address and set next-hop-self.

1
  • I have done this now. R1+R2 have the same entrys in their routing tables as u told me. Furthermore I have established iBGP peering on a loopback address and I used next-hop-self. Then I tried the configuration and R1 still wants to forward the packet to ISP1. There is no forwarding to R2 with this config. Sep 22, 2015 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.