From 1e095dd4fbeb5474a07164f66d9ef6b3f7dcf605 Mon Sep 17 00:00:00 2001 From: ohrensessel Date: Sat, 26 Apr 2014 14:46:32 +0200 Subject: [PATCH] Add some further config variables special repository for bird is used to get bird 1.4.x --- README.md | 8 ++++++++ data/peering.yaml | 8 -------- manifests/init.pp | 13 +++++++++++-- templates/etc/bird.conf.erb | 10 +++++----- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e05ece0..a9cdfee 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,14 @@ class { 'ff_gw': } }, + # freifunk config + # the network assigned to the ff community + ff_net => '10.112.0.0/16', + # the network actually used in the mesh might be smaller than ff_net + ff_mesh_net => '10.112.0.0/18', + # as number for icvpn peering + ff_as => '65112', + # network config (example data for gw12) mesh_mac => 'de:ad:be:ef:01:14', gw_ipv4 => '10.112.30.1', diff --git a/data/peering.yaml b/data/peering.yaml index b6ebb66..b410886 100644 --- a/data/peering.yaml +++ b/data/peering.yaml @@ -2,35 +2,27 @@ peerings_v4: srv01: template: bgp_ibgp ip: 10.112.1.1 - as: 65112 hamburg01: template: bgp_ibgp ip: 10.112.14.1 - as: 65112 hamburg05: template: bgp_ibgp ip: 10.112.18.1 - as: 65112 hamburg07: template: bgp_ibgp ip: 10.112.16.1 - as: 65112 hamburg08: template: bgp_ibgp ip: 10.112.22.1 - as: 65112 hamburg09: template: bgp_ibgp ip: 10.112.24.1 - as: 65112 hamburg11: template: bgp_ibgp ip: 10.112.28.1 - as: 65112 hamburg12: template: bgp_ibgp ip: 10.112.30.1 - as: 65112 # TODO: add this as a second param for intercity gateways ic_peerings_v4: diff --git a/manifests/init.pp b/manifests/init.pp index 13813ec..dc814f7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,4 +1,4 @@ -class ff_gw($mesh_mac, $gw_ipv4, $gw_ipv6, $secret_key, $dhcprange_start, $dhcprange_end, $gw_do_ic_peering = false) { +class ff_gw($ff_net, $ff_mesh_net, $ff_as, $mesh_mac, $gw_ipv4, $gw_ipv6, $secret_key, $dhcprange_start, $dhcprange_end, $gw_do_ic_peering = false) { class { 'ff_gw::apt': } -> class { 'ff_gw::software': } @@ -27,6 +27,9 @@ class ff_gw($mesh_mac, $gw_ipv4, $gw_ipv6, $secret_key, $dhcprange_start, $dhcpr class { 'ff_gw::dnsmasq': } -> class { 'ff_gw::bird': + ff_net => $ff_net, + ff_mesh_net => $ff_mesh_net, + ff_as => $ff_as, own_ipv4 => $gw_ipv4, own_ipv6 => $gw_ipv6, gw_do_ic_peering => $gw_do_ic_peering, @@ -45,6 +48,12 @@ class ff_gw::apt() { key => 'AB7A88C5B89033D8', key_server => 'pgpkeys.mit.edu', } + # bird repo + apt::source { 'bird-network': + location => 'http://bird.network.cz/debian/', + release => 'wheezy', + repos => 'main', + } } class ff_gw::software { @@ -424,7 +433,7 @@ exit 0'; } } -class ff_gw::bird($own_ipv4, $own_ipv6, $gw_do_ic_peering, $version = 'present') { +class ff_gw::bird($ff_net, $ff_mesh_net, $ff_as, $own_ipv4, $own_ipv6, $gw_do_ic_peering, $version = 'present') { # read peering data from data file $module_path = get_module_path($module_name) $peeringdata = loadyaml("${module_path}/data/peering.yaml") diff --git a/templates/etc/bird.conf.erb b/templates/etc/bird.conf.erb index d744c04..e57dc26 100644 --- a/templates/etc/bird.conf.erb +++ b/templates/etc/bird.conf.erb @@ -2,7 +2,7 @@ table ibgp; # internal BGP peerings table ebgp; # external (icvpn) BGP peerings table freifunk; # kernel table 42 for routing from ff network -define ownas = 65112; +define ownas = <%= @ff_as %>; router id <%= @own_ipv4 %>; @@ -10,7 +10,7 @@ router id <%= @own_ipv4 %>; # own network function is_self_net() { - return (net ~ [10.112.0.0/16+]); + return (net ~ [<%= @ff_net %>+]); } # freifunk ip ranges in general @@ -115,14 +115,14 @@ protocol static unreachable_default { }; protocol static static_ffhh { - route 10.112.0.0/16 reject; + route <%= @ff_net %> reject; table ebgp; }; # in hamburg we use a /18 from our /16 in the mesh # create a route for that in freifunk table protocol static local_ffhh { - route 10.112.0.0/18 via "br-ffhh"; + route <%= @ff_mesh_net %> via "br-ffhh"; table freifunk; }; @@ -155,7 +155,7 @@ template bgp peers { <% @peerings_v4.each_pair do |key, hash| -%><% if hash["ip"] != @own_ipv4 -%> protocol bgp <%= key %> from <%= hash["template"] %> { - neighbor <%= hash["ip"] %> as <%= hash["as"] %>; + neighbor <%= hash["ip"] %> as ownas; }; <% end -%><% end -%>