2017-10-11 06:52:24 +02:00
|
|
|
#!/bin/sh
|
2017-10-13 07:59:43 +02:00
|
|
|
#
|
|
|
|
# {{ ansible_managed }}
|
|
|
|
#
|
|
|
|
|
2019-03-19 15:23:12 +01:00
|
|
|
{% for network in my_wireguard_networks %}
|
|
|
|
{% if magic < network.remote_magic %}
|
|
|
|
/sbin/ip -4 route del {{ network.ipv4 | ipaddr('network/prefix') }} dev wg-{{ network.remote[:11] }} scope link src {{ network.ipv4 | ipaddr('address') }} table mwu
|
|
|
|
{% else %}
|
|
|
|
/sbin/ip -4 route del {{ network.ipv4 | ipaddr('network/prefix') }} dev wg-{{ network.remote[:11] }} scope link src {{ network.ipv4 | ipaddr('1') | ipaddr('address') }} table mwu
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% if server_type == 'gateway' or server_type == 'monitoring' %}
|
2018-02-06 06:00:01 +01:00
|
|
|
{% for mesh in meshes %}
|
2019-03-02 18:10:48 +01:00
|
|
|
# static {{ mesh.domain_name }} routes for rt_table mwu
|
2018-02-06 06:00:01 +01:00
|
|
|
/sbin/ip -4 route del {{ mesh.ipv4_network }} proto static dev {{ mesh.id }}br table mwu
|
|
|
|
{% for ula in mesh.ipv6_ula %}
|
2018-02-23 19:33:39 +01:00
|
|
|
/sbin/ip -6 route del {{ ula | ipaddr('net') | ipsubnet(64, 0) | ipaddr('subnet') }} proto static dev {{ mesh.id }}br table mwu
|
2018-02-06 06:00:01 +01:00
|
|
|
{% endfor %}
|
|
|
|
{% for public in mesh.ipv6_public %}
|
2018-02-23 19:33:39 +01:00
|
|
|
/sbin/ip -6 route del {{ public | ipaddr('net') | ipsubnet(64, 0) | ipaddr('subnet') }} proto static dev {{ mesh.id }}br table mwu
|
2018-02-06 06:00:01 +01:00
|
|
|
{% endfor %}
|
2019-03-02 18:10:48 +01:00
|
|
|
{% if mesh_gw_prefixes is defined %}
|
|
|
|
{% for public in mesh_gw_prefixes[mesh.id].ipv6_public %}
|
|
|
|
/sbin/ip -6 route del {{ public | ipaddr('net') | ipsubnet(64, 0) | ipaddr('subnet') }} proto static dev {{ mesh.id }}br table mwu
|
|
|
|
{% endfor %}
|
|
|
|
{% endif%}
|
2018-02-06 06:00:01 +01:00
|
|
|
{% if not loop.last %}
|
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2019-03-19 15:23:12 +01:00
|
|
|
{% endif %}
|
2018-02-06 06:00:01 +01:00
|
|
|
|
2019-03-02 18:10:48 +01:00
|
|
|
{% if server_type == 'gateway' %}
|
2017-10-11 06:52:24 +02:00
|
|
|
# static blackhole routes for rt_table internet
|
|
|
|
/sbin/ip -4 route del blackhole 0.0.0.0/8 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 10.0.0.0/8 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 100.64.0.0/10 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 127.0.0.0/8 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 169.254.0.0/16 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 172.16.0.0/12 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 192.0.0.0/24 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 192.0.2.0/24 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 192.88.99.0/24 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 192.168.0.0/16 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 198.18.0.0/15 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 198.51.100.0/24 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 203.0.113.0/24 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 224.0.0.0/4 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 240.0.0.0/4 table internet
|
|
|
|
/sbin/ip -4 route del blackhole 255.255.255.255/32 table internet
|
|
|
|
/sbin/ip -6 route del blackhole fec0::/10 table internet
|
|
|
|
/sbin/ip -6 route del blackhole fc00::/7 table internet
|
|
|
|
/sbin/ip -6 route del blackhole ff00::/8 table internet
|
|
|
|
/sbin/ip -6 route del blackhole ::/96 table internet
|
|
|
|
/sbin/ip -6 route del blackhole 0:0:0:0:0:ffff::/96 table internet
|
|
|
|
|
|
|
|
# static blackhole routes for rt_table main
|
|
|
|
/sbin/ip -4 route del blackhole 0.0.0.0/8 table main
|
|
|
|
/sbin/ip -4 route del blackhole 10.0.0.0/8 table main
|
|
|
|
/sbin/ip -4 route del blackhole 100.64.0.0/10 table main
|
|
|
|
/sbin/ip -4 route del blackhole 127.0.0.0/8 table main
|
|
|
|
/sbin/ip -4 route del blackhole 169.254.0.0/16 table main
|
|
|
|
/sbin/ip -4 route del blackhole 172.16.0.0/12 table main
|
|
|
|
/sbin/ip -4 route del blackhole 192.0.0.0/24 table main
|
|
|
|
/sbin/ip -4 route del blackhole 192.0.2.0/24 table main
|
|
|
|
/sbin/ip -4 route del blackhole 192.88.99.0/24 table main
|
|
|
|
/sbin/ip -4 route del blackhole 192.168.0.0/16 table main
|
|
|
|
/sbin/ip -4 route del blackhole 198.18.0.0/15 table main
|
|
|
|
/sbin/ip -4 route del blackhole 198.51.100.0/24 table main
|
|
|
|
/sbin/ip -4 route del blackhole 203.0.113.0/24 table main
|
|
|
|
/sbin/ip -4 route del blackhole 224.0.0.0/4 table main
|
|
|
|
/sbin/ip -4 route del blackhole 240.0.0.0/4 table main
|
|
|
|
/sbin/ip -4 route del blackhole 255.255.255.255/32 table main
|
|
|
|
/sbin/ip -6 route del blackhole fec0::/10 table main
|
|
|
|
/sbin/ip -6 route del blackhole fc00::/7 table main
|
|
|
|
/sbin/ip -6 route del blackhole ff00::/8 table main
|
|
|
|
/sbin/ip -6 route del blackhole ::/96 table main
|
|
|
|
/sbin/ip -6 route del blackhole 0:0:0:0:0:ffff::/96 table main
|
|
|
|
/sbin/ip -6 route del blackhole ::/0 table main
|
2018-09-09 10:26:23 +02:00
|
|
|
{% endif %}
|