فهرست منبع

Enable OSPF IGP for IPv6

Markus Lindenberg 9 سال پیش
والد
کامیت
efc582ea85

+ 0 - 26
roles/common-routing/templates/bird.conf.j2

@@ -1,26 +0,0 @@
-log syslog all;
-
-router id {{ primary_v4_address }};
-
-# table ffrl; # BGP Peerings
-# table ibgp;
-# table freifunk; # Kernel table 42 (Routing from Freifunk networks)
-
-protocol kernel {
-        scan time 20;
-        device routes;
-        import all;
-        export all;
-        kernel table 42;
-}
-
-protocol device {
-        scan time 10;
-}
-
-protocol static unreachable_default {
-    preference 1;
-    route 0.0.0.0/0 reject;
-};
-
-include "/etc/bird/conf.d/*.conf";

+ 2 - 0
roles/common-system/tasks/tools.yml

@@ -12,6 +12,8 @@
     - psmisc
     - ngrep
     - aptitude
+    - iperf
+    - pv
 
 - name: Ensure vim is default editor
   alternatives: name=editor path=/usr/bin/vim.basic

roles/common-routing/handlers/bird.yml → roles/mesh-batman/handlers/bird.yml


+ 3 - 0
roles/mesh-batman/handlers/main.yml

@@ -0,0 +1,3 @@
+---
+
+- include: bird.yml

+ 4 - 0
roles/mesh-batman/tasks/main.yml

@@ -18,3 +18,7 @@
   template:
     dest: "/etc/network/interfaces.d/45_batman-tunnel.cfg"
     src: "batman-tunnel.cfg.j2"
+
+- name: Install IPv6 routing to bat0
+  template: src=batman6.conf.j2 dest=/etc/bird/conf6.d/batman6.conf
+  notify: Reload bird daemons

+ 2 - 4
roles/mesh-batman/templates/batman-tunnel.cfg.j2

@@ -1,13 +1,11 @@
-{% for host in groups['all'] %}
-{% if hostvars[host] is defined %}
+{% for host in groups['supernodes'] %}
 {% if hostvars[host]['inventory_hostname'] != inventory_hostname %}
 auto batman-{{hostvars[host]['inventory_hostname_short']}}
 iface batman-{{hostvars[host]['inventory_hostname_short']}} inet manual
-    pre-up ip link add $IFACE type gretap local {{primary_v4_address}} remote {{hostvars[host]['ansible_ssh_host']}} dev {{ primary_interface }}
+    pre-up ip link add $IFACE type ip6gretap remote {{hostvars[host]['primary_v6_address']|ipaddr('address')}} local {{primary_v6_address|ipaddr('address')}} key 2 dev {{ primary_interface }}
     pre-up ip link set up dev $IFACE
     up batctl if add $IFACE
     post-down ip link set down dev $IFACE
     post-down ip link del dev $IFACE
 {% endif %}
-{% endif %}
 {% endfor %}

+ 2 - 3
roles/mesh-batman/templates/batman.cfg.j2

@@ -1,8 +1,8 @@
 # batman-adv mesh interface
 
 # Dummy-Interface als MainIF mit manueller MAC fuer batman-adv
-auto meshdummy0
-iface meshdummy0 inet manual
+auto batman-dummy0
+iface batman-dummy0 inet manual
     pre-up ip link add $IFACE type dummy
     pre-up ip link set address {{batman_mesh_mac}} dev $IFACE
     pre-up ip link set up dev $IFACE
@@ -27,4 +27,3 @@ iface bat0 inet static
 
 iface bat0 inet6 static
     address {{batman_mesh_ipv6}}
-    #pre-up ebtables -A FORWARD -p IPv6 -i $IFACE --ip6-proto ipv6-icmp --ip6-icmp-type router-advertisement -j DROP

+ 3 - 0
roles/mesh-batman/templates/batman6.conf.j2

@@ -0,0 +1,3 @@
+protocol direct	direct_bat0 {
+	interface "bat0";
+}

+ 7 - 0
roles/mesh-interfaces/handlers/bird.yml

@@ -0,0 +1,7 @@
+---
+
+- name: Reload bird daemons
+  service: name={{item}} state=reloaded
+  with_items:
+  - bird
+  - bird6

+ 3 - 0
roles/mesh-interfaces/handlers/main.yml

@@ -0,0 +1,3 @@
+---
+
+- include: bird.yml

+ 1 - 1
roles/mesh-interfaces/tasks/address.yml

@@ -1,6 +1,6 @@
 ---
 
-- name: Install mesh IP address bound to loopback
+- name: Install mesh IP address dummy interface
   template:
     dest: "/etc/network/interfaces.d/10_mesh_address.cfg"
     src: "mesh-address.cfg.j2"

+ 3 - 3
roles/mesh-interfaces/tasks/igp.yml

@@ -1,8 +1,8 @@
 ---
 
-- name: Install OSPF IGP configuration for bird
-  template: src=igp.conf.j2 dest=/etc/bird/conf.d/igp.conf
-  notify: Reload bird daemons
+# - name: Install OSPF IGP configuration for bird
+#   template: src=igp.conf.j2 dest=/etc/bird/conf.d/igp.conf
+#   notify: Reload bird daemons
 
 - name: Install OSPF IGP configuration for bird6
   template: src=igp6.conf.j2 dest=/etc/bird/conf6.d/igp6.conf

