Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

56 wiersze
1.8KB

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