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

    Routing a single VLAN to a VPN

    Scheduled Pinned Locked Moved OpenVPN
    18 Posts 6 Posters 2.2k 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.
    • 04CC400
      04CC40 @Bob.Dig
      last edited by

      @bob-dig

      Screenshot from 2023-03-14 10-23-31.png

      Currently everything is hooked to another router so I could test it. I think the ISP's modem would require a WAN_PPPOE gateway, but this is the way it looks.

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

        @04cc40
        Routing certain IPs or subnets over an existing VPN has nothing to do with the ISP gateway at all.

        If you don't want to to route your whole upstream traffic to the VPN server, but only a single subnet, go to the OpenVPN client settings and check "Don't pull routes" to avoid that the default route is changed on pfSense.

        Then add a policy routing rule to the subnet you want to use the VPN for none-RFC 1918 destinations to direct the packets to the VPN gateway.

        04CC400 1 Reply Last reply Reply Quote 0
        • 04CC400
          04CC40 @viragomann
          last edited by

          @viragomann said in Routing a single VLAN to a VPN:

          @04cc40
          Routing certain IPs or subnets over an existing VPN has nothing to do with the ISP gateway at all.

          Just wanted to clarify the IP situation.

          If you don't want to to route your whole upstream traffic to the VPN server, but only a single subnet, go to the OpenVPN client settings and check "Don't pull routes" to avoid that the default route is changed on pfSense.

          "Don't pull routes" is already checked as per PIA instructions (not the guide itself, but a thread on their forum).

          Then add a policy routing rule to the subnet you want to use the VPN for none-RFC 1918 destinations to direct the packets to the VPN gateway.

          Where can I read up on achieving this?

          Thanks.

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

            @04cc40 said in Routing a single VLAN to a VPN:

            "Don't pull routes" is already checked as per PIA instructions (not the guide itself, but a thread on their forum).

            If this is checked all devices should go out to the default gateway as long as they are not policy routed.
            And as your gateways screenshot shows, WAN is your default gateway. Maybe was the VPN client disconnected, as you took it?

            Then add a policy routing rule to the subnet you want to use the VPN for none-RFC 1918 destinations to direct the packets to the VPN gateway.

            Where can I read up on achieving this?

            Just noticed that you did this already:

            b5eb4ac7-cfe6-4759-8429-bbdf00c045f8-image.png

            The red one.
            But this rule will never be applied, because the yellow one matches before to the same traffic. So it is applied an following rules are ignored.
            You have to change their positions to get the policy routing to work.

            This let me assume that all your traffic went out to WAN instead of VPN as you said in your first post above.

            04CC400 1 Reply Last reply Reply Quote 0
            • 04CC400
              04CC40 @viragomann
              last edited by

              @viragomann said in Routing a single VLAN to a VPN:

              @04cc40 said in Routing a single VLAN to a VPN:

              "Don't pull routes" is already checked as per PIA instructions (not the guide itself, but a thread on their forum).

              If this is checked all devices should go out to the default gateway as long as they are not policy routed.
              And as your gateways screenshot shows, WAN is your default gateway. Maybe was the VPN client disconnected, as you took it?

              VPN was up.

              Then add a policy routing rule to the subnet you want to use the VPN for none-RFC 1918 destinations to direct the packets to the VPN gateway.

              Where can I read up on achieving this?

              Just noticed that you did this already:

              b5eb4ac7-cfe6-4759-8429-bbdf00c045f8-image.png

              The red one.
              But this rule will never be applied, because the yellow one matches before to the same traffic. So it is applied an following rules are ignored.
              You have to change their positions to get the policy routing to work.

              I'll try changing the order and report back.

              This let me assume that all your traffic went out to WAN instead of VPN as you said in your first post above.

              The problem is the other way around, all my VLANS are going out through the VPN when I want only a specific VLAN to be tunneled.

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

                @04cc40 said in Routing a single VLAN to a VPN:

                The problem is the other way around, all my VLANS are going out through the VPN when I want only a specific VLAN to be tunneled.

                Yes, I noticed that. But this makes no sense to me. This sign indicate the actual default gateway:
                0216c115-2de9-48a3-9df1-28076e7ddd8b-image.png

                So if this is next to the WAN gateway, I expect that the traffic goes out to WAN.
                Below you can select the default gateway manually. But as this is also in automatic mode, it shouldn't use the VPN.

                04CC400 1 Reply Last reply Reply Quote 0
                • 04CC400
                  04CC40 @viragomann
                  last edited by

                  @viragomann I am partially glad this makes no sense to someone else.

                  I have changed the order of the rules and the problem persists. For example VLAN_30 is supposed to be a clearnet and is not specified to be tunneled through the VPN_WAN gateway:

                  Screenshot at 2023-03-14 18-04-12.png

                  VPN connection is established:

                  Screenshot at 2023-03-14 18-07-18.png

                  My computer is connected to an SSID assigned to VLAN_30 and is being assigned an IP within that subnet:

                  Screenshot from 2023-03-14 18-15-15.png

                  But still, my public IP is one linked to the VPN (PIA Atlanta server in Georgia) :

                  Screenshot from 2023-03-14 18-16-24.png

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    mcury @04CC40
                    last edited by

                    @04cc40 Is this ticked in your pfsense openvpn client configuration?

                    21a2a53b-ee83-4c27-85d8-a9d9988455e9-image.png

                    dead on arrival, nowhere to be found.

                    1 Reply Last reply Reply Quote 0
                    • 04CC400
                      04CC40
                      last edited by

                      @mcury

                      Checked.

                      Screenshot at 2023-03-14 19-01-54.png

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

                        @04cc40 Then you may have a mess in Outbound NAT I guess.

                        04CC400 1 Reply Last reply Reply Quote 0
                        • JKnottJ
                          JKnott @04CC40
                          last edited by

                          @04cc40 said in Routing a single VLAN to a VPN:

                          My problem is that I want only a specific VLAN to pass through the VPN

                          You don't pass a VLAN through a VPN, you route the subnet.

                          PfSense running on Qotom mini PC
                          i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                          UniFi AC-Lite access point

                          I haven't lost my mind. It's around here...somewhere...

                          04CC400 1 Reply Last reply Reply Quote 0
                          • 04CC400
                            04CC40 @JKnott
                            last edited by

                            @jknott

                            Sorry I "misspoke".

                            1 Reply Last reply Reply Quote 0
                            • 04CC400
                              04CC40 @Bob.Dig
                              last edited by

                              @bob-dig

                              I decided to reset the appliance and redo all the config. It seems to be working as expected now, but I guess I'll never know where I f'ed up the first time.

                              1 Reply Last reply Reply Quote 0
                              • I
                                I.T._Lee
                                last edited by

                                I found this walk-through by Lawrence at Lawrence Systems. Goes through the setup of exactly what you want to achieve and explains why settings should be where they are and what simple mistakes can catch you out. I know you have it working now but it may help you to discover what the error was or it could help someone with the same problem in the future:

                                https://youtu.be/ulRgecz0UsQ

                                04CC400 1 Reply Last reply Reply Quote 0
                                • 04CC400
                                  04CC40 @I.T._Lee
                                  last edited by

                                  @i-t-_lee Thanks. I actually switched to pfSense around 3 years ago because of his channel. I also switched to Unifi switches and AP's because of him. I did follow the nguvu guide because I'd rather be reading than pause-playing a video on YT, but you're right, his channel is a great resource.

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