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

    Policy based routing and VPN again

    Scheduled Pinned Locked Moved Firewalling
    15 Posts 4 Posters 4.4k 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.
    • johnpozJ
      johnpoz LAYER 8 Global Moderator
      last edited by

      "everything coming in through the vpn is trying to go back out the WAN"

      Well then sounds like your issue is on the remote side..

      An intelligent man is sometimes forced to be drunk to spend time with his fools
      If you get confused: Listen to the Music Play
      Please don't Chat/PM me for help, unless mod related
      SG-4860 24.11 | Lab VMs 2.8, 24.11

      1 Reply Last reply Reply Quote 0
      • C
        CuteBoi
        last edited by

        @Hugovsky:

        tl;dr.

        To me, best option is to create an alias with machine's ips that should use VPN. Then create the rules in lan interface and set gateway on that rules. Take care about the order. Don't forget that as soon as a rule matches, it will be applied.

        Connections initiated from outside, will not pass to the network as long as you don't nat them. Connections initiated from inside will go thru that gateway as long as it's initiated from one ip in that alias.

        Word for word, my config says that's what I'm doing

        pass  in  quick  on $LAN  $GWAirVPN inet from $transmission to any tracker 1493862877 keep state  label "USER_RULE"
        

        "$transmission" is myAlias table list of hosts that are supposed to use the "$GWAirVPN" gateway on "$LAN" as the FIRST rule.

        When someone says

        To me, best option is to create an alias with machine's ips that should use VPN. Then create the rules in lan interface and set gateway on that rules. Take care about the order. Don't forget that as soon as a rule matches, it will be applied.

        Am I not doing that?  I'm confused, as I thought that's what I was doing.  I must be missing something.

        @johnpoz:

        "everything coming in through the vpn is trying to go back out the WAN"

        Well then sounds like your issue is on the remote side..

        How could this be on the Remote side?  Just like the other topic with a similar issue, this is a VPN service.  If I set my default gateway to that of the VPN service, all port forwarding responses and initiated traffic goes through the VPN as one would assume should work.

        1 Reply Last reply Reply Quote 0
        • H
          Hugovsky
          last edited by

          @CuteBoi:

          @Hugovsky:

          tl;dr.

          To me, best option is to create an alias with machine's ips that should use VPN. Then create the rules in lan interface and set gateway on that rules. Take care about the order. Don't forget that as soon as a rule matches, it will be applied.

          Connections initiated from outside, will not pass to the network as long as you don't nat them. Connections initiated from inside will go thru that gateway as long as it's initiated from one ip in that alias.

          Word for word, my config says that's what I'm doing

          pass  in  quick  on $LAN  $GWAirVPN inet from $transmission to any tracker 1493862877 keep state  label "USER_RULE"
          

          "$transmission" is myAlias table list of hosts that are supposed to use the "$GWAirVPN" gateway on "$LAN" as the FIRST rule.

          When someone says

          To me, best option is to create an alias with machine's ips that should use VPN. Then create the rules in lan interface and set gateway on that rules. Take care about the order. Don't forget that as soon as a rule matches, it will be applied.

          Am I not doing that?  I'm confused, as I thought that's what I was doing.  I must be missing something.

          Well… to be fair, I did put tl;dr there didn't I?  ;)

          Can you post the GUI rule?

          1 Reply Last reply Reply Quote 0
          • C
            CuteBoi
            last edited by

            that Tl;dr was too far up, I typically skip to the bottom to see if it was there. bleh.

            ![Screenshot from 2017-05-26 09-07-54.png](/public/imported_attachments/1/Screenshot from 2017-05-26 09-07-54.png)
            ![Screenshot from 2017-05-26 09-07-54.png_thumb](/public/imported_attachments/1/Screenshot from 2017-05-26 09-07-54.png_thumb)

            1 Reply Last reply Reply Quote 0
            • H
              Hugovsky
              last edited by

              Seems ok to me. Do you have NAT rules (port forward to inside ip) also?

              1 Reply Last reply Reply Quote 0
              • C
                CuteBoi
                last edited by

                Added an allow rule to see if that would help, not like the results make sense anyways.

                ![Screenshot from 2017-05-26 09-48-46.png](/public/imported_attachments/1/Screenshot from 2017-05-26 09-48-46.png)
                ![Screenshot from 2017-05-26 09-48-46.png_thumb](/public/imported_attachments/1/Screenshot from 2017-05-26 09-48-46.png_thumb)

                1 Reply Last reply Reply Quote 0
                • P
                  pfBasic Banned
                  last edited by

                  Post a pic of your NAT rules.

                  1 Reply Last reply Reply Quote 0
                  • C
                    CuteBoi
                    last edited by

                    Simple stuff

                    ![Screenshot from 2017-05-26 13-11-18.png](/public/imported_attachments/1/Screenshot from 2017-05-26 13-11-18.png)
                    ![Screenshot from 2017-05-26 13-11-18.png_thumb](/public/imported_attachments/1/Screenshot from 2017-05-26 13-11-18.png_thumb)

                    1 Reply Last reply Reply Quote 0
                    • P
                      pfBasic Banned
                      last edited by

                      I'm no pro, and maybe it's different for your config. But based on my working config, I think the "simple stuff" is where you messed up.

                      What about localhost?

                      My outbound NAT looks more like this.

                      VPN 127.0.0.0/8 * * 500 VPN Address * static=yes

                      VPN 127.0.0.0/8 * * * VPN Address * static=no

                      VPN (subnet a,b,c, etc) * * 500 VPN Address * static=yes

                      VPN (subnet a,b,c, etc) * * * VPN Address * static=no

                      That's with Hybrid outbound.

                      1 Reply Last reply Reply Quote 0
                      • C
                        CuteBoi
                        last edited by

                        I checked this, added in the nat rule.

                        Still no work.  Nat rules are working as far as I can tell.

                        ![Screenshot from 2017-05-26 14-54-48.png](/public/imported_attachments/1/Screenshot from 2017-05-26 14-54-48.png)
                        ![Screenshot from 2017-05-26 14-54-48.png_thumb](/public/imported_attachments/1/Screenshot from 2017-05-26 14-54-48.png_thumb)

                        1 Reply Last reply Reply Quote 0
                        • C
                          CuteBoi
                          last edited by

                          For giggles, I added in a am AIRVPN_TAG parameter on the port forwarded rules in the AIRVPN ruleset, and a floating rule of "any any any with tagged AIRVPN_TAG" to set the gateway to GW AIRVPN, and still, traffic is trying to go out the WAN.

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