-
Notifications
You must be signed in to change notification settings - Fork 105
BIRD: Anycast gateway support #3509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/bin/bash | ||
| # | ||
| set -e | ||
| # | ||
| {% include 'gateway/frr.data-plane.j2' +%} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| sysctl -w net.ipv6.conf.all.enhanced_dad=0 | ||
| sysctl -w net.ipv6.conf.default.enhanced_dad=0 | ||
| {% for intf in interfaces if intf.gateway.protocol|default('none') == 'vrrp' %} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this thing generates content only when VRRP is enabled, don't you think it belongs in
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey, I just copied your approach ;) Of course, we can further split the files. |
||
| {% for afm in ['ipv4','ipv6'] if afm in intf.gateway %} | ||
| {% set v_if = 'vrrp%s-%s-%s'|format('6' if afm == 'ipv6' else '',intf.ifindex,intf.gateway.vrrp.group) %} | ||
| {% set v_mac = intf.gateway.vrrp.mac[afm] %} | ||
| if [ ! -e /sys/class/net/{{ v_if }} ]; then | ||
| ip link add {{ v_if }} link {{ intf.ifname }} type macvlan mode bridge | ||
| ip link set dev {{ v_if }} address {{ v_mac }} addrgenmode {{ 'none' if afm == 'ipv4' else 'random' }} | ||
| ip addr add {{ intf.gateway[afm] }} dev {{ v_if }} | ||
| {% if afm=='ipv4' %} | ||
| 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 'vrf' in intf %} | ||
| ip link set dev {{ v_if }} master {{ intf.vrf }} | ||
| {% endif %} | ||
| ip link set dev {{ v_if }} up | ||
| fi | ||
| {% endfor %} | ||
| {% endfor %} | ||
| {% 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 %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,56 +1,6 @@ | ||
| #!/bin/bash | ||
| # | ||
| set -e # Exit immediately when any command fails | ||
| set -e | ||
| # | ||
| sysctl -w net.ipv6.conf.all.enhanced_dad=0 | ||
| sysctl -w net.ipv6.conf.default.enhanced_dad=0 | ||
| {% for intf in interfaces if intf.gateway.protocol|default('none') == 'vrrp' %} | ||
| {% for afm in ['ipv4','ipv6'] if afm in intf.gateway %} | ||
| {% set v_if = 'vrrp%s-%s-%s'|format('6' if afm == 'ipv6' else '',intf.ifindex,intf.gateway.vrrp.group) %} | ||
| {% set v_mac = intf.gateway.vrrp.mac[afm] %} | ||
| if [ ! -e /sys/class/net/{{ v_if }} ]; then | ||
| ip link add {{ v_if }} link {{ intf.ifname }} type macvlan mode bridge | ||
| ip link set dev {{ v_if }} address {{ v_mac }} addrgenmode {{ 'none' if afm == 'ipv4' else 'random' }} | ||
| ip addr add {{ intf.gateway[afm] }} dev {{ v_if }} | ||
| {% if afm=='ipv4' %} | ||
| 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 'vrf' in intf %} | ||
| ip link set dev {{ v_if }} master {{ intf.vrf }} | ||
| {% endif %} | ||
| ip link set dev {{ v_if }} up | ||
| fi | ||
| {% endfor %} | ||
| {% endfor %} | ||
| {% 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 %} | ||
| {% include 'frr.vrrp-config.j2' %} | ||
| {% include 'frr.data-plane.j2' +%} | ||
| {% include 'frr.vrrp-config.j2' +%} |
Uh oh!
There was an error while loading. Please reload this page.