interfaces.j2 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # This file describes the network interfaces available on your system
  2. # and how to activate them. For more information, see interfaces(5).
  3. #
  4. # This file is generated by ansible
  5. #
  6. ## Host Interfaces
  7. auto lo
  8. iface lo inet loopback
  9. {%for interface in supernode_interfaces %}
  10. {% if interface.auto is defined and interface.auto %}
  11. auto {{interface.name}}
  12. {% endif %}
  13. {% if interface.hotplug is defined and interface.hotplug %}
  14. allow-hotplug {{interface.name}}
  15. {% endif %}
  16. iface {{interface.name}} {{interface.proto}} {{interface.type}}
  17. {% if interface.config is defined %}
  18. {% for config in interface.config %}
  19. {{config.key}} {{config.value}}
  20. {% endfor %}
  21. {% endif %}
  22. {% endfor %}
  23. ## Supernode / Node Mesh
  24. # Dummy-Interface als MainIF mit manueller MAC fuer batman-adv
  25. auto meshdummy0
  26. iface meshdummy0 inet manual
  27. pre-up ip link add $IFACE type dummy
  28. pre-up ip link set address {{supernode_mesh_mac}} dev $IFACE
  29. pre-up ip link set up dev $IFACE
  30. post-down ip link set down dev $IFACE
  31. up batctl if add $IFACE
  32. # batman-adv Mesh Interface, wird von meshdummy0 per Hotplug aktiviert
  33. allow-hotplug bat0
  34. iface bat0 inet static
  35. address {{supernode_mesh_ipv4}}
  36. netmask {{supernode_mesh_netmask_ipv4}}
  37. hwaddress {{supernode_bat_macaddress}}
  38. pre-up ip rule add from {{supernode_mesh_net_cidr}} table 42
  39. pre-up ip rule add to {{supernode_mesh_net_cidr}} table 42
  40. pre-up batctl it 5000
  41. pre-up batctl bl 0
  42. pre-up batctl gw server 48mbit/48mbit
  43. pre-up echo 120 > /sys/class/net/$IFACE/mesh/hop_penalty
  44. post-down ip rule del from {{supernode_mesh_net_cidr}} table 42
  45. post-down ip rule del to {{supernode_mesh_net_cidr}} table 42
  46. # Paralleles Macvlan-Interface mit fixer MTU fuer Alfred
  47. up ip link add link $IFACE alfred0 type macvlan
  48. up ip link set dev alfred0 mtu 1280
  49. up ip link set up dev alfred0
  50. iface bat0 inet6 static
  51. address {{supernode_mesh_ipv6}}
  52. pre-up ip -6 rule add from {{supernode_mesh_net_ipv6}} table 42
  53. pre-up ip -6 rule add to {{supernode_mesh_net_ipv6}} table 42
  54. post-down ip -6 rule del from {{supernode_mesh_net_ipv6}} table 42
  55. post-down ip -6 rule del to {{supernode_mesh_net_ipv6}} table 42
  56. #pre-up ebtables -A FORWARD -p IPv6 -i $IFACE --ip6-proto ipv6-icmp --ip6-icmp-type router-advertisement -j DROP
  57. {% if supernode_mesh_backbones is defined %}
  58. {% for backbone in supernode_mesh_backbones %}
  59. {% if backbone.comment is defined %}
  60. # {{backbone.comment}}
  61. {% endif %}
  62. auto {{backbone.name}}
  63. iface {{backbone.name}} inet manual
  64. pre-up ip link add $IFACE type gretap local {{supernode_local_ip}} remote {{backbone.remote_ip}} dev eth0
  65. pre-up ip link set up dev $IFACE
  66. up batctl if add $IFACE
  67. post-down ip link set down dev $IFACE
  68. {% endfor %}
  69. {% endif %}
  70. ## Uplink-Tunnel zum FFRG/FFRL-Backbone
  71. {% if supernode_uplinks is defined %}
  72. {% for uplink in supernode_uplinks %}
  73. {% if uplink.comment is defined %}
  74. # {{uplink.comment}}
  75. {% endif %}
  76. auto {{uplink.name}}
  77. iface {{uplink.name}} inet tunnel
  78. mode gre
  79. address {{uplink.address}}
  80. dstaddr {{uplink.dstaddr}}
  81. netmask {{uplink.netmask}}
  82. local {{supernode_local_ip}}
  83. endpoint {{uplink.endpoint}}
  84. mtu 1400
  85. ttl 64
  86. iface {{uplink.name}} inet6 static
  87. address {{uplink.address_v6}}
  88. {% endfor %}
  89. {% endif %}