Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Policy routing out Wireguard interface - asymetric routing

    Scheduled Pinned Locked Moved Routing and Multi WAN
    15 Posts 4 Posters 1.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      viragomann @dpravd
      last edited by

      @dpravd
      The clue is to remove all pass rules from Wireguard and having pass rules for permitting incoming traffic on the VPN only.

      D 2 Replies Last reply Reply Quote 0
      • D
        dpravd @viragomann
        last edited by

        @viragomann Hmmmm interesting. I'll give this a go, thanks for the info

        1 Reply Last reply Reply Quote 0
        • D
          dpravd @viragomann
          last edited by dpravd

          @viragomann I tried what you said, and can see the traffic is hitting this filter in firewall rules.

          However, return traffic will not policy route properly - it's still going out the WAN.

          Screenshot 2024-03-12 at 9.46.17 AM.png

          Screenshot 2024-03-12 at 9.46.22 AM.png

          Screenshot 2024-03-12 at 9.46.28 AM.png

          So, traffic originating from the lan is fine, it policy routes out the vpn. However traffic coming in on the vpn, goes back out the wan, and skips the policy route for some reason.

          I tried setting allow all flags on the lan firewall rules - but still doesn't work.

          Of note, the return traffic gets natted properly to the VPN address, but from there instead of going out the VPN, it's going out the WAN.

          Here, you can see the SYN acks going out the WAN. The vpn address is 10.11.12.1

          Screenshot 2024-03-12 at 10.12.46 AM.png

          Any ideas?

          Bob.DigB V 2 Replies Last reply Reply Quote 0
          • Bob.DigB
            Bob.Dig LAYER 8 @dpravd
            last edited by

            @dpravd said in Policy routing out Wireguard interface - asymetric routing:

            Any ideas?

            Start over with a fresh install. Don't set your VPN as the default gateway, use policy based routing for that. The default gateway should be WAN. And not "Main()", whatever this is.

            D 1 Reply Last reply Reply Quote 0
            • D
              dpravd @Bob.Dig
              last edited by dpravd

              @Bob-Dig Okay - yeah absolutely, the only reason I was setting the VPN as the default gateway as that was the only way to get the return traffic.

              I'll start again, thanks.

              Bob.DigB 1 Reply Last reply Reply Quote 0
              • Bob.DigB
                Bob.Dig LAYER 8 @dpravd
                last edited by Bob.Dig

                @dpravd And, if your server is on LAN or wherever, you don't need to set the gateway there for a webserver. It would be enough to allow incoming traffic from the VPN to it.

                1 Reply Last reply Reply Quote 0
                • V
                  viragomann @dpravd
                  last edited by

                  @dpravd said in Policy routing out Wireguard interface - asymetric routing:

                  I tried what you said, and can see the traffic is hitting this filter in firewall rules.

                  Your screenshot doesn't show any hits on the VPN rule.
                  Did you reset the states?

                  D 1 Reply Last reply Reply Quote 0
                  • P
                    Popolou
                    last edited by

                    What do your outbound rules look like?

                    V 1 Reply Last reply Reply Quote 0
                    • V
                      viragomann @Popolou
                      last edited by

                      @Popolou said in Policy routing out Wireguard interface - asymetric routing:

                      What do your outbound rules look like?

                      The outbound NAT has not even any impact on response packets.

                      D 1 Reply Last reply Reply Quote 1
                      • D
                        dpravd @viragomann
                        last edited by dpravd

                        I set it up again from scratch. Same thing.

                        Here is the traffic flow - this works fine, traffic goes out the VPN interface and comes back in the VPN interface

                        LAN -> VPN Pfsense -> VPN ubuntu -> INTERNET
                        10.5.0.0/24 -> 10.11.12.1/31 -> 10.11.12.0/31 -> 0.0.0.0/0

                        Here is the broken traffic - traffic comes in the VPN interface, but then goes out the WAN

                        INTERNET (dnat to 10.11.12.1) -> VPN ubuntu -> pfsense VPN (port forwards on vpn interface) -> LAN
                        0.0.0.0/0 -> 10.11.12.0/31 -> 10.11.12.1/31 -> 10.5.0.0/24

                        In the second flow, the traffic gets to the lan fine, and gets natted to 10.11.12.1 fine, but then goes out the wan.

                        Lan rule has gatway of VPN.
                        Wireguard interface has no rules
                        VPN interface has allow all
                        Default gateway of box is WAN.

                        V 1 Reply Last reply Reply Quote 0
                        • D
                          dpravd @viragomann
                          last edited by

                          @viragomann Yes - sorry, I reset the states just before I took the screenshot

                          1 Reply Last reply Reply Quote 0
                          • V
                            viragomann @dpravd
                            last edited by

                            @dpravd
                            To ensure that the proper rule is applied, enable logging in the rule and check the filter log after initiating traffic from remote.
                            Note the logged rule ID, which is passing the traffic and check if it's the rule you added on the VPN interface.

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post
                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.