net/tayga: add custom IPv6 routing feature (#2313)

* Convert TAYGA virtual interface to interface group

Allows nat64 interface assignment (required for adding custom routes).

* Add nat64 interface to tayga interface group

Required because TAYGA virtual interface was converted to interface group in c350c81e49.

* Add TAYGA configuration item to disable IPv6 route

* Add TAYGA GUI option to disable IPv6 prefix route

Required for adding custom routes.

* Add variable for disabling TAYGA IPv6 route

Required for adding custom routes.

* Add IPv6 route disable switch to TAYGA rc.d

Required for adding custom routes.

* Update TAYGA plugin to version 1.2

New feature: Custom IPv6 Routing

* Update TAYGA plugin to version 1.2

New feature: Custom IPv6 Routing

* Configure routes after TAYGA start

Required for custom routes.
This commit is contained in:
Maurice Walker 2022-06-29 15:16:17 +02:00 committed by GitHub
parent b20cbd6c04
commit 40b4fb4f14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 36 additions and 8 deletions

View file

@ -1,6 +1,5 @@
PLUGIN_NAME= tayga
PLUGIN_VERSION= 1.1
PLUGIN_REVISION= 2
PLUGIN_VERSION= 1.2
PLUGIN_COMMENT= Tayga NAT64
PLUGIN_DEPENDS= tayga
PLUGIN_MAINTAINER= m.muenz@gmail.com

View file

@ -7,6 +7,10 @@ networks where dedicated NAT64 hardware would be overkill.
Plugin Changelog
================
1.2
* Custom IPv6 routing option
1.1
* Register Tayga virtual interface

View file

@ -70,9 +70,9 @@ function tayga_interfaces()
return $interfaces;
}
$oic = array('enable' => true);
$oic['if'] = 'nat64';
$oic['if'] = 'tayga';
$oic['descr'] = 'Tayga';
$oic['type'] = 'none';
$oic['type'] = 'group';
$oic['virtual'] = true;
$oic['networks'] = array();
$interfaces['tayga'] = $oic;

View file

@ -29,8 +29,11 @@ tayga_start()
sleep 1
ifconfig nat64 inet ${tayga_v4destination}/32 ${tayga_v4address}
ifconfig nat64 inet6 ${tayga_v6destination}/128
route -6 add ${tayga_v6prefix} -interface nat64
ifconfig nat64 group tayga
route -4 add ${tayga_v4pool} -interface nat64
if [ "$tayga_v6routedisabled" != "YES" ]; then
route -6 add ${tayga_v6prefix} -interface nat64
fi
}
tayga_stop()

View file

@ -41,4 +41,10 @@
<type>text</type>
<help>IPv6 hosts which send traffic through Tayga will be dynamically assigned an IPv4 address from this pool. Can be any size, but each IPv6 host requires one address.</help>
</field>
<field>
<id>general.v6routedisabled</id>
<label>Custom IPv6 Routing</label>
<type>checkbox</type>
<help>This is an advanced setting for selective routing scenarios. It will prevent installing the route which routes the IPv6 Prefix to Tayga. This requires assigning and locking the nat64 interface, enabling dynamic gateway policy, configuring a dynamic IPv6 gateway and adding custom routes.</help>
</field>
</form>

View file

@ -1,7 +1,7 @@
<model>
<mount>//OPNsense/tayga/general</mount>
<description>Tayga configuration</description>
<version>0.0.4</version>
<version>1.2.0</version>
<items>
<enabled type="BooleanField">
<default>0</default>
@ -30,5 +30,9 @@
<default>192.168.255.0/24</default>
<Required>Y</Required>
</v4pool>
<v6routedisabled type="BooleanField">
<default>0</default>
<Required>Y</Required>
</v6routedisabled>
</items>
</model>

View file

@ -5,13 +5,20 @@ type:script_output
message:stopping tayga
[start]
command:/usr/local/opnsense/scripts/OPNsense/Tayga/setup.sh; /usr/local/etc/rc.d/opnsense-tayga start
command:
/usr/local/opnsense/scripts/OPNsense/Tayga/setup.sh;
/usr/local/etc/rc.d/opnsense-tayga start;
/usr/local/etc/rc.routing_configure
parameters:
type:script_output
message:starting tayga
[restart]
command:/usr/local/etc/rc.d/opnsense-tayga stop; /usr/local/opnsense/scripts/OPNsense/Tayga/setup.sh; /usr/local/etc/rc.d/opnsense-tayga start
command:
/usr/local/etc/rc.d/opnsense-tayga stop;
/usr/local/opnsense/scripts/OPNsense/Tayga/setup.sh;
/usr/local/etc/rc.d/opnsense-tayga start;
/usr/local/etc/rc.routing_configure
parameters:
type:script_output
message:restarting tayga

View file

@ -7,6 +7,11 @@ tayga_v4pool={{ OPNsense.tayga.general.v4pool }}
tayga_v6prefix={{ OPNsense.tayga.general.v6prefix }}
tayga_v6address={{ OPNsense.tayga.general.v6address }}
tayga_v6destination={{ OPNsense.tayga.general.v6destination }}
{% if helpers.exists('OPNsense.tayga.general.v6routedisabled') and OPNsense.tayga.general.v6routedisabled == '1' %}
tayga_v6routedisabled="YES"
{% else %}
tayga_v6routedisabled="NO"
{% endif %}
{% else %}
tayga_enable="NO"
{% endif %}