+ 12 - 13
roles/mesh-interfaces/templates/igp6.conf.j2

@@ -1,17 +1,16 @@
-protocol direct {
-        interface "bat*";
-        interface "mesh-*";
-        interface "lo";
-}
+protocol static blackhole_mynetwork {
+    preference 1;
+    route {{ ipv6_network }} blackhole;
+};
 
-protocol ospf IGP {
-        area 0.0.0.0 {
-                interface "bat-*";
-                interface "lo" {
-                        stub;
-                };
+protocol ospf IGP_OSPF {
+    area 0.0.0.0 {
+        interface "mesh-*";
+        interface "local0" {
+            stub;
         };
+    };
 
-        import all;
-        export none;
+    import all;
+    export filter static_routes;
 }

+ 6 - 1
roles/mesh-interfaces/templates/mesh-address.cfg.j2

@@ -1,6 +1,11 @@
-iface lo inet6 static
+auto local0
+iface local0 inet6 static
     address {{mesh_ipv6_address}}
+    pre-up ip link add $IFACE type dummy
+    pre-up ip link set up dev $IFACE
     pre-up ip -6 rule add from {{ipv6_network}} table 42
     pre-up ip -6 rule add to {{ipv6_network}} table 42
     post-down ip -6 rule del from {{ipv6_network}} table 42
     post-down ip -6 rule del to {{ipv6_network}} table 42
+    post-down ip link set down dev $IFACE
+    post-down ip link del dev $IFACE

+ 2 - 2
roles/mesh-interfaces/templates/mesh-tunnel.cfg.j2

@@ -2,10 +2,10 @@
 {% if hostvars[host]['inventory_hostname'] != inventory_hostname %}
 auto mesh-{{hostvars[host]['inventory_hostname_short']}}
 iface mesh-{{hostvars[host]['inventory_hostname_short']}} inet manual
-    pre-up ip link add $IFACE type ip6gre local {{primary_v6_address|ipaddr('address')}} remote {{hostvars[host]['primary_v6_address']|ipaddr('address')}} dev {{ primary_interface }}
+    pre-up ip link add $IFACE type ip6gretap remote {{hostvars[host]['primary_v6_address']|ipaddr('address')}} local {{primary_v6_address|ipaddr('address')}} key 1 dev {{ primary_interface }}
     pre-up ip link set up dev $IFACE
     post-down ip link set down dev $IFACE
     post-down ip link del dev $IFACE
-
 {% endif %}
 {% endfor %}
+	

roles/common-routing/files/bird.gpg → roles/mesh-routing/files/bird.gpg


roles/common-routing/files/sysctl.conf → roles/mesh-routing/files/sysctl.conf


+ 7 - 0
roles/mesh-routing/handlers/bird.yml

@@ -0,0 +1,7 @@
+---
+
+- name: Reload bird daemons
+  service: name={{item}} state=reloaded
+  with_items:
+  - bird
+  - bird6

roles/common-routing/tasks/main.yml → roles/mesh-routing/handlers/main.yml


roles/common-routing/handlers/sysctl.yml → roles/mesh-routing/handlers/sysctl.yml


roles/common-routing/tasks/bird.yml → roles/mesh-routing/tasks/bird.yml


roles/common-routing/handlers/main.yml → roles/mesh-routing/tasks/main.yml


roles/common-routing/tasks/sysctl.yml → roles/mesh-routing/tasks/sysctl.yml


+ 22 - 0
roles/mesh-routing/templates/bird.conf.j2

@@ -0,0 +1,22 @@
+router id {{ primary_v4_address }};
+log syslog all;
+
+protocol kernel {
+	persist;
+    scan time 20;
+    device routes;
+    import all;
+    export all;
+    kernel table 42;
+}
+
+protocol device {
+    scan time 10;
+}
+
+protocol static unreachable_default {
+    preference 1;
+    route 0.0.0.0/0 unreachable;
+};
+
+include "/etc/bird/conf.d/*.conf";

+ 10 - 16
roles/common-routing/templates/bird6.conf.j2

@@ -1,35 +1,29 @@
-log syslog all;
 router id {{ primary_v4_address }};
-
-protocol static uplink_hostroute {
-    import all;
-    export all;
-};
-
-protocol direct {
-    interface "*";
-};
+log syslog all;
 
 protocol kernel {
     persist;
+    scan time 10;
     device routes;
-    scan time 20;
     import all;
     export all;
     kernel table 42;
 };
 
 protocol device {
-        scan time 10;
-}
+    scan time 10;
+};
 
-protocol static {
+protocol static unreachable_default {
     preference 1;
     route ::/0 unreachable;
 };
 
-protocol static {
-    route {{ ipv6_network }} via "lo";
+filter static_routes {
+	if source = RTS_STATIC then
+		reject;
+	else
+		accept;
 };
 
 include "/etc/bird/conf6.d/*.conf";

+ 4 - 1
site.yml

@@ -6,7 +6,10 @@
     - common-repos
     - common-auth
     - common-system
-    - common-routing
+
+- hosts: mesh
+  roles:
+    - mesh-routing
     - mesh-interfaces
 
 - hosts: supernodes