gre_peering.j2 915 B

12345678910111213141516171819
  1. {% if ffrl_tun is defined %}
  2. {% for tun in ffrl_tun %}
  3. auto tun-ffrl-{{tun.name}}
  4. iface tun-ffrl-{{tun.name}} inet static
  5. address {{tun.v4_remote | ipaddr( tun.v4_remote.split('.')[3] | int + 1) | ipaddr('address') }}
  6. netmask {{tun.v4_remote | ipaddr('netmask')}}
  7. pre-up ip tunnel add $IFACE mode gre local {{ansible_default_ipv4.address}} remote {{tun.gre_target | ipaddr('address') }} ttl 255
  8. post-up ip link set $IFACE mtu 1400
  9. post-down ip tunnel del $IFACE
  10. post-up ip rule add iif $IFACE lookup ffnet
  11. pre-down ip rule del iif $IFACE lookup ffnet ||:
  12. iface tun-ffrl-{{tun.name}} inet6 static
  13. address {{tun.v6_remote | ipaddr('2') | ipaddr('address') }}
  14. netmask {{tun.v6_remote | ipaddr('prefix')}}
  15. post-up ip -6 rule add iif $IFACE lookup ffnet
  16. pre-down ip -6 rule del iif $IFACE lookup ffnet ||:
  17. {% endfor %}
  18. {% endif %}