mwexec("/sbin/ifconfig {$gre['greif']} inet6 " . escapeshellarg($gre['tunnel-local-addr']) . " " . escapeshellarg($gre['tunnel-remote-addr']) . " prefixlen 128");
mwexec("/sbin/ifconfig {$gre['greif']} inet6 " . escapeshellarg($gre['tunnel-local-addr']) . " prefixlen " . $gre['tunnel-remote-net']);
if ($gre['tunnel-remote-net']) == 128) { mwexec("/sbin/ifconfig {$gre['greif']} inet6 " . escapeshellarg($gre['tunnel-local-addr']) . " " . escapeshellarg($gre['tunnel-remote-addr']) . " prefixlen 128");} else { mwexec("/sbin/ifconfig {$gre['greif']} inet6 " . escapeshellarg($gre['tunnel-local-addr']) . " prefixlen " . $gre['tunnel-remote-net']);}
mwexec("/sbin/ifconfig {$gre['greif']} inet6 " . escapeshellarg($gre['tunnel-local-addr']) . ($gre['tunnel-remote-net'] == 128 ? " " . escapeshellarg($gre['tunnel-remote-addr']) : "") . " prefixlen " . $gre['tunnel-remote-net']);
ipv6 2a01::2 link#10 UH NaN 1476 gre0 TEST_GRE_IFACE ipv6 2a01::1 link#10 UHS NaN 16384 lo0 Loopback
ipv6 2a01::/64 link#10 U NaN 1476 gre0 TEST_GRE_IFACE ipv6 2a01::1 link#10 UHS NaN 16384 lo0 Loopback
ipv4 172.17.34.1 link#13 UHS NaN 16384 lo0 Loopback ipv4 172.17.34.2 link#13 UH NaN 1476 gre1 TEST_GRE_IFACE
/firewall_virtual_ip.php: The command '/sbin/ifconfig 'gre1' inet '172.17.35.1'/'24' alias ' returned exit code '1', the output was 'ifconfig: ioctl (SIOCAIFADDR): Destination address required'
BTW, in IPv6 network and broadcast address are not part of the address range so /127 are two valid addresses to use.
You are right about the gateway address issue. I think we don't have much choice but to add a new checkbox for this.
Say you have 2a01::1 local, 2a01::2 remote and /64 prefix length set in the web interface.
So maybe as a compromise we could make a second mode by inputting the "::" or "0.0.0.0" remote address which omits this destination from the ifconfig command as you suggested?
"ifconfig IFACE inet LOCAL REMOTE netmask MASK" actually ignores the netmask whatever is set.
Unfortunately, I haven't found a way to run ifconfig without remote address for inet family.
Do we actually need a gateway address? We have the 'Dynamic gateway policy' option in the interface settings specifically for tunnel interfaces without a gateway address. I'm using this with other tunnel interfaces (WireGuard, Tayga). @vnxme, could you try whether this works with GRE and GIF?
But what if local and remote address are not actually in the same /64? Say you have 2001:db8:1::1 local, 2001:db8:2::1 remote and the default /64 prefix length configured in the UI. This currently works because the /64 is ignored and a host route for the remote address is created instead. If we now configure the interface with 2001:db8:1::1/64, the remote address might become unreachable.
... do this. Though just leaving the remote address field empty to enable the new mode would seem more intuitive to me.
It doesn't ignore it. When you check the interface config with ifconfig IFACE, you can see that the netmask is applied correctly (inet LOCAL --> REMOTE netmask MASK).
That's a known FreeBSD limitation. The destination address of tunnel interfaces can't be omitted in the IPv4 stack, but it can in the IPv6 stack. We've had to deal with this when working on NAT64 (Tayga).
Could you please elaborate what you suggest I should try?
ifconfig gre3 createifconfig gre3 tunnel 192.0.2.1 198.51.100.1ifconfig gre3 inet6 2001:db8:1::1/126route -6 add 2001:db8:2::/64 -interface gre3
As I have already explained above, the remote address is the value used as a gateway address substitute for "dynamic" on the single gateway configuration page. If the remote address is empty, the 'dynamic' gateway won't work out of the box.
Nevertheless, I agree it is possible to set the gateway manually.
What I'm talking about is the kernel routing table, and for this particular purpose the netmask is ignored.
Then what shall we do with that? [...] Or make an empty remote address set the broadcast mode?