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

    Allow VLAN Traffic to Internet?

    Scheduled Pinned Locked Moved Firewalling
    36 Posts 9 Posters 7.5k 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.
    • JKnottJ
      JKnott
      last edited by

      @michaelcropper said in Allow VLAN Traffic to Internet?:

      What is the best way of doing this? Reading around seems that the primary recommended approach is to;

      Here are my VLAN rules for my guest WiFi. It's configured to allow a guest to access the Internet and to ping the interface, nothing else. Adjust to taste.

      f8622472-3315-40a6-ad7c-b94e84538979-image.png

      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...

      1 Reply Last reply Reply Quote 0
      • M
        MichaelCropper
        last edited by MichaelCropper

        I've been doing some more testing, and I'm confused again.

        Scenario 1 - Allow all !RFC1918

        I created an alias and configured the three IP ranges;

        • 10.0.0.0/8
        • 172.16.0.0/12
        • 192.168.0.0/16

        I then configure VLAN 1 to: Allow All from Any to ! RFC1918 Alias, and, to Allow Port 53 from Any to This Firewall.

        Great. This worked.

        So I thought I'd try something a little different to see how this behaves. Given the previous comment around the other camp to explicitly block rather than a blanket block etc.

        Scenario 2 - Block All VLAN Traffic

        So I configured another alias for all the VLANs;

        • 192.168.2.0/24
        • 192.168.3.0/24
        • 192.168.4.0/24
        • etc.

        And I configured the firewall rule on VLAN 1 to: Block All to VLAN Traffic Alias.

        And it didn't work.

        Then I tweaked that rule to: Allow All to ! VLAN Traffic Alias

        And it worked.

        I don't get it. Aren't those two rules exactly the same thing?

        What I am not understanding?

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

          @michaelcropper said in Allow VLAN Traffic to Internet?:

          So I configured another alias for all the VLANs;

          192.168.2.0/24
          192.168.3.0/24
          192.168.4.0/24
          etc.

          And I configured the firewall rule on VLAN 1 to: Block All to VLAN Traffic Alias.
          And it didn't work.

          What exactly did not work?

          Consider that adding a block rule doesn't break already existing connections. If pfSense has a state for connection, the traffic is still passed.
          To drop the existing connections you have to kill the states. Diagnostic > states

          M 1 Reply Last reply Reply Quote 0
          • M
            MichaelCropper @viragomann
            last edited by

            @viragomann Should have added, I use the Reset States feature after all rule configuration changes to make sure they flush through.

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

              @michaelcropper and in what order did you put the rules.. Order matters!

              Top down, first rule to trigger wins, no other rules are evaluated.

              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

              M 1 Reply Last reply Reply Quote 0
              • M
                MichaelCropper @johnpoz
                last edited by

                @johnpoz It was the only rule at the time, I'm pretty sure.

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

                  @michaelcropper well then your states did flush, or your rule was wrong - its that simple. Maybe your rule was tcp only and you were doing icmp?

                  Here so got a constant ping going.. Added the rule - and still pinging

                  pinggoing.jpg

                  Notice that rule doesn't show any hits the 0/0

                  I then kill the state.. Ping stops

                  stop.jpg

                  And you notice on the firewall rule - its showing hits on the rule the 0/300 now..

                  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
                  • S SteveITS referenced this topic on
                  • S SteveITS referenced this topic on
                  • M
                    MichaelCropper
                    last edited by

                    I think I've found a combo that works, and I also think I know why it works now too.

                    886c36d0-7e87-40a0-a412-d98e947fd6a6-image.png

                    Essentially the firewall rules work kind of like a coin sorting machine. In the sense that once the network packet has been "captured" by a rule, then that network packet has been captured and sent where it needs to go, so it can't be double evaluated by a second or third rule.

                    To put it simply in a more visual way, essentially something like this - i.e. a coin / bit of network traffic can't fall through two slits, only the first one that matches;

                    d060b792-81fa-4145-9444-21782816c73b-image.png

                    Hence why the top screenshot in this reply this seems to be working now when I am testing from PC 2, on VLAN 2, this can't ping PC 1 on LAN, it can't ping Printer on VLAN 3, and can't ping server on VLAN 4. Because in each of these scenarios it is being captured by the second rule for "Block All VLANS and LAN" traffic.

                    And it allows ping google.com from PC 2 on VLAN 2 because that is getting caught by Rule 1 to allow Port 53 to This Firewall to access the cached DNS stored on the firewall based on whatever the authoritative DNS server is for any domain I ping on the internet.

                    And hence allows everything else to work when accessing the internet because of the last rule, which is required because there is a 4th hidden rule which is to block everything, so if we didn't have this rule then very little would work.

                    Have I understood that correctly? It feels like it's starting to sink in.

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

                      @michaelcropper If you want to think of it as coin sorting machine sure ok ;)

                      Top down, first rule to trigger wins, no other rules are evaluated..

                      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

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        MichaelCropper @johnpoz
                        last edited by

                        @johnpoz Thanks. It's making sense now.

                        I think where I have been getting confused for a while is that I was getting mixed up about how the pieces connect together. i.e. I was thinking that because I am sending a ping from PC 2 on VLAN 2 that it is already inside the firewall because of how the VLANS are configured, but that isn't the case. It's more a case that everything is distrusted until the final hop actually into the pfSense firewall, then the packet is captured by one and only one of the rules, which states where it is allowed to go, then if the network packet is asking to go somewhere it is allowed, then on it goes, whereas if it is asking to go somewhere it is not allowed, then it's blocked by that firewall rule and doesn't go any further (or responds with a 'computer says no' type message).

                        Networking concepts are extremely abstract and most documentation online conflates terminology and doesn't make it clear between the physical and virtual layers which makes things even more confusing.

                        The few analogies I've used along the way have certainly helped to solidify my understanding now so thanks for the help and patience answering the questions (same to all in this thread!).

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

                          @michaelcropper I like to think of it this way for where rules go..

                          You have a guy come to your front door (lan) and says he wants to go to the back yard (out your wan).. Do you decide to let him in, just to stop him at the back door and say you can not go there, after he has walked thru your house.

                          Or do you say sorry at the front door, you can't go there..

                          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 1
                          • D
                            dsc2000
                            last edited by

                            Thank you to everyone who contributed to this thread. You helped me get my VLAN working and appropriately secured and isolated.

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