-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
58 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
# | ||
# Exit immediately when any command fails | ||
set -e | ||
# | ||
{%- macro create_vxlan_interface(vlan,vrf=None) %} | ||
# | ||
auto vxlan{{ vlan.vni }} | ||
allow-vxlan vni-{{ vlan.vni }} | ||
iface vni-{{ vlan.vni }} | ||
bridge-access {{ vlan.id }} | ||
vxlan-id {{ vlan.vni }} | ||
vxlan-learning {{ "no" if vxlan.flooding|default("") == "evpn" else "yes" }} | ||
{% endmacro -%} | ||
# | ||
# Create VXLAN interfaces with static flood lists | ||
# | ||
cat >/etc/network/interfaces.d/60-vxlan <<CONFIG | ||
{% if vxlan.vlans is defined %} | ||
allow-vxlan lo | ||
iface lo inet loopback | ||
vxlan-local-tunnelip {{ loopback.ipv4 }} | ||
# | ||
{% for vname in vxlan.vlans if vlans[vname].vni is defined %} | ||
{% set vlan = vlans[vname] %} | ||
{{ create_vxlan_interface(vlan,None) }} | ||
{% if vlan.vtep_list is defined %} | ||
{% for remote_vtep in vlan.vtep_list %} | ||
vxlan-remoteip {{ remote_vtep }} | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
# | ||
allow-vxlan bridge | ||
iface bridge | ||
{% for vname in vxlan.vlans if vlans[vname].vni is defined %} | ||
bridge-ports vni-{{ vlans[vname].vni }} | ||
{% endfor %} | ||
{% endif %} | ||
CONFIG | ||
ifreload --allow vxlan | ||
ifreload --allow vlanbridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters