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

    Policy routing / gateway rules ignored when "Any" rule is present at the end.

    Scheduled Pinned Locked Moved Routing and Multi WAN
    20 Posts 3 Posters 4.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.
    • K
      kathampy
      last edited by

      @Derelict:

      That shouldn't matter but I wouldn't do it that way. My transport network would be outside the routed subnet.

      What's the correct way to configure this on pfSense? Just create separate static routes for each? These are the VLANs on the switch that are relevant to the LAN interface:

      Default Network
      Subnet: 192.168.1.0/24
      L3 Switch: 192.168.1.1

      Guest Network
      Subnet: 192.168.5.0/24
      L3 Switch: 192.168.5.1

      Firewall Network
      Subnet: 192.168.2.0/24
      L3 Switch: 192.168.2.1
      pfSense: 192.168.2.2

      1 Reply Last reply Reply Quote 0
      • K
        kathampy
        last edited by

        I unchecked "Disable Negate Rules" and tried this.

        @Derelict:

        You can Diagnostics > Command Prompt grep negate_networks /tmp/rules.debug That will also show everywhere it is used.

        table <negate_networks>
        pass  in  quick  on $LAN inet proto { tcp udp }  from $Default  to <negate_networks>  port 53 tracker 10000001 keep state  label "NEGATE_ROUTE: Negate policy routing for destination"
        pass  in  quick  on $LAN inet proto udp  from $Default port $Steam_Source  to <negate_networks> tracker 10000002 keep state  label "NEGATE_ROUTE: Negate policy routing for destination"
        pass  in  quick  on $LAN inet proto udp  from $Default  to <negate_networks>  port $Steam tracker 10000003 keep state  label "NEGATE_ROUTE: Negate policy routing for destination"</negate_networks></negate_networks></negate_networks></negate_networks>
        

        If I check "Disable Negate Rules", then it's empty.

        @DerelictOr:

        Diagnostics > Tables and look at negate_networks.

        This is always empty.

        1 Reply Last reply Reply Quote 0
        • K
          kathampy
          last edited by

          It looks like "Disable Negate Rules" should not have any effect in my case. I need to wait till it stops working again and debug it then.

          1 Reply Last reply Reply Quote 0
          • K
            kathampy
            last edited by

            I've PMed you my rules.debug. "Disable Negate Rules" did not have any effect. The two gateway rules are still being bypassed.

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

              So I am a bit confused on your setup.  So you mention L3 switches on all your networks on pfsense.

              Are these switches all doing routing?  And those network 192.168.1/24 and 5.0/24 and 2.0/24 are transit networks??  Those seem quite large for transit networks, do you have hosts other than your routers on these networks?

              This network you call your default that is the wan of pfsense?  All your rules have default as the source?

              I would suggest you draw up your connectivity..  And keep in mind any connection between pfsense and a downstream router should be via a transit network.  Ie there should not be any hosts or devices on this network that connects pfsense to another router or you run into asymmetrical routing problems.

              Your only showing 1 set of rules.  Which is fine if this is on the transit interface to pfsense.. But your rules on that interface need to allow for the source networks unless your downstream routers are also natting.  And your outbound nat need to allow for the natting of these downstream networks as well.

              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
              • K
                kathampy
                last edited by

                I've attached a network diagram that explains the setup.

                The diagram is the logical view. In reality pfSense in running on Hyper-V. The two WAN cables are also connected to the switch on dedicated VLANs 3 & 4. VLAN 2, 3 & 4 are connected to the pfSense VM as individual network interfaces.

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

                  yup that drawing makes it very clear.. That was not there before was it?

                  So that looks right from my quick look at it..  But your rules are very specific with source ports and source network for example.  So your showing specific states that match that rule but going out your normal routing?  Your default gateway seems to be the ficus connection.

                  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
                  • K
                    kathampy
                    last edited by

                    @johnpoz:

                    yup that drawing makes it very clear.. That was not there before was it?

                    So that looks right from my quick look at it..  But your rules are very specific with source ports and source network for example.  So your showing specific states that match that rule but going out your normal routing?  Your default gateway seems to be the ficus connection.

                    Yes, I have traffic that matches Steam (UDP Destination Port 27000:27030 in this case) that goes out the default gateway. I can see these states under the Ficus interface in the Diagnostic > States viewer with matching destination ports. As soon as I disconnect the default gateway PPPoE, the traffic immediately starts flowing over the Airtel PPPoE connection within milliseconds. Now the States viewer shows the states under the Airtel interface and they stay there until the traffic stops and the states are closed.

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

                      really makes no sense since if it doesn't trigger the rule that sends it out specific gateway without the allow rule at the end it should just fail.

                      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

                        Yes, I have traffic that matches Steam (UDP Destination Port 27000:27030 in this case) that goes out the default gateway. I can see these states under the Ficus interface in the Diagnostic > States viewer with matching destination ports.

                        I would like to see outputs of pfctl -vvsr and pfctl -vvss when the firewall is in this mode.

                        That will show exactly which rule is passing the traffic in question. It would be especially helpful if you could clear all states, generate the traffic in question, then take these samples.

                        I realize it might be kind of large.

                        There's probably a simple explanation for what you're seeing. Just don't know what it is yet.

                        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
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.