interfaces.j2 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. post-down ip link del dev $IFACE
  32. up batctl if add $IFACE
  33. # batman-adv Mesh Interface, wird von meshdummy0 per Hotplug aktiviert
  34. allow-hotplug bat0
  35. iface bat0 inet static
  36. address {{supernode_mesh_ipv4|ipaddr('address')}}
  37. netmask {{supernode_mesh_ipv4|ipaddr('netmask')}}
  38. hwaddress {{supernode_bat_macaddress}}
  39. pre-up ip rule add from {{supernode_mesh_ipv4}} table 42
  40. pre-up ip rule add to {{supernode_mesh_ipv4}} table 42
  41. pre-up batctl it 5000
  42. pre-up batctl bl 0
  43. pre-up batctl gw server 48mbit/48mbit
  44. pre-up echo 120 > /sys/class/net/$IFACE/mesh/hop_penalty
  45. post-down ip rule del from {{supernode_mesh_ipv4}} table 42
  46. post-down ip rule del to {{supernode_mesh_ipv4}} table 42
  47. # Paralleles Macvlan-Interface mit fixer MTU fuer Alfred
  48. up ip link add link $IFACE alfred0 type macvlan
  49. up ip link set dev alfred0 mtu 1280
  50. up ip link set up dev alfred0
  51. down ip link set down dev alfred0
  52. down ip link del dev alfred0
  53. iface bat0 inet6 static
  54. address {{supernode_mesh_ipv6}}
  55. pre-up ip -6 rule add from {{supernode_mesh_ipv6|ipaddr('cidr')}} table 42
  56. pre-up ip -6 rule add to {{supernode_mesh_ipv6|ipaddr('cidr')}} table 42
  57. post-down ip -6 rule del from {{supernode_mesh_ipv6|ipaddr('cidr')}} table 42
  58. post-down ip -6 rule del to {{supernode_mesh_ipv6|ipaddr('cidr')}} table 42
  59. #pre-up ebtables -A FORWARD -p IPv6 -i $IFACE --ip6-proto ipv6-icmp --ip6-icmp-type router-advertisement -j DROP
  60. {% if supernode_mesh_backbones is defined %}
  61. {% for backbone in supernode_mesh_backbones %}
  62. {% if backbone.comment is defined %}
  63. # {{backbone.comment}}
  64. {% endif %}
  65. auto {{backbone.name}}
  66. iface {{backbone.name}} inet manual
  67. pre-up ip link add $IFACE type gretap local {{backbone.local_ip}} remote {{backbone.remote_ip}} dev {{backbone.interface|default(supernode_public_interface)}}
  68. pre-up ip link set up dev $IFACE
  69. up batctl if add $IFACE
  70. post-down ip link set down dev $IFACE
  71. post-down ip link del dev $IFACE
  72. {% endfor %}
  73. {% endif %}
  74. ## Uplink-Tunnel zum FFRG/FFRL-Backbone
  75. {% if supernode_uplinks is defined %}
  76. {% for uplink in supernode_uplinks %}
  77. {% if uplink.comment is defined %}
  78. # {{uplink.comment}}
  79. {% endif %}
  80. auto {{uplink.name}}
  81. iface {{uplink.name}} inet tunnel
  82. mode gre
  83. address {{uplink.address}}
  84. dstaddr {{uplink.dstaddr}}
  85. netmask {{uplink.netmask}}
  86. local {{supernode_local_ip|ipaddr('address')}}
  87. endpoint {{uplink.endpoint}}
  88. mtu 1400
  89. ttl 64
  90. iface {{uplink.name}} inet6 static
  91. address {{uplink.address_v6}}
  92. {% endfor %}
  93. {% endif %}