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

    Shape Traffic Marked with tcp_outgoing_tos Directive

    Scheduled Pinned Locked Moved Traffic Shaping
    20 Posts 3 Posters 3.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.
    • DerelictD
      Derelict LAYER 8 Netgate
      last edited by

      Sorry.  You have a separate squid node?

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

        @Derelict:

        Sorry.  You have a separate squid node?

        Sorry.  I see now.  Yes, but you need to make a floating rule on LAN out that matches the DSCP and sets the proper queue.

        Firewall rules on the interface tabs only match traffic coming into the subject interface.

        the rule should probably look something like this:

        Match on interface LAN direction out source any dest LAN net

        With advanced settings to match DSCP and set the proper queues.

        Sorry, but I don't mess with squid much.  I have no idea if the state in question is already established or not.  You have to match traffic and set queues at the point of state creation.  Some other squiddly diddly might know more.

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

          @Derelict:

          @Derelict:

          Sorry.  You have a separate squid node?

          You have to match traffic and set queues at the point of state creation.  Some other squiddly diddly might know more.

          Thanks! The squid is a package added to PfSense. But I guess that won't really matter in this case, will it?

          I'm pretty sure I tried it on the floating rule, but I will do it again with your suggestion.

          1 Reply Last reply Reply Quote 0
          • H
            Harvy66
            last edited by

            @dpa:

            @Derelict:

            PF version is 2.0.3

            What is that?  At least 8 updates behind?

            Yes, I am always thinking on upgrading.

            But I still have to read if newer versions has the solution of what I need, otherwise I'll keep the "if it ain't broke, don't fix it" saying.

            "Working" doesn't mean it isn't broken. Security fixes.

            1 Reply Last reply Reply Quote 0
            • D
              dpa
              last edited by

              @Harvy66:

              "Working" doesn't mean it isn't broken. Security fixes.

              Yes, I see there are many important fixes.

              Btw, I tried creating the floating rules. It still not shaping accordingly.

              Pass on quick interface Lan
              Destination - Out
              Proto - TCP/UDP
              Source - any
              Port - any
              Destination - Lan net
              Port - any
              Gateway - default

              Advanced
              Diffserv Code Points - 0x30
              In/Out - 128kb/512kb (just for testing)

              1 Reply Last reply Reply Quote 0
              • H
                Harvy66
                last edited by

                @dpa:

                @Harvy66:

                "Working" doesn't mean it isn't broken. Security fixes.

                Yes, I see there are many important fixes.

                Btw, I tried creating the floating rules. It still not shaping accordingly.

                Pass on quick interface Lan
                Destination - Out
                Proto - TCP/UDP
                Source - any
                Port - any
                Destination - Lan net
                Port - any
                Gateway - default

                Advanced
                Diffserv Code Points - 0x30
                In/Out - 128kb/512kb (just for testing)

                My guess is what Derelict's concern was.

                With my limited understanding, the states are created prior to Squid, which means Squid is setting the DiffServ flag after the states are already established on the LAN.

                You need to figure out a way to get the DiffServ flag set prior to the states getting set, which you should be able to do for the WAN traffic because the WAN states are not created until after Squid. The firewall is the first line of defense, you can't modify packets after the states have been created.

                You do have port information at the time the packets hit the LAN interface. Can you not use that?

                1 Reply Last reply Reply Quote 0
                • D
                  dpa
                  last edited by

                  @Harvy66:

                  My guess is what Derelict's concern was.

                  With my limited understanding, the states are created prior to Squid, which means Squid is setting the DiffServ flag after the states are already established on the LAN.

                  You need to figure out a way to get the DiffServ flag set prior to the states getting set, which you should be able to do for the WAN traffic because the WAN states are not created until after Squid. The firewall is the first line of defense, you can't modify packets after the states have been created.

                  You do have port information at the time the packets hit the LAN interface. Can you not use that?

                  Hi Harvy,

                  I did try using the squid port, but I still cannot get it done. Could you please give me some idea? Thanks!

                  1 Reply Last reply Reply Quote 0
                  • H
                    Harvy66
                    last edited by

                    If squid is running in transparent mode, then you can't filter on IP, but something like this.

                    TCP srcIP:Any srcPort:Any dstIP:Any dstPort:80      on your LAN port.

                    1 Reply Last reply Reply Quote 0
                    • D
                      dpa
                      last edited by

                      @Harvy66:

                      If squid is running in transparent mode, then you can't filter on IP, but something like this.

                      TCP srcIP:Any srcPort:Any dstIP:Any dstPort:80      on your LAN port.

                      Thanks. Still testing this setting.

                      1 Reply Last reply Reply Quote 0
                      • D
                        dpa
                        last edited by

                        @Harvy66:

                        If squid is running in transparent mode, then you can't filter on IP, but something like this.

                        TCP srcIP:Any srcPort:Any dstIP:Any dstPort:80      on your LAN port.

                        Putting this rule on LAN interface will affect any HTTP traffic, cached or not. How I wish specifying Diffserv Code Points together with this rule will work, but it won't. Using tcpdump I can see traffic flowing with the tos mark. Why is it the rule cannot "read" this mark and apply the necessary rule?

                        1 Reply Last reply Reply Quote 0
                        • H
                          Harvy66
                          last edited by

                          My understanding is that if you want Diffserv to be honored, it must be set before reaching the firewall. Traffic shaping is set at the time the connection is made. Because you have Squid running inside the firewall, the diffsrv is being set after reaching the firewall.

                          1 Reply Last reply Reply Quote 0
                          • D
                            dpa
                            last edited by

                            @Harvy66:

                            My understanding is that if you want Diffserv to be honored, it must be set before reaching the firewall. Traffic shaping is set at the time the connection is made. Because you have Squid running inside the firewall, the diffsrv is being set after reaching the firewall.

                            Ok thanks.

                            So there is no way a rule on LAN can tell which traffic passing thru is from cache.

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