Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

58 řádky
1.9KB

  1. # interfaces(5) file used by ifup(8) and ifdown(8)
  2. {{ ansible_managed | comment }}
  3. auto lo
  4. iface lo inet loopback
  5. {% if network_interfaces is defined %}
  6. {% for netname,netif in network_interfaces.iteritems() %}
  7. ### {{ netname }} ###
  8. auto {{ netif.device }}
  9. {% if netif.hotplug | default(false) %}
  10. allow-hotplug {{ netif.device }}
  11. {% endif %}
  12. {% if netif.bridge is defined %}
  13. iface {{ netif.device }} inet manual
  14. bridge_ports {{ netif.bridge.ports | default(["none"]) | join(" ") }}
  15. bridge_stp {{ netif.bridge.stp | default(false) | ternary('on','off') }}
  16. {% endif %}
  17. {% for ipv4 in netif.ipv4 | default([]) %}
  18. iface {{ netif.device }} inet {{ ipv4.method }}
  19. {% if ipv4.method == "static" %}
  20. address {{ ipv4.address | ipv4('address') }}
  21. network {{ ipv4.address | ipv4('network') }}
  22. netmask {{ ipv4.address | ipv4('netmask') }}
  23. broadcast {{ ipv4.address | ipv4('broadcast') }}
  24. {% if ipv4.gateway is defined %}
  25. gateway {{ ipv4.gateway | ipv4('address') }}
  26. {% endif %}
  27. {% endif %}
  28. {% endfor %}
  29. {% for ipv6 in netif.ipv6 | default([]) %}
  30. iface {{ netif.device }} inet6 {{ ipv6.method }}
  31. {% if ipv6.method == "static" %}
  32. address {{ ipv6.address | ipv6('address') }}
  33. netmask {{ ipv6.address | ipv6('prefix') | default(128) }}
  34. {% if ipv6.gateway is defined %}
  35. {% if ( ( ipv6.address | ipv6('prefix') | int ) < 128 ) and ( ipv6.gateway | ipv6(ipv6.address) ) %}
  36. gateway {{ ipv6.gateway | ipv6('address') }}
  37. {% else %}
  38. post-up sleep 5; /sbin/ip -family inet6 route add {{ ipv6.gateway }} dev {{ netif.device }}
  39. post-up sleep 5; /sbin/ip -family inet6 route add default via {{ ipv6.gateway }}
  40. pre-down /sbin/ip -family inet6 route del default via {{ ipv6.gateway }}
  41. pre-down /sbin/ip -family inet6 route del {{ ipv6.gateway }} dev {{ netif.device }}
  42. {% endif %}
  43. {% endif %}
  44. {% endif %}
  45. {% endfor %}
  46. {% endfor %}
  47. {% endif %}
  48. # Include files from /etc/network/interfaces.d:
  49. source-directory /etc/network/interfaces.d