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

    FW rules not working as dsigned.

    Scheduled Pinned Locked Moved Firewalling
    19 Posts 5 Posters 1.1k 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 @g405tsh311
      last edited by johnpoz

      You really need to post up your rules if you want any help.

      Out of the box pfsense allows all traffic out the lan, default is any any rule. And yes the return traffic would be allowed via the state.

      If you created a new interface you would need to create rules, since the default is deny.. As mentioned wan address or net is not the internet..

      Which makes me wonder in which direction is traveling

      Rules are evaluated as traffic enters an interface from the network its attached too. First rule to trigger wins, no other rules are evaluated.

      Post up your rules if you want help. What I can tell you for FACT!!! Is users say they do A, when really they didn't do anything close to that.. Its more like X+Y=z^2

      For example:

      IPv4 OPT2 * WAN * * none

      If that is your rule - its a nonsense rule, unless all you want to do is allow traffic to the WAN.. And wan what did you put, wan net, wan address? Which has been stated multiple times already.

      Once traffic is allowed the return traffic would be allowed by the state.

      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

      G 1 Reply Last reply Reply Quote 0
      • ?
        A Former User
        last edited by

        I'm not going to be one of those unpleasant people who say RTM, but this is really well written and worth reading for all pfSense users. New and more experienced.

        https://docs.netgate.com/pfsense/en/latest/firewall/index.html

        G 1 Reply Last reply Reply Quote 0
        • G
          g405tsh311 @johnpoz
          last edited by

          @johnpoz said in FW rules not working as dsigned.:

          Seems you have personalized opinion about users in general.
          Beside the point and as previously mentioned, there is only one rule between interface OPT2 and WAN interface.

          If WAN net or address it not pointing to the Internet, then how are you passing your traffic to the internet? Every FW route the packets to the WAN interface unless you have a different def on this meaning. This is not a multi-homed FW. And making comments:
          "If that is your rule - its a nonsense rule, unless all you want to do is allow traffic to the WAN."
          GET OFF your high horse and explained your reasoning. Better yet, if you don't have anything useful to say, just DON'T say anything.

          And since you want to be an AR$$, yes I know how FW rules get evaluated from top to bottom and how they work. As mentioned previously, the only way to make the rule work is using the any/ant rule other than that it wont pass specifict traffic Internet which in other FW that dosn't happen. That is why the ANY factorizes all packets

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

            @g405tsh311 said in FW rules not working as dsigned.:

            there is only one rule between interface OPT2 and WAN interface.

            There is NO such thing.. Rules do not work that way on pfsense - it is not a zone firewall.. You have to set destination based on IP. Be that any or something specific.

            Setting wan as destination, would only get you to the wan net or the wan address.. Doesn't get you to anything past that..

            So yeah stating something like this

            IPv4 OPT2 * WAN * * none

            Is a nonsense rule that sure is not going to let you get to the "internet" or anywhere past the wan..

            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

            G 1 Reply Last reply Reply Quote 0
            • MikeV7896M
              MikeV7896
              last edited by MikeV7896

              The firewall here is ALL based on IP addresses, ports, and protocols.

              Does the protocol match?
              Does the source IP/port match?
              Does the destination IP/port match?
              If so, [allow | block | reject] the packet.

              If the packet is allowed, it's then usually routed based on the IP routing table.

              The rule does not say "Traffic in on this interface should go out that interface." That's not how pfSense works.

              To go back to your original case...

              OPT2 Network: 192.168.2.0/24
              WAN Network: 100.66.64.0/22

              My computer on OPT2, 192.168.2.42, wants to ping a server on the internet.
              >ping 8.8.8.8
              Protocol: IPv4 ICMP... matches
              Source: OPT2 network... matches
              Destination: WAN Network... doesn't match. (8.8.8.8 is not within 100.66.64.0/22)
              Result: No action taken. If no other rules match, the packet is blocked by a default rule.

              If the DESTINATION in the rule was ANY, then the destination would have matched and the packet would have been passed. It would then be routed to the WAN interface based on the IP routing table.

              The S in IOT stands for Security

              G 1 Reply Last reply Reply Quote 0
              • G
                g405tsh311 @A Former User
                last edited by

                @jwj

                Thank you fro the link.

                I have totally no issue RTFM. I just was thinking it is just another FW with the same concepts, but I guess, I was wrong.

                Thank you for the pointer, really appreciated. Going through it right now.

                1 Reply Last reply Reply Quote 0
                • G
                  g405tsh311 @johnpoz
                  last edited by

                  @johnpoz

                  Thank you for the clarification, I am looking into that right.
                  Currently analyzing packet dump.

                  1 Reply Last reply Reply Quote 0
                  • G
                    g405tsh311 @MikeV7896
                    last edited by

                    @virgiliomi

                    Thank you for the guidance.

                    I am a bit confused at your last statement:
                    "If the packet is allowed, it's then usually routed based on the IP routing table."
                    Since the dst IP does not live in the current routing table, but the routing engine know the closest interface that match the destination and so on and so forth until the packet is delivered.

                    Just give me a sec I am going through the packet dump.
                    Thank you again.

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

                      @g405tsh311 said in FW rules not working as dsigned.:

                      Since the dst IP does not live in the current routing table

                      Sure it does.. That is what your default route is for.. For anything not attached or or have a direct route to how to get to some IP, send to default gateway..

                      What he prob meant by this statement

                      it's then usually routed based on the IP routing table."

                      Is you can policy route and send traffic out some other gateway that is not your default, based upon some criteria other than destination IP. Say you have multiple wans, or have a vpn. And you want traffic destined for 1.2.3.4 to go out wan 2 vs default wan 1 gateway. Or maybe you want traffic going to port xyz to go out only your vpn. Or maybe you want some IP on your network 192.168.1.100 to always use vpn..

                      You can create a firewall rule that shoves traffic based on the criteria in the rule out a specific gateway.

                      So while yes normally traffic will be routed based on the routing table - it is possible to policy route if you so desire. Most of the time users use this functionality for routing traffic out a vpn. Where pfsense is a client of some vpn service, or server..

                      know the closest interface that match the destination and so on and so forth until the packet is delivered.

                      Not sure where you got such an idea. No router/firewall works like that. That I have ever seen - and I have been working with routes and networking since before there was even IPs to route ;) There is either a route where to send the traffic per destination IP, or it is sent out the default route.

                      Sure if there are multiple routes for a destination, than route will be chosen based on the metric of the route.. But I have never seen anything like this route is "close" lets send traffic out that interface and see if it gets to where it wants to go. Guess not, lets send it out some other route ;)

                      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

                      G 1 Reply Last reply Reply Quote 0
                      • G
                        g405tsh311 @johnpoz
                        last edited by

                        @johnpoz

                        I am unsure where you get that information but the destination IP does not reside in the current routing table. That is why the routing algorithm determine the next hop to pass it to. Using the default route (0.0.0.0) is a clear indication of missing route. Unless you know about a different RFC, I would love to read it.

                        Every device has its own routing table and no one single router has the entire routing table from source to destination. As I said, in a very over simplistic way. The packet is pass to best found route in the routing table, IP-to-interface. The packet is passed on that inter face which will send the packet to the next hop. This process is repeated until the packet gets to its destination. Over simplistic as well be support the point:
                        https://youtube.com/watch?v=MZ6xBkjjJrU&ab_channel=ISOTraininginsitute

                        1 Reply Last reply Reply Quote 0
                        • G
                          g405tsh311
                          last edited by

                          Feeling really silly and slow due to my findings....LOL

                          In any case, I would like to thank everyone for the responses and assistance provided.

                          After looking at the packet dump and analyzing the network I discover that Win10 was the issue. For some reason the FW was seeing Win10 out sequence and blocking the UDP:43 and TCP:S for TLS over 443/

                          Now the rules is set as previously presented and working wonderfully!!!
                          Thank you again guys, much appreciated!!!

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