net/tayga: add interface commands to rc.conf (#1700)

This commit is contained in:
Michael
2020-03-10 13:17:53 +01:00
committed by GitHub
parent 156be04aae
commit 48bcb85124
5 changed files with 46 additions and 10 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
PLUGIN_NAME= tayga
PLUGIN_VERSION= 0.1
PLUGIN_VERSION= 0.2
PLUGIN_DEVEL= yes
PLUGIN_COMMENT= Tayga IPv6 64NAT
PLUGIN_DEPENDS= tayga
+12
View File
@@ -11,6 +11,7 @@
name=tayga
start_cmd=tayga_start
stop_cmd=tayga_stop
rcvar=tayga_enable
@@ -21,6 +22,17 @@ command_args="-p ${pidfile}"
[ -z "$tayga_enable" ] && tayga_enable="NO"
tayga_start()
{
echo "starting tayga"
${command} ${command_args}
sleep 1
ifconfig nat64 inet ${tayga_v4destination}/32 ${tayga_v4address}
ifconfig nat64 inet6 ${tayga_v6estination}/128
route -6 add ${tayga_v6prefix} -interface nat64
route -4 add ${tayga_v4pool} -interface nat64
}
tayga_stop()
{
if [ -n "$rc_pid" ]; then
@@ -9,24 +9,36 @@
<id>general.v4address</id>
<label>IPv4 Address</label>
<type>text</type>
<help>This is not your router's IPv4 address. Tayga requires its own address because it acts as an IPv4 and IPv6 router, and needs to be able to send ICMP messages. This address can safely be located inside the dynamic-pool prefix.</help>
<help>Should be located in Tayga's IPv4 pool. Tayga requires its own IPv4 address because it acts as a router and needs to be able to send ICMP messages. Tayga will also respond to ICMPv4 echo requests at this address.</help>
</field>
<field>
<id>general.v4destination</id>
<label>IPv4 NAT64 Interface Address</label>
<type>text</type>
<help>IPv4 address of the NAT64 interface. Must not be located in Tayga's IPv4 pool. Only used for ICMP.</help>
</field>
<field>
<id>general.v6address</id>
<label>IPv6 Address</label>
<type>text</type>
<help>This is not your routers IPv6 address. Tayga requires its own address because it acts as an IPv4 and IPv6 router, and needs to be able to send ICMP messages. Tayga will also respond to ICMP echo requests (ping6) at this address. You can leave it unspecified and Tayga will construct its IPv6 address using IPv4 address and the NAT64 prefix.</help>
<help>If left unspecified, Tayga will construct its IPv6 address by using its IPv4 address and the IPv6 prefix (default). Tayga requires its own IPv6 address because it acts as a router and needs to be able to send ICMP messages. Tayga will also respond to ICMPv6 echo requests at this address.</help>
</field>
<field>
<id>general.v6destination</id>
<label>IPv6 NAT64 Interface Address</label>
<type>text</type>
<help>IPv6 address of the NAT64 interface. Must not have Tayga's IPv6 prefix. Only used for ICMP.</help>
</field>
<field>
<id>general.v6prefix</id>
<label>IPv6 Prefix</label>
<type>text</type>
<help>This must be a prefix selected from your organizations IPv6 address space or the Well-Known Prefix 64:ff9b::/96. The IPv4 address space is mapped into the IPv6 address space by prepending this prefix to the IPv4 address.</help>
<help>This must be a /96 prefix selected from your organization's IPv6 address space or the Well-Known Prefix 64:ff9b::/96. The IPv4 address space is mapped into the IPv6 address space by prepending this prefix to the IPv4 address.</help>
</field>
<field>
<id>general.v4pool</id>
<label>IPv4 Pool</label>
<type>text</type>
<help>Dynamic pool prefix. IPv6 hosts which send traffic through Tayga will be assigned an IPv4 address from the dynamic pool.</help>
<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>
</form>
@@ -1,7 +1,7 @@
<model>
<mount>//OPNsense/tayga/general</mount>
<description>Tayga configuration</description>
<version>0.0.2</version>
<version>0.0.4</version>
<items>
<enabled type="BooleanField">
<default>0</default>
@@ -9,19 +9,26 @@
</enabled>
<v4address type="NetworkField">
<default>192.168.255.1</default>
<Required>N</Required>
<Required>Y</Required>
</v4address>
<v4destination type="NetworkField">
<default>192.168.254.1</default>
<Required>Y</Required>
</v4destination>
<v6address type="NetworkField">
<default>2001:db8:1::2</default>
<Required>N</Required>
</v6address>
<v6destination type="NetworkField">
<default>2001:db8:1:ffff::1</default>
<Required>Y</Required>
</v6destination>
<v6prefix type="NetworkField">
<default>2001:db8:1:ffff::/96</default>
<Required>N</Required>
<Required>Y</Required>
</v6prefix>
<v4pool type="NetworkField">
<default>192.168.255.0/24</default>
<Required>N</Required>
<Required>Y</Required>
</v4pool>
</items>
</model>
@@ -1,6 +1,11 @@
{% if helpers.exists('OPNsense.tayga.general.enabled') and OPNsense.tayga.general.enabled == '1' %}
tayga_var_script="/usr/local/opnsense/scripts/OPNsense/Tayga/setup.sh"
tayga_enable="YES"
tayga_v4address={{ OPNsense.tayga.general.v4address }}
tayga_v4destination={{ OPNsense.tayga.general.v4destination }}
tayga_v4pool={{ OPNsense.tayga.general.v4pool }}
tayga_v6prefix={{ OPNsense.tayga.general.v6prefix }}
tayga_v6address={{ OPNsense.tayga.general.v6address }}
{% else %}
tayga_enable="NO"
{% endif %}