-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathanycast-dp.j2
More file actions
29 lines (29 loc) · 1.24 KB
/
Copy pathanycast-dp.j2
File metadata and controls
29 lines (29 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{% for intf in interfaces if intf.gateway.protocol|default('none') == 'anycast' %}
{% set v_if = 'varp-%s'|format(intf.ifindex) %}
if [ ! -e /sys/class/net/{{ v_if }} ]; then
ip link add {{ v_if }} link {{ intf.ifname }} type macvlan mode private
ip link set dev {{ v_if }} address {{ intf.gateway.anycast.mac|ansible.utils.hwaddr('linux') }}
{% if intf.type == 'svi' %}
bridge fdb replace {{ intf.gateway.anycast.mac|ansible.utils.hwaddr('linux') }} dev {{ intf.ifname }} self
{% endif %}
{% for afm in ['ipv4','ipv6'] if afm in intf.gateway %}
ip addr add {{ intf.gateway[afm] }} dev {{ v_if }} metric 1024
{% endfor %}
{% if 'ipv4' in intf.gateway %}
sysctl -w net.ipv4.conf.{{ intf.ifname }}.arp_announce=2
sysctl -w net.ipv4.conf.{{ intf.ifname }}.arp_ignore=2
sysctl -w net.ipv4.conf.{{ intf.ifname }}.arp_accept=1
{% endif %}
{% if 'ipv6' in intf.gateway %}
sysctl -w net.ipv6.conf.{{ v_if }}.enhanced_dad=0
sysctl -w net.ipv6.conf.{{ v_if }}.accept_dad=0
sysctl -w net.ipv6.conf.{{ v_if }}.dad_transmits=0
{% else %}
sysctl -w net.ipv6.conf.{{ v_if }}.disable_ipv6=1
{% endif %}
{% if 'vrf' in intf %}
ip link set dev {{ v_if }} master {{ intf.vrf }}
{% endif %}
ip link set dev {{ v_if }} up
fi
{% endfor %}