Przeglądaj źródła

The interfaces template and config is now much more freifunk specific

Till Klocke 9 lat temu
rodzic
commit
b0479374b0

+ 74 - 1
roles/ff-supernode/templates/interfaces.j2

@@ -24,4 +24,77 @@ iface {{interface.name}} {{interface.proto}} {{interface.type}}
 {% endfor %}
 {% endif %}
 
-{% endfor %}
+{% endfor %}
+
+## Supernode / Node Mesh
+
+# Dummy-Interface als MainIF mit manueller MAC fuer batman-adv
+auto meshdummy0
+iface meshdummy0 inet manual
+    pre-up ip link add $IFACE type dummy
+    pre-up ip link set address {{supernode_mesh_mac}} dev $IFACE
+    pre-up ip link set up dev $IFACE
+    post-down ip link set down dev $IFACE
+    up batctl if add $IFACE
+
+# batman-adv Mesh Interface, wird von meshdummy0 per Hotplug aktiviert
+allow-hotplug bat0
+iface bat0 inet static
+    address {{supernode_mesh_ipv4}}
+    netmask {{supernode_mesh_netmask_ipv4}}
+    hwaddress {{supernode_bat_macaddress}}
+    pre-up ip rule add from {{supernode_mesh_net_cidr}} table 42
+    pre-up ip rule add to {{supernode_mesh_net_cidr}} table 42
+    pre-up batctl it 5000
+    pre-up batctl bl 0
+    pre-up batctl gw server 48mbit/48mbit
+    pre-up echo 120 > /sys/class/net/$IFACE/mesh/hop_penalty
+
+    # Paralleles Macvlan-Interface mit fixer MTU fuer Alfred
+    up ip link add link $IFACE alfred0 type macvlan
+    up ip link set dev alfred0 mtu 1280
+    up ip link set up dev alfred0
+
+iface bat0 inet6 static
+    address {{supernode_mesh_ipv6}}
+    pre-up ip -6 rule add from {{supernode_mesh_net_ipv6}} table 42
+    pre-up ip -6 rule add to {{supernode_mesh_net_ipv6}} table 42
+    #pre-up ebtables -A FORWARD -p IPv6 -i $IFACE --ip6-proto ipv6-icmp --ip6-icmp-type router-advertisement -j DROP
+
+{% if supernode_mesh_backbones is defined %}
+{% for backbone in supernode_mesh_backbones %}
+{% if backbone.comment is defined %}
+# {{backbone.comment}}
+{% endif %}
+auto {{backbone.name}}
+iface {{backbone.name}} inet manual
+    pre-up ip link add $IFACE type gretap local {{supernode_local_ip}} remote {{backbone.remote_ip}} dev eth0
+    pre-up ip link set up dev $IFACE
+    up batctl if add $IFACE
+    post-down ip link set down dev $IFACE
+{% endfor %}
+{% endif %}
+
+## Uplink-Tunnel zum FFRG/FFRL-Backbone
+
+{% if supernode_uplinks is defined %}
+{% for uplink in supernode_uplinks %}
+{% if uplink.comment is defined %}
+# {{uplink.comment}}
+{% endif %}
+auto {{uplink.name}}
+iface {{uplink.name}} inet tunnel
+    mode gre
+    address {{uplink.address}}
+    dstaddr {{uplink.dstaddr}}
+    netmask {{uplink.netmask}}
+    local {{supernode_local_ip}}
+    endpoint {{uplink.endpoint}}
+    mtu 1400
+    ttl 64
+
+iface {{uplink.name}} inet6 static
+    address {{uplink.address_v6}}
+
+{% endfor %}
+{% endif %}

+ 86 - 19
test/application/supernode_pkg_vars.yml

@@ -1,3 +1,11 @@
+supernode_mesh_mac: C7:D9:55:60:1C:7B
+supernode_mesh_ipv4: 10.42.0.1
+supernode_mesh_netmask_ipv4: 255.255.0.0
+supernode_bat_macaddress: 39:C5:49:BE:00:78
+supernode_mesh_net_cidr: 10.42.0.0/16
+supernode_mesh_ipv6: fdfe:7808:502a:4eb7::1/64
+supernode_mesh_net_ipv6: fdfe:7808:502a:4eb7::/64
+
 fastd_instances:
   - name: do00
     bind: any:10000 interface "eth0" default ipv4
@@ -34,7 +42,7 @@ fastd_instances_secret:
   - name: do01
     secret: 280088c4263359417e9f2daf1771db820ab79eb4f79e3718719b2a976e8a8b5e
 
-bird_router_id: 10.233.8.1
+bird_router_id: "{{supernode_mesh_ipv4}}"
 bird_templates:
   - header: bgp ibgp
     content: |
@@ -45,6 +53,14 @@ bird_templates:
       multihop 64;
 
 bird_protocols:
+  - header: kernel
+    content: |
+      device routes;
+      import all;
+      export all;
+      kernel table 42;
+  - header: device
+    content: scan time 8;
   - header: direct
     content: interface "*";
   - header: bgp ffrg11 from ibgp
@@ -52,9 +68,34 @@ bird_protocols:
       source address 10.0.6.6;
       neighbor 10.0.6.5 as 65079;
       default bgp_med 2;
+  - header: protocol bgp ffrg25 from ibgp
+    content: |
+      source address 10.0.6.2;
+      neighbor 10.0.6.1 as 65079;
+      default bgp_med 1;
+  - header: bgp node012 from ibgp
+    content: |
+      source address 10.233.8.1;
+      neighbor 10.233.24.1 as 65403;
+      default bgp_med 4;
+  - header: bgp node021 from ibgp
+    content: |
+      source address 10.233.8.1;
+      neighbor 10.233.16.1 as 65403;
+      default bgp_med 3;
+  - header: bgp node022 from ibgp
+    content: |
+      source address 10.233.8.1;
+      neighbor 10.233.32.1 as 65403;
+      default bgp_med 4;
+  - header: bgp map from ibgp
+    content: |
+      source address 10.233.8.1;
+      neighbor 10.233.0.1 as 65403;
+      default bgp_med 4;
 
 
-bird6_router_id: 10.233.8.1
+bird6_router_id: "{{supernode_mesh_ipv4}}"
 bird6_templates:
   - header: bgp ibgp
     content: |
@@ -65,33 +106,59 @@ bird6_templates:
       next hop self;
       direct;
       gateway direct;
+  - header: bgp uplink
+    content: |
+      local as 65403;
+      import all;
+      export all;
+      next hop self;
+      direct;
+      multihop 64;
 
 bird6_protocols:
+  - header: static uplink_hostroute
+    content: |
+      import all;
+      export all;
   - header: direct
     content: interface "*";
+  - header: kernel
+    content: |
+      persist;
+      device routes;
+      scan time 20;
+      import all;
+      export all;
+      kernel table 42;
+  - header: device
+    content: scan time 10;
+  - header: bgp ffrg11 from uplink
+    content: |
+      neighbor 2a03:2260:50:5b::1 as 65079;
+      default bgp_med 2;
+  - header: bgp ffrg25 from uplink
+    content: |
+      neighbor 2a03:2260:50:5a::1 as 65079;
+      default bgp_med 1;
   - header: bgp node012 from ibgp
     content: |
       neighbor 2a03:2260:50:5::24 as 65403;
       default bgp_med 4;
+  - header: bgp node021 from ibgp
+    content: |
+      neighbor 2a03:2260:50:5::16 as 65403;
+      default bgp_med 3;
+  - header: bgp node022 from ibgp
+    content: |
+      neighbor 2a03:2260:50:5::32 as 65403;
+      default bgp_med 4;
+  - header: bgp map from ibgp
+    content: |
+      neighbor 2a03:2260:50:5::1 as 65403;
+      default bgp_med 4;
 
 supernode_interfaces:
   - name: eth0
     auto: true
     proto: inet
-    type: dhcp
-
-  - name: meshdummy0
-    auto: true
-    proto: inet 
-    type: manual
-    config:
-    - key: pre-up
-      value: ip link add $IFACE type dummy
-    - key: pre-up
-      value: ip link set address 02:ce:ef:ca:fe:2a dev $IFACE
-    - key: pre-up
-      value: ip link set up dev $IFACE
-    - key: post-down
-      value: ip link set down dev $IFACE
-    - key: up
-      value: batctl if add $IFACE
+    type: dhcp

+ 37 - 2
test/integration/supernode/serverspec/test_spec.rb

@@ -19,6 +19,11 @@ end
 #  it { should be_enabled }
 #end
 
+describe file('/etc/fastd/fastd-blacklist.sh') do
+  it { should exist }
+  it { should be_executable }
+end
+
 describe port(10000) do
   it { should be_listening.with('udp6') }
 end
@@ -55,14 +60,20 @@ end
 
 describe file('/etc/bird/bird.conf') do
   it { should exist }
-  its(:content) { should contain 'router id 10.233.8.1;' }
+  its(:content) { should contain 'router id 10.42.0.1;' }
 end
 
 describe file('/etc/bird/bird6.conf') do
   it { should exist }
-  its(:content) { should contain 'router id 10.233.8.1;' }
+  its(:content) { should contain 'router id 10.42.0.1;' }
 end
 
+# At least on Ubuntu doesn't open a port. Is this a problem?
+#describe port(179) do 
+#  it { should be_listening.with('tcp') }
+#  it { should be_listening.with('tcp6') }
+#end
+
 #describe service('bird') do
 #  it { should be_running }
 #  it { should be_enabled }
@@ -75,4 +86,28 @@ end
 
 describe interface('meshdummy0') do
   it { should exist }
+end
+
+describe interface('alfred0') do
+  it { should exist }
+end
+
+describe interface('bat0') do
+  it { should exist }
+end
+
+describe interface('eth0') do
+  it { should exist }
+end
+
+describe interface('tap00') do
+  it { should exist }
+end
+
+describe interface('tap01') do
+  it { should exist }
+end
+
+describe cron do
+  it { should have_entry '*/5 * * * * wget -q -O /etc/fastd/fastd-blacklist.json https://raw.githubusercontent.com/ffruhr/fastdbl/master/fastd-blacklist.json' }
 end