mirror of
https://github.com/opnsense/plugins.git
synced 2026-06-09 00:42:34 -04:00
net/frr: add IPv6 to BGP (#596)
This commit is contained in:
parent
2e53569c6d
commit
83eb2bf9bc
8 changed files with 111 additions and 21 deletions
|
|
@ -1,5 +1,5 @@
|
|||
PLUGIN_NAME= frr
|
||||
PLUGIN_VERSION= 1.2
|
||||
PLUGIN_VERSION= 1.3
|
||||
PLUGIN_COMMENT= The FRRouting Protocol Suite
|
||||
PLUGIN_DEPENDS= frr ruby
|
||||
PLUGIN_CONFLICTS= quagga
|
||||
|
|
|
|||
|
|
@ -11,6 +11,12 @@
|
|||
<type>text</type>
|
||||
<help>The name of your Prefix-List, please choose one near to the result you want to achieve.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>prefixlist.version</id>
|
||||
<label>IP Version</label>
|
||||
<type>select_multiple</type>
|
||||
<help>Set the IP version to use.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>prefixlist.seqnumber</id>
|
||||
<label>Number</label>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<model>
|
||||
<mount>//OPNsense/quagga/bgp</mount>
|
||||
<description>BGP Routing configuration</description>
|
||||
<version>1.0.0</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
|
|
@ -15,7 +16,6 @@
|
|||
<networks type="CSVListField">
|
||||
<default></default>
|
||||
<Required>N</Required>
|
||||
<mask>/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2},)*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2})$/</mask>
|
||||
</networks>
|
||||
<redistribute type="OptionField">
|
||||
<Required>N</Required>
|
||||
|
|
@ -37,10 +37,9 @@
|
|||
<default>1</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<address type="TextField">
|
||||
<address type="NetworkField">
|
||||
<default></default>
|
||||
<Required>Y</Required>
|
||||
<mask>/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/</mask>
|
||||
</address>
|
||||
<remoteas type="IntegerField">
|
||||
<default></default>
|
||||
|
|
@ -154,6 +153,14 @@
|
|||
<default></default>
|
||||
<Required>Y</Required>
|
||||
</name>
|
||||
<version type="OptionField">
|
||||
<default>IPv4</default>
|
||||
<Required>Y</Required>
|
||||
<OptionValues>
|
||||
<IPv4>IPv4</IPv4>
|
||||
<IPv6>IPv6</IPv6>
|
||||
</OptionValues>
|
||||
</version>
|
||||
<seqnumber type="IntegerField">
|
||||
<default></default>
|
||||
<Required>Y</Required>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<model>
|
||||
<mount>//OPNsense/quagga/general</mount>
|
||||
<description>Quagga Routing configuration</description>
|
||||
<version>1.0.0</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<model>
|
||||
<mount>//OPNsense/quagga/ospf</mount>
|
||||
<description>OSPF Routing configuration</description>
|
||||
<version>1.0.0</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<model>
|
||||
<mount>//OPNsense/quagga/ospf6</mount>
|
||||
<description>OSPFv3 Routing configuration</description>
|
||||
<version>1.0.0</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<model>
|
||||
<mount>//OPNsense/quagga/rip</mount>
|
||||
<description>RIP Routing configuration</description>
|
||||
<version>1.0.0</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
|
|
|
|||
|
|
@ -17,16 +17,6 @@ log syslog {{ OPNsense.quagga.general.sysloglevel }}
|
|||
!
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.asnumber') and OPNsense.quagga.bgp.asnumber != '' %}
|
||||
router bgp {{ OPNsense.quagga.bgp.asnumber }}
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.networks') %}
|
||||
{% for network in OPNsense.quagga.bgp.networks.split(',') %}
|
||||
network {{ network }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.redistribute') and OPNsense.quagga.bgp.redistribute != '' %}
|
||||
{% for bgp_redistribute in OPNsense.quagga.bgp.redistribute.split(',') %}
|
||||
redistribute {{ bgp_redistribute }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.neighbors.neighbor') %}
|
||||
{% for neighbor in helpers.toList('OPNsense.quagga.bgp.neighbors.neighbor') %}
|
||||
{% if neighbor.enabled == '1' %}
|
||||
|
|
@ -34,17 +24,36 @@ router bgp {{ OPNsense.quagga.bgp.asnumber }}
|
|||
{% if 'updatesource' in neighbor and neighbor.updatesource != '' %}
|
||||
neighbor {{ neighbor.address }} update-source {{ physical_interface(neighbor.updatesource) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
address-family ipv4 unicast
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.networks') %}
|
||||
{% for network in OPNsense.quagga.bgp.networks.split(',') %}
|
||||
{% if ':' not in network %}
|
||||
network {{ network }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.redistribute') and OPNsense.quagga.bgp.redistribute != '' %}
|
||||
{% for bgp_redistribute in OPNsense.quagga.bgp.redistribute.split(',') %}
|
||||
redistribute {{ bgp_redistribute }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.neighbors.neighbor') and ':' not in OPNsense.quagga.bgp.neighbors.neighbor.address %}
|
||||
{% for neighbor in helpers.toList('OPNsense.quagga.bgp.neighbors.neighbor') %}
|
||||
{% if neighbor.enabled == '1' and ':' not in neighbor.address %}
|
||||
{% if 'nexthopself' in neighbor and neighbor.nexthopself == '1' %}
|
||||
neighbor {{ neighbor.address }} next-hop-self
|
||||
neighbor {{ neighbor.address }} next-hop-self
|
||||
{% endif %}
|
||||
{% if 'defaultoriginate' in neighbor and neighbor.defaultoriginate == '1' %}
|
||||
neighbor {{ neighbor.address }} default-originate
|
||||
neighbor {{ neighbor.address }} default-originate
|
||||
{% endif %}
|
||||
{% if neighbor.linkedPrefixlistIn|default("") != "" %}
|
||||
{% for prefixlist in neighbor.linkedPrefixlistIn.split(",") %}
|
||||
{% set prefixlist2_data = helpers.getUUID(prefixlist) %}
|
||||
{% if prefixlist2_data != {} and prefixlist2_data.enabled == '1' %}
|
||||
neighbor {{ neighbor.address }} prefix-list {{ prefixlist2_data.name }} in
|
||||
neighbor {{ neighbor.address }} prefix-list {{ prefixlist2_data.name }} in
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
|
@ -52,7 +61,7 @@ router bgp {{ OPNsense.quagga.bgp.asnumber }}
|
|||
{% for prefixlist in neighbor.linkedPrefixlistOut.split(",") %}
|
||||
{% set prefixlist_data = helpers.getUUID(prefixlist) %}
|
||||
{% if prefixlist_data != {} and prefixlist_data.enabled == '1' %}
|
||||
neighbor {{ neighbor.address }} prefix-list {{ prefixlist_data.name }} out
|
||||
neighbor {{ neighbor.address }} prefix-list {{ prefixlist_data.name }} out
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
|
@ -60,7 +69,7 @@ router bgp {{ OPNsense.quagga.bgp.asnumber }}
|
|||
{% for aspath in neighbor.linkedRoutemapIn.split(",") %}
|
||||
{% set routemap2_data = helpers.getUUID(aspath) %}
|
||||
{% if routemap2_data != {} and routemap2_data.enabled == '1' %}
|
||||
neighbor {{ neighbor.address }} route-map {{ routemap2_data.name }} in
|
||||
neighbor {{ neighbor.address }} route-map {{ routemap2_data.name }} in
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
|
@ -68,19 +77,83 @@ router bgp {{ OPNsense.quagga.bgp.asnumber }}
|
|||
{% for aspath in neighbor.linkedRoutemapOut.split(",") %}
|
||||
{% set routemap_data = helpers.getUUID(aspath) %}
|
||||
{% if routemap_data != {} and routemap_data.enabled == '1' %}
|
||||
neighbor {{ neighbor.address }} route-map {{ routemap_data.name }} out
|
||||
neighbor {{ neighbor.address }} route-map {{ routemap_data.name }} out
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
exit-address-family
|
||||
!
|
||||
address-family ipv6 unicast
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.networks') and ':' in OPNsense.quagga.bgp.networks %}
|
||||
{% for network in OPNsense.quagga.bgp.networks.split(',') %}
|
||||
{% if ':' in network %}
|
||||
network {{ network }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.redistribute') and OPNsense.quagga.bgp.redistribute != '' %}
|
||||
{% for bgp_redistribute in OPNsense.quagga.bgp.redistribute.split(',') %}
|
||||
redistribute {{ bgp_redistribute }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.neighbors.neighbor') %}
|
||||
{% for neighbor in helpers.toList('OPNsense.quagga.bgp.neighbors.neighbor') %}
|
||||
{% if neighbor.enabled == '1' and ':' in neighbor.address %}
|
||||
{% if 'nexthopself' in neighbor and neighbor.nexthopself == '1' %}
|
||||
neighbor {{ neighbor.address }} next-hop-self
|
||||
{% endif %}
|
||||
{% if 'defaultoriginate' in neighbor and neighbor.defaultoriginate == '1' %}
|
||||
neighbor {{ neighbor.address }} default-originate
|
||||
{% endif %}
|
||||
{% if neighbor.linkedPrefixlistIn|default("") != "" %}
|
||||
{% for prefixlist in neighbor.linkedPrefixlistIn.split(",") %}
|
||||
{% set prefixlist2_data = helpers.getUUID(prefixlist) %}
|
||||
{% if prefixlist2_data != {} and prefixlist2_data.enabled == '1' %}
|
||||
neighbor {{ neighbor.address }} prefix-list {{ prefixlist2_data.name }} in
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if neighbor.linkedPrefixlistOut|default("") != "" %}
|
||||
{% for prefixlist in neighbor.linkedPrefixlistOut.split(",") %}
|
||||
{% set prefixlist_data = helpers.getUUID(prefixlist) %}
|
||||
{% if prefixlist_data != {} and prefixlist_data.enabled == '1' %}
|
||||
neighbor {{ neighbor.address }} prefix-list {{ prefixlist_data.name }} out
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if neighbor.linkedRoutemapIn|default("") != "" %}
|
||||
{% for aspath in neighbor.linkedRoutemapIn.split(",") %}
|
||||
{% set routemap2_data = helpers.getUUID(aspath) %}
|
||||
{% if routemap2_data != {} and routemap2_data.enabled == '1' %}
|
||||
neighbor {{ neighbor.address }} route-map {{ routemap2_data.name }} in
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if neighbor.linkedRoutemapOut|default("") != "" %}
|
||||
{% for aspath in neighbor.linkedRoutemapOut.split(",") %}
|
||||
{% set routemap_data = helpers.getUUID(aspath) %}
|
||||
{% if routemap_data != {} and routemap_data.enabled == '1' %}
|
||||
neighbor {{ neighbor.address }} route-map {{ routemap_data.name }} out
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
exit-address-family
|
||||
!
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.prefixlists.prefixlist') %}
|
||||
{% for prefixlist in helpers.sortDictList(OPNsense.quagga.bgp.prefixlists.prefixlist, 'name', 'seqnumber' ) %}
|
||||
{% if prefixlist.enabled == '1' %}
|
||||
{% if prefixlist.enabled == '1' and ':' not in prefixlist.network %}
|
||||
ip prefix-list {{ prefixlist.name }} seq {{ prefixlist.seqnumber }} {{ prefixlist.action }} {{ prefixlist.network }}
|
||||
{% endif %}
|
||||
!
|
||||
{% if prefixlist.enabled == '1' and ':' in prefixlist.network %}
|
||||
ipv6 prefix-list {{ prefixlist.name }} seq {{ prefixlist.seqnumber }} {{ prefixlist.action }} {{ prefixlist.network }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
!
|
||||
|
|
|
|||
Loading…
Reference in a new issue