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

    Seperating VPN Traffic from Non VPN Traffic

    Scheduled Pinned Locked Moved OpenVPN
    14 Posts 3 Posters 2.9k 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.
    • T
      tattinger
      last edited by

      This is my first post here. I have had a good experience with pfSense so far.

      I installed pfSense 2.2.2 on a Supermicro MBD-A1SRM-LN7F-2758 motherboard with  16 GB memory.

      I have quite a few computers on my Lan but only need about 2 computers to use the VPN. The way I set it up that it worked for me was by setting up an Alias in the Firewall settings where I listed the Ip's of all the computers that were not a part of the VPN group. This is working fine but my question is : It would be a little easier to just make a rule that states the computers that are a part of them VPN group since this is a much smaller list. For some reason I could not get it to work this way?

      Any ideas or suggestions would be appreciated on how to accomplish this.

      1 Reply Last reply Reply Quote 0
      • DerelictD
        Derelict LAYER 8 Netgate
        last edited by

        Firewall rules are processed top down, first match wins.

        Your rules need to list the most-specific cases first (the hosts you want to use the VPN) to less specific (everyone else use the default gateway).

        Considering no real info was provided that's my blind guess as to what you did wrong.

        There is a lot of information here about policy routing out a VPN:

        https://forum.pfsense.org/index.php?topic=76015.0

        https://doc.pfsense.org/index.php/What_is_policy_routing

        Chattanooga, Tennessee, USA
        A comprehensive network diagram is worth 10,000 words and 15 conference calls.
        DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
        Do Not Chat For Help! NO_WAN_EGRESS(TM)

        1 Reply Last reply Reply Quote 0
        • T
          tattinger
          last edited by

          @Derelict:

          Firewall rules are processed top down, first match wins.

          Your rules need to list the most-specific cases first (the hosts you want to use the VPN) to less specific (everyone else use the default gateway).

          Considering no real info was provided that's my blind guess as to what you did wrong.

          There is a lot of information here about policy routing out a VPN:

          https://forum.pfsense.org/index.php?topic=76015.0

          https://doc.pfsense.org/index.php/What_is_policy_routing

          Thanks you Derelict for your help. I have read through the url's that you have posted and still have not figured out what I did wrong however pfSense is working fine the way I did set it up. I will read over what you sent me incase I missed something.

          The way I have it set up now is in Firewall aliases I have a list of all the IP's that I do not want to go through the VPN. I have my three interphases, VPN , Lan and Wan.
          Under firewall Rules Lan I have a Firewall rule, Non VPN clients .

          1 Reply Last reply Reply Quote 0
          • johnpozJ
            johnpoz LAYER 8 Global Moderator
            last edited by

            Why don't you post your rules and we can talk a look see.

            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
            • T
              tattinger
              last edited by

              @johnpoz:

              Why don't you post your rules and we can talk a look see.

              Thanks johnpoz for your help.

              Here are my firewall Rules:

              ![Firewall Rules Wan.JPG](/public/imported_attachments/1/Firewall Rules Wan.JPG)
              ![Firewall Rules Wan.JPG_thumb](/public/imported_attachments/1/Firewall Rules Wan.JPG_thumb)
              ![Firewall rules Lan.JPG](/public/imported_attachments/1/Firewall rules Lan.JPG)
              ![Firewall rules Lan.JPG_thumb](/public/imported_attachments/1/Firewall rules Lan.JPG_thumb)
              ![Firewall Rules IVPN.JPG](/public/imported_attachments/1/Firewall Rules IVPN.JPG)
              ![Firewall Rules IVPN.JPG_thumb](/public/imported_attachments/1/Firewall Rules IVPN.JPG_thumb)
              ![Firewall Rules Open VPN.JPG](/public/imported_attachments/1/Firewall Rules Open VPN.JPG)
              ![Firewall Rules Open VPN.JPG_thumb](/public/imported_attachments/1/Firewall Rules Open VPN.JPG_thumb)

              1 Reply Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator
                last edited by

                I don't see anything in those rules that would send traffic out your vpn.. I see a rule that would send traffic out your wan dhcp connection if dest is not the lan network and are in the source alias.

                Is wan_dhcp not set to default in your routes, gateway section?  And your vpn is?

                gateways.png
                gateways.png_thumb

                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
                • DerelictD
                  Derelict LAYER 8 Netgate
                  last edited by

                  Yeah, that ! LAN Net is worthless.  You will never see traffic coming into your LAN interface destined for LAN net.  The hosts on LAN net will just communicate directly on the local subnet.

                  Chattanooga, Tennessee, USA
                  A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                  DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                  Do Not Chat For Help! NO_WAN_EGRESS(TM)

                  1 Reply Last reply Reply Quote 0
                  • T
                    tattinger
                    last edited by

                    @johnpoz:

                    I don't see anything in those rules that would send traffic out your vpn.. I see a rule that would send traffic out your wan dhcp connection if dest is not the lan network and are in the source alias.

                    Is wan_dhcp not set to default in your routes, gateway section?  And your vpn is?

                    wan_dhcp is set to default. Vpn is not.

                    Thanks johnpoz

                    @ Derelict,
                    Thanks for the info . A friend of mine helped me set it up and he thought the ! Lan Net would work .

                    1 Reply Last reply Reply Quote 0
                    • DerelictD
                      Derelict LAYER 8 Netgate
                      last edited by

                      There aren't any rules that send traffic to a VPN based on what you've shown.  Are you sure you're using the VPN?

                      Chattanooga, Tennessee, USA
                      A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                      DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                      Do Not Chat For Help! NO_WAN_EGRESS(TM)

                      1 Reply Last reply Reply Quote 0
                      • T
                        tattinger
                        last edited by

                        @Derelict:

                        There aren't any rules that send traffic to a VPN based on what you've shown.  Are you sure you're using the VPN?

                        Yes I am using a VPN. I checked under status/Openvpn and it says Service is running. I checked in System Logs/Open VPN and everything looks good. When I do an ip check I do get the ip of the server. as I have stated in aliases I have listed all the non-vpn clients by ip's and I have verified that that these clients do not go through the VPN.

                        Thanks Derelict

                        1 Reply Last reply Reply Quote 0
                        • DerelictD
                          Derelict LAYER 8 Netgate
                          last edited by

                          Then you must be getting a default route from the VPN server.  Typically one has to turn on Don't pull routes in the OpenVPN client config then policy route just the traffic they want over the VPN otherwise everything goes over the VPN.

                          As long as it's working for you…

                          Chattanooga, Tennessee, USA
                          A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                          DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                          Do Not Chat For Help! NO_WAN_EGRESS(TM)

                          1 Reply Last reply Reply Quote 0
                          • T
                            tattinger
                            last edited by

                            @Derelict:

                            Then you must be getting a default route from the VPN server.  Typically one has to turn on Don't pull routes in the OpenVPN client config then policy route just the traffic they want over the VPN otherwise everything goes over the VPN.

                            As long as it's working for you…

                            Yes Derelict it does work this way. I have been messing with it all weekend, however, I would like to learn how to set it up where I select only the 2 computers that I want to use the VPN and all others are excluded from VPN.

                            What Info can I provide so I can figure this out??

                            Thanks again.

                            1 Reply Last reply Reply Quote 0
                            • DerelictD
                              Derelict LAYER 8 Netgate
                              last edited by

                              Just look at the OpenVPN threads.  There's a really long one about PIA that covers all this.  Sorry, I don't have a bookmark for it.

                              There's a checkbox in the OpenVPN client config that says don't pull routes.  With that checked make an alias for the hosts you want to go out the VPN and set the VPN as a gateway in a matching rule.

                              Chattanooga, Tennessee, USA
                              A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                              DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                              Do Not Chat For Help! NO_WAN_EGRESS(TM)

                              1 Reply Last reply Reply Quote 0
                              • T
                                tattinger
                                last edited by

                                @Derelict:

                                Just look at the OpenVPN threads.  There's a really long one about PIA that covers all this.  Sorry, I don't have a bookmark for it.

                                There's a checkbox in the OpenVPN client config that says don't pull routes.  With that checked make an alias for the hosts you want to go out the VPN and set the VPN as a gateway in a matching rule.

                                Appreciate the help. Will look for the post on PIA so I can figure it out.

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