This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

18.04 route_precedence not working for VPN Routes

our customer has an IPSEC VPN Tunnel to a bunch of 10.x.x.x/y destinations. 

Also he has a summarised 10.0.0.0/8 pointing towards another directly connected router (10.116.35.1).

they are not the same destinations. The IPSEC Traffic must go over the VPN Tunnel and the rest needs to go over the connected router.

Enjoy my super dope schema for this:

the achieve this we reconfigured the route precedence as below:

Sophos Firmware Version SFOS 18.0.4 MR-4

console> system route_precedence show
Routing Precedence:
1. VPN routes
2. Static routes
3. SD-WAN policy routes

now, regardless if we configure a static route or a policy based router for the 10.0.0.0/8 network, it will overwrite the IPSEC Tunnel routes and will route traffic for 10.x.x.x/y to the connected router.

SD-WAN Policy 10.0.0.0/8

IPSEC Tunnel Policy 10.x.x.x/y

Here is a ping example of the IPSEC Remote destination before the SD-WAN Rule is Disabled

SWC-RATH-GV00-1 ping 10.150.70.40 source-interface VL184_Server
PING 10.150.70.40 (10.150.70.40) from 10.4.184.184 : 56(84) bytes of data.
64 bytes from 10.150.70.40: icmp_seq=1 ttl=251 time=22.8 ms
64 bytes from 10.150.70.40: icmp_seq=2 ttl=251 time=20.2 ms
64 bytes from 10.150.70.40: icmp_seq=3 ttl=251 time=20.4 ms
64 bytes from 10.150.70.40: icmp_seq=4 ttl=251 time=22.3 ms
64 bytes from 10.150.70.40: icmp_seq=5 ttl=251 time=24.3 ms
64 bytes from 10.150.70.40: icmp_seq=6 ttl=251 time=17.7 ms

After it's active:

--- 10.150.70.40 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5006ms
rtt min/avg/max/mdev = 17.781/21.336/24.335/2.119 ms
SWC-RATH-GV00-1 ping 10.150.70.40 source-interface VL184_Server
PING 10.150.70.40 (10.150.70.40) from 10.4.184.184 : 56(84) bytes of data.
^C
--- 10.150.70.40 ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 5039ms

SWC-RATH-GV00-1 traceroute 10.150.200.45 source-interface VL184_Server
traceroute to 10.150.200.45 (10.150.200.45), 30 hops max, 60 byte packets
1 (10.116.35.10) 0.535 ms 0.454 ms 0.487 ms
2 (10.116.35.1) 5.531 ms 3.611 ms 1.682 ms.  <-- router, not ipsec
3 (10.254.97.15) 13.688 ms 13.218 ms 17.153 ms
4 (10.254.98.5) 15.497 ms 15.137 ms 15.718 ms
5 (10.254.98.6) 15.052 ms 15.349 ms 15.046 ms^C

any ideas why this is not working?



This thread was automatically locked due to age.
Parents
  • There are three different independent routing tables. 

    The RFC standard to use the subnet mask to find the matching route (Like use /24 over /8) does not work across those routing tables. 

    Is your source device one of both 1:1 NAT subnet masks or not? I can see there are two networks as 1:1 Networks. Those are the only routes, applied by XG. See Ipsec status. XG will only apply Source + destination of local and remote subnet and ignore everything else. 

    You can, as you already did, set a own route via CLI, which will be considered additionally to your ipsec Routes. 

    __________________________________________________________________________________________________________________

  • so if I get that right, there are three different routing tables

    - static

    - pbr (sd-wan)

    - vpn

    each routing table works within itself "best match"   but they don't work "best match" across each other, thats why you can configure route_precedence to change the order like so:

    1. VPN

    2. static 

    3. pbr

    in this case, if there is a VPN route eg. /16 it will win against a more specific static route eg. /24, because it has the higher priority, right?

    so lets go back to the customer setup:

    Yes the original source networks are source natted

    for simplicity let's go with on combination only:

    Tunnel original  Subnet: 10.1.1.0/24   Tunnel local subnet (SNAT): 10.2.2.0/24    Tunnel Remote: 10.150.70.40

    from ipsec status i can see that the route is installed as:

    10.2.2.0 <-> 10.150.70.40

    before I configured IPSEC Static routes, i did not see this route in the static routing tables, when doing a "route" from the adv. CLI.

    So I assume, what the command:

     system ipsec_route add net x.x.x.x/x tunnelname xxxx

    essentially does, it puts a route into the static routing table to point to the IPSEC routing table. 

    That would totally make sense, if the static routing table has the higher priority, than the VPN routing table.

    but why is it necessary if the route_precedency is set to VPN, static, pbr?

    I mean the tunnel works as expected including the SNAT as long as there is no static or PBR routing, containing the same subnets.

    regardless of the orgiginal source or the natted source.

    why is a static route able to overule the ipsec route, if "VPN" has the highest priortiy.

    looking a the flow chart below, i don't get how  SNAT'ted VPN traffic matches any ACL at all, since SNAT is done after routing decition.

  • There is a false assumption: The CLI Command to add a route will not place this route into the Static routing, instead into the VPN category. 

    __________________________________________________________________________________________________________________

  • Got that. 

    But I still don't understand why I need to configure the IPSEC Route statically via console.

    It does not work without static IPSEC Routes.

    Routing Precedence is set to:
    1. VPN routes
    2. Static routes
    3. SD-WAN policy routes

    when doing a:  

    ip route show table all 

    I can see the following routes are present:

    VPN

    10.150.0.0/22 dev ipsec0 table 220 scope link 

    10.150.0.0/22 dev ipsec0 scope link 

    static Route

    10.0.0.0/8 via 10.116.35.1 dev LAG.97 proto zebra metric 255 

    but without the static IPSEC route:

    system ipsec_route add net 10.150.0.0/255.255.0.0 tunnelname KIVBF_de 

    the firewall always preferes the static 10.0.0.0/8 over the VPN Route. 

  • system ipsec_route add net 10.150.0.0/255.255.0.0 tunnelname KIVBF_de  Is a VPN Route, not a static route. 

    __________________________________________________________________________________________________________________

  • Yes I know,  that's what I'm saying.

    When I referred to static VPN route, I meant I had to manually  ("statically") configure this route via Console

    And the question is, why is it necessary to configure this route from the CLI. 

    As i explained the route precedency is set to VPN / Static / Sd-WAN, but a soon a I configure a static route, which contains the subnets from the VPN Network, it overrules the VPN Routes and traffic is sent to the local router.

    the firewall simply ignores the route precedency, if there is no IPSEC_Route configured from the CLI, even if I can clearly see the route being automatically configured by the VPN Tunnel. 

  • The pre defined IPsec routes of your setup seems not to match, therefore they will be ignored. 

    They only will be applied, if the source and destination network 100% apply to the traffic, which seems not to be the case in your setup. Therefore they will be ignored, and the next routing table is static, which apply the static route matching. 

    __________________________________________________________________________________________________________________

  • Alright, so in short

    if you have a source NAT applied to a VPN Tunnel, you always need additional ipsec_routes, in case you have an overlapping static or sd-wan rule. 

    ignoring the fact, that there will always be a overlapping default route 0.0.0.0/0, but i guess that one is handled differently.

    thx, makes sense now.

Reply
  • Alright, so in short

    if you have a source NAT applied to a VPN Tunnel, you always need additional ipsec_routes, in case you have an overlapping static or sd-wan rule. 

    ignoring the fact, that there will always be a overlapping default route 0.0.0.0/0, but i guess that one is handled differently.

    thx, makes sense now.

Children
No Data