VTI gateways not adding static routes in 24.03
-
Rebooted device, went through the logs to see if I catch something that might be relevant (Netgate 4100).
May 24 13:53:46 php-cgi 678 rc.bootup: The command '/sbin/ifconfig 'ipsec1' inet '0.0.0.0/0' '0.0.0.0'' returned exit code '1', the output was 'ifconfig: ioctl (SIOCAIFADDR): Destination address required' May 24 13:53:46 php-cgi 678 rc.bootup: Gateway, NONE AVAILABLE May 24 13:53:46 php-cgi 678 rc.bootup: Gateway, NONE AVAILABLE May 24 13:53:46 kernel route: message indicates error: Invalid argument
-
Ah, there we go. Yup that's pretty much what I'd expect when trying to use 0/0. It tries to apply it to the interfaces and fails because it's invalid there.
The interesting thing is how that ever worked in 23.09.
-
And these are similar messages from a Netgate 4100 running 23.09:
May 24 19:26:59 php-cgi 466 rc.bootup: The command '/sbin/ifconfig 'ipsec2' inet '0.0.0.0/0' '0.0.0.0/0'' returned exit code '1', the output was 'ifconfig: 0.0.0.0/0: bad value' May 24 19:26:59 php-cgi 466 rc.bootup: Gateway, NONE AVAILABLE
The message is very slightly different, so I assume it must be meaningful in some way.
I also got offered 24.03_1 on the same device but no release notes yet?
-
Hmm, interesting. Presumably you don't see the route errors in 23.09?:
May 24 10:11:07 php-cgi 685 rc.bootup: route_add_or_change: Invalid gateway and/or network interface ipsec1 May 24 10:11:07 php-cgi 685 rc.bootup: route_add_or_change: Invalid gateway and/or network interface ipsec1
The patch 1 update is a no-op for amd64 devices. It applies only to aarch64. It won't change anything here.
-
@stephenw10 said in VTI gateways in 24.03:
Hmm, interesting. Presumably you don't see the route errors in 23.09?
Nope, didn't see any..
-
This post is deleted! -
Any news from devs regarding this issue? Well actually two issues I guess.
-
Not yet. In all honesty it's pretty low priority because VTI / Static routes are working as intended in 24.03. Using 0/0 for both ends of the tunnel subnet was never a supported setup.
It is curious that is changed though.
The issue with disabled gateways causing a problem is a bigger issue since that happens in the expected config. Updates there should be shown on the bug report: https://redmine.pfsense.org/issues/15449
-
@stephenw10 said in VTI gateways not adding static routes in 24.03:
In all honesty it's pretty low priority because VTI / Static routes are working as intended in 24.03. Using 0/0 for both ends of the tunnel subnet was never a supported setup.
Like I said, this was the only setup that worked across multiple platforms and it worked exceptionally well... until 24.03 that is. I really hope this gets sorted out, otherwise it's a massive headache for us.
Any chances these two issues are related somehow since they occurred at the same time?
-
I've added a patch to the redmine that should fix the issue:
https://redmine.pfsense.org/issues/15449Note that while it's valid for the routing to work for an interface regardless of its IP, the strongswan docs seem to indicate that a point-to-point link with specific local/remote addresses is expected. The IPsec P2 configuration in pfSense uses the local and remote fields to build the interface, and "0.0.0.0/0,::/0" is added on top as part of the traffic selectors. We do not recommend nor support using 0/0 as the interface address.
-
@marcosm I just applied the patch to my 2 4200 systems and then rebooted. The static route was added at boot and traffic passes as expected without having to wait for rc.newwanip to trigger the route to get loaded about 15 minutes after the reboot. Many thanks!!
--Larry
-
@marcosm
Thanks, this fixed the static routes not being applied from boot for me aswell. I did not have 0/0 address in IPSec, just VTI IPsec and static routes. -
@marcosm said in VTI gateways not adding static routes in 24.03:
Note that while it's valid for the routing to work for an interface regardless of its IP, the strongswan docs seem to indicate that a point-to-point link with specific local/remote addresses is expected.
I applied the patch on a non-production Netgate 4100 and sadly I have to say it did not fix the problem with my 0/0 setup. I was tinkering around with various config settings but so far no luck.
Any idea why it was working before in earlier versions?
-
@OhYeah-0 I haven't looked into that specifically, but my guess is it's related to the error shown on https://forum.netgate.com/post/1170859
-
It was mentioned before that looking into this issue wasn't "a priority", but will it investigated at a later date?
-
I can try to look at it later this week if I have time. The problem is that I wouldn't have expected that to work in 23.09. That fact it did could be seen as a bug that is now fixed.
It's unlikely we would add back code to allow it if that is the case as that's an unsupported config.
It might be a trivial fix though once we understand how it was working in 23.09.
-
@stephenw10 said in VTI gateways not adding static routes in 24.03:
I can try to look at it later this week if I have time. The problem is that I wouldn't have expected that to work in 23.09. That fact it did could be seen as a bug that is now fixed.
- Thank you in advance for at least taking a look at the problem.
- I hope there is a simple fix/change available. Like I said, this functionality has performed extremely well for 1+ years with multiple clients in mixed vendor/platform environments.
PS. The functionality worked throughout the 23.xx branch as far as I recall, haven't tested it with earlier versions.
-
@OhYeah-0 What exactly are you trying to achieve?
Presumably the goal is to allow any IP to pass through the tunnel, and control what gets sent through the tunnel via static routes. For the "allow" part, that's done implicitly by the system with the traffic selectors "0.0.0.0/0,::/0". This is what IPsec uses to establish the P2. As mentioned, the local/remote address you enter in the VTI tunnel's P2 GUI is used to build the interface and gateway. Putting validity aside, let's use 0.0.0.0/0 as an example. This would tell the system:
route 10.1.1.0/24 through 0.0.0.0 via interface ipsec1
The part
route 10.1.1.0/24 through 0.0.0.0
would effectively mean "use the default route for 10.1.1.0/24" which would already happen simply by having a default route. There's the additional partvia interface ipsec1
which would override the default route's interface and effectively mean "send traffic destined to 10.1.1.0/24 through the interface ipsec1". Hence the address "0.0.0.0" is effectively ignored and the resulting behavior would be "send 10.1.1.0/24 through the tunnel; if the tunnel is down, send 10.1.1.0/24 through the default route instead".Since the GUI doesn't currently support routing via an interface without an address (i.e. a gateway requires an address), then 0.0.0.0 can't be used. By simply changing the P2 local address to something not used anywhere else in the system (e.g. an APIPA address like 169.254.254.1), the resulting behavior remains the same while also being a supported configuration.
-
@marcosm said in VTI gateways not adding static routes in 24.03:
@OhYeah-0 What exactly are you trying to achieve?
Presumably the goal is to allow any IP to pass through the tunnel, and control what gets sent through the tunnel via static routes. For the "allow" part, that's done implicitly by the system with the traffic selectors "0.0.0.0/0,::/0". This is what IPsec uses to establish the P2. As mentioned, the local/remote address you enter in the VTI tunnel's P2 GUI is used to build the interface and gateway. Putting validity aside, let's use 0.0.0.0/0 as an example. This would tell the system:
route 10.1.1.0/24 through 0.0.0.0 via interface ipsec1
Since the GUI doesn't currently support routing via an interface without an address (i.e. a gateway requires an address), then 0.0.0.0 can't be used. By simply changing the P2 local address to something not used anywhere else in the system (e.g. an APIPA address like 169.254.254.1), the resulting behavior remains the same while also being a supported configuration.
I assumed (perhaps incorrectly) that setting the destination network to 0.0.0.0/0 is essentially saying "anything is allowed to be routed to that tunnel if an appropriate static route exist in the system routing table". In essence:
route 10.1.1.0/24
through 0.0.0.0via interface ipsec1 (through 0.0.0.0 part seems superfluous)The last paragraph is somewhat confusing to me from a system standpoint, since 169.254.0.0 networks are reserved for Windows OS devices unable to obtain an address. Both are unroutable networks but here 169.254.0.0 has a much more specific context while 0.0.0.0 is merely a placeholder saying "check system routing table".
Again, I apologize if I have gravely misunderstood some concepts.
-
I assumed (perhaps incorrectly) that setting the destination network to 0.0.0.0/0 is essentially saying "anything is allowed to be routed to that tunnel if an appropriate static route exist in the system routing table". In essence:
route 10.1.1.0/24
through 0.0.0.0via interface ipsec1 (through 0.0.0.0 part seems superfluous)This is handled by the traffic selectors, you can see this config in
/var/etc/ipsec/swanctl.conf
. This already happens in addition to what you enter in the GUI.The last paragraph is somewhat confusing to me from a system standpoint, since 169.254.0.0 networks are reserved for Windows OS devices unable to obtain an address. Both are unroutable networks but here 169.254.0.0 has a much more specific context while 0.0.0.0 is merely a placeholder saying "check system routing table".
It's OK to use the APIPA address space for point-to-point tunnels. I gave it as an example because it's commonly used by cloud platforms for the same purpose. You are free to use any address you want as long as you understand its context in the network.