Workshop/BGP-configs

From initLab
Revision as of 00:02, 14 March 2016 by Hackman (talk | contribs) (Created page with "= Bird = == basic configuration == Enable the direct protocol. This will make Bird to learn all of your directly attached routes. protocol direct { export all; } In...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Bird

basic configuration

Enable the direct protocol. This will make Bird to learn all of your directly attached routes.

protocol direct {
       export all;
}

In the kernel protocol, uncomment the following line:

#     learn;   # Learn all alien routes from the kernel

filter configuration

filter in_filter {
       # do not accept routes for our directly connected network
       if ( net = 185.117.82.112/29 ) then reject;
       accept;
}
filter out_filter {
       # do not export anything that is not our directly connected network
       if ( net = 185.117.82.112/29 ) then accept;
       reject;
}

bgp template

template bgp PEERS {
       debug { states, events };
       local as myas;
       startup hold time 0;
       import keep filtered;  # keep filtered routes in bird, so you can see it in: show route filtered
       import filter in_filter;
       export filter out_filter;
       gateway direct;
}

neighbor configuration

protocol bgp bgp_up1 from lab {
       description "Upstream 1 (cassie) via eth0.111";
       neighbor 10.125.11.1 as 65535;
       source address 10.125.11.2;
}
protocol bgp bgp_up2 from lab {
       description "Upstream 2 (beta) via eth0.211";
       neighbor 10.126.11.1 as 59851;
       source address 10.126.11.2;
}

Commands cheat sheet

show protocols - list all configured protocols
show protocol bgp_up2 - get the status information for protocol bgp_up2
show route export bgp_up2 - list all exported networks to peer bgp_up2
show route for 185.117.82.104 - get the routes for 185.117.82.104
show route filtered - list all prefixes that are filtered 
show route protocol bgp_up2 - list all prefixes that you receive from peer bgp_up2

Quagga

basic configuration

router bgp 65011

bgp router-id 185.117.82.113
bgp log-neighbor-changes
bgp graceful-restart
network 185.117.82.112/29

neighbors

prefix lists

Client container

sysctl net.ipv4.ip_forward=1
ip netns add bgp
ip link add veth0 type veth peer name veth1
ip link set veth1 netns bgp
ip netns exec bgp /bin/bash