Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add second fastd instance with MTU 1280 #116

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions manifests/fastd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
, $mesh_mac
, $vpn_mac
, $mesh_mtu = 1426

, $mesh_mtu_low = 1280
, $fastd_secret
, $fastd_port

, $fastd_low_port
, $fastd_peers_git
) {
#validate_re($mesh_mac, '^de:ad:be:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}$')
Expand All @@ -16,7 +16,7 @@

ffnord::monitor::nrpe::check_command {
"fastd_${mesh_code}":
command => "/usr/lib/nagios/plugins/check_procs -c 1:1 -w 1:1 -C fastd --ereg-argument \"${mesh_code}-mesh-vpn\\b\"";
command => "/usr/lib/nagios/plugins/check_procs -c 1:1 -w 1:1 -C fastd --ereg-argument \"${mesh_code}-mesh-vpn\\b\"\n/usr/lib/nagios/plugins/check_procs -c 1:1 -w 1:1 -C fastd -a \"${mesh_code}-mesh-low-vpn\"";
}

ffnord::monitor::zabbix::check_script {
Expand All @@ -43,6 +43,19 @@
source => $fastd_secret,
mode => '0600',
} ->
file {
"/etc/fastd/${mesh_code}-mesh-low-vpn/":
ensure =>directory,
require => Package[ffnord::resources::fastd];
"/etc/fastd/${mesh_code}-mesh-low-vpn/fastd.conf":
ensure => file,
notify => Service[ffnord::resources::fastd],
content => template('ffnord/etc/fastd/fastd-low.conf.erb');
"/etc/fastd/${mesh_code}-mesh-low-vpn/secret.conf":
ensure => file,
source => $fastd_secret,
mode => '0600',
} ->
ffnord::batman-adv { "ffnord_batman_adv_${mesh_code}":
mesh_code => $mesh_code;
} ->
Expand All @@ -52,11 +65,20 @@
source => $fastd_peers_git,
notify => Class[ffnord::resources::fastd::auto_fetch_keys];
} ->
file { "/etc/fastd/${mesh_code}-mesh-low-vpn/peers":
ensure => 'link',
target => "/etc/fastd/${mesh_code}-mesh-vpn/peers",
}
ffnord::firewall::service { "fastd-${mesh_code}":
ports => [$fastd_port],
protos => ['udp'],
chains => ['wan']
}
ffnord::firewall::service { "fastd-low-${mesh_code}":
ports => [$fastd_low_port],
protos => ['udp'],
chains => ['wan']
}

file {
"/etc/fastd/${mesh_code}-mesh-vpn/peers/.git/hooks/post-merge":
Expand Down
36 changes: 20 additions & 16 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
define ffnord::mesh(
$mesh_name, # Name of your community, e.g.: Freifunk Gotham City
$mesh_code, # Code of your community, e.g.: ffgc
$mesh_as, # AS of your community
$mesh_mac, # mac address mesh device: 52:54:00:bd:e6:d4
$vpn_mac, # mac address vpn device, ideally != mesh_mac and unique
$mesh_mtu = 1426, # mtu used, default only suitable for fastd via ipv4
$range_ipv4, # ipv4 range allocated to community in cidr notation, e.g. 10.35.0.1/16
$mesh_ipv4, # ipv4 address in cidr notation, e.g. 10.35.0.1/19
$mesh_ipv6, # ipv6 address in cidr notation, e.g. fd35:f308:a922::ff00/64
$mesh_peerings, # path to the local peerings description yaml file
$mesh_name, # Name of your community, e.g.: Freifunk Gotham City
$mesh_code, # Code of your community, e.g.: ffgc
$mesh_as, # AS of your community
$mesh_mac, # mac address mesh device: 52:54:00:bd:e6:d4
$vpn_mac, # mac address vpn device, ideally != mesh_mac and unique
$mesh_mtu = 1426, # mtu used, default only suitable for fastd via ipv4
$mesh_mtu_low = 1280, # mtu used for new fastd instance that is "Kabel Deutschland safe"
$range_ipv4, # ipv4 range allocated to community in cidr notation, e.g. 10.35.0.1/16
$mesh_ipv4, # ipv4 address in cidr notation, e.g. 10.35.0.1/19
$mesh_ipv6, # ipv6 address in cidr notation, e.g. fd35:f308:a922::ff00/64
$mesh_peerings, # path to the local peerings description yaml file

$fastd_peers_git, # fastd peers
$fastd_secret, # fastd secret
$fastd_port, # fastd port
$fastd_low_port = 11280, # fastd port for second fastd instance with $mesh_mtu_low

$fastd_peers_git, # fastd peers
$fastd_secret, # fastd secret
$fastd_port, # fastd port

$dhcp_ranges = [], # dhcp pool
$dns_servers = [], # other dns servers in your network
$dhcp_ranges = [], # dhcp pool
$dns_servers = [], # other dns servers in your network
) {

# TODO We should handle parameters in a param class pattern.
Expand Down Expand Up @@ -68,8 +70,10 @@
mesh_mac => $mesh_mac,
vpn_mac => $vpn_mac,
mesh_mtu => $mesh_mtu,
mesh_mtu_low => $mesh_mtu_low,
fastd_secret => $fastd_secret,
fastd_port => $fastd_port,
fastd_low_port => $fastd_low_port,
fastd_peers_git => $fastd_peers_git;
} ->
ffnord::radvd { "br-${mesh_code}":
Expand Down
23 changes: 23 additions & 0 deletions templates/etc/fastd/fastd-low.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# managed by puppet -- editing is futile

log to syslog as "fastd-low-<%= @mesh_code %>" level error;
interface "<%= @mesh_code %>-mesh-low-vpn";
method "salsa2012+umac"; # since fastd v15
method "salsa2012+gmac";
method "xsalsa20-poly1305"; # deprecated
bind any:<%= @fastd_low_port %>;
hide ip addresses yes;
hide mac addresses yes;
include "secret.conf";
mtu <%= @mesh_mtu_low %>;
status socket "/var/run/fastd-status.<%= @mesh_code %>.sock";
include peers from "peers";
on up "
modprobe batman-adv
ip link set address <%= @vpn_mac %> dev $INTERFACE
/usr/sbin/batctl -m bat-<%= @mesh_code %> if add $INTERFACE
ip link set address <%= @mesh_mac %> dev bat-<%= @mesh_code %>
ifup bat-<%= @mesh_code %>
ip link set up dev $INTERFACE
#service alfred start bat-<%= @mesh_code %>
";