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

    Playing with fq_codel in 2.4

    Traffic Shaping
    123
    1.1k
    1.4m
    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
      last edited by

      Which is why its not on ;)  When you turn on their queues you loose the hardware offload it seems.. So yeah speed takes a hit ;)

      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.7.2, 24.11

      1 Reply Last reply Reply Quote 0
      • B
        belt9
        last edited by

        And that is why I am thankful for pfSense!

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

          Oh believe me I will be back to pfsense as soon as get new hardware that can handle the speed.. The usg was a temp solution that was cheap enough to sneak through the budget committee (wife).. its was only a 100$ ;)

          It can handle the speed in hardware offload.. But its feature set is so lacking.. Still running my pfsense vm for dhcp and dns since those features on usg need a huge amount of work to be viable in anything other than the most basic of home user networks.. And really just forget about ipv6 and or openvpn without manipulate of json files and having to reload them any time you reprovision the usg from the controller.. And the firewall rules are just nuts to setup on it as well..  I counting the days til I have pfsense back that is for sure ;)

          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.7.2, 24.11

          1 Reply Last reply Reply Quote 0
          • S
            sideout
            last edited by

            I ran this on my router at my LAN party and it worked out great.  184 people with a 300mbit modem and 2 100mbit modems , made 2 download shapers and 1 upload shaper.

            i made the system patches as well so it would apply after updates.

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

              I should skip this since I don't know what I'm doing but still really curious to make it work. I have gigabit service and get D's and F's on buffer bloat.

              I'm sure its in the post and I have indeed read though but still don't understand. What are the steps to enable this? I have 2.4 installed.

              Looks like install patches package, run patch posted on page 8 which I was going to do until it said I could not remove this so I thought I better study a bit before I keep going. If you have the energy, please tell me what are the steps and I will follow them. Thanks.

              1 Reply Last reply Reply Quote 0
              • B
                belt9
                last edited by

                You don't have to install the patch.

                Just set up limiters (look at Johns screenshots a few pages above this) then run the ipfw commands for fq_codel and add them to shellcmd.

                Run a speed test and set your limiters to 95% of the speeds you get.

                Now go to your firewall rules to pass traffic and in the advanced section just select the queues you just made.

                That's it.

                1 Reply Last reply Reply Quote 0
                • w0wW
                  w0w
                  last edited by

                  @belt9:

                  You don't have to install the patch.

                  Just set up limiters (look at Johns screenshots a few pages above this) then run the ipfw commands for fq_codel and add them to shellcmd.

                  Run a speed test and set your limiters to 95% of the speeds you get.

                  Now go to your firewall rules to pass traffic and in the advanced section just select the queues you just made.

                  That's it.

                  I don't think it's that simple. If you don't override rules.limiter with own one like TS suggests by patching php code, then any firewall config or even WAN IP change that wants and would reload this file will destroy your manually configured fq_codel, until you manually run ipfw commands again or restart firewall to let shellcmd to do it. Am I wrong?

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

                    No sorry it is that simple.. You do not need to make any files changes at all..  Just create the limiters and then put in the commands via shellcmd to put them in every time you reboot, etc.

                    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.7.2, 24.11

                    1 Reply Last reply Reply Quote 0
                    • B
                      belt9
                      last edited by

                      Yeah, I just tried adding and deleting firewall rules then checking ipfw and it still has my fq_codel flows.

                      If there's some other action you're worried might remove fq_codel then just try doing that action then check ipfw after to see if fq_codel is still in place.

                      ipfw sched show
                      
                      1 Reply Last reply Reply Quote 0
                      • w0wW
                        w0w
                        last edited by

                        OK so may be quick start quide?

                        1. RTFM for FQ_CODEL http://caia.swin.edu.au/freebsd/aqm/patches/README-0.2.1.txt
                        2. Config limiters (pipes) via GUI.
                        3. View /tmp/rules.limiter

                        for example it will be

                        
                        pipe 1 config  bw 280576Kb
                        queue 1 config pipe 1 mask src-ip6 /128 src-ip 0xffffffff
                        
                        pipe 2 config  bw 280576Kb
                        queue 2 config pipe 2 mask dst-ip6 /128 dst-ip 0xffffffff
                        
                        

                        4. USE shellcmd package to recreate pipes with commands like

                        
                        ipfw pipe flush
                        
                        ipfw pipe 1 config  bw 280576Kb
                        ipfw sched 1 config pipe 1 type fq_codel target 7ms quantum 2000 flows 2048
                        ipfw queue 1 config pipe 1 mask src-ip6 /128 src-ip 0xffffffff
                        
                        ipfw pipe 2 config  bw 280576Kb
                        ipfw sched 2 config pipe 2 type fq_codel target 7ms quantum 2000 flows 2048
                        ipfw queue 2 config pipe 2 mask dst-ip6 /128 dst-ip 0xffffffff
                        
                        

                        5. Add your limiters to firewall rules (IN/OUT pipes), this step can be any after step 2 actually.

                        Is it correct?
                        Maybe it's better to run script at startup? Just placing it into /usr/local/etc/rc.d? I found that using shellcmd is a little bit uncomfortable with multiple command lines at once, have I missed something?

                        1 Reply Last reply Reply Quote 0
                        • J
                          JTravers
                          last edited by

                          Excuse my ignorance on this. I've just learned about and started using pfSense a couple weeks ago.

                          I have my limiters attached to my "Default allow LAN to any rule" in order to evenly split bandwidth to my LAN clients. And then fq_codel applied to those limiters. Seems to be working great for reducing bufferbloat, ensuring low latency for all clients, etc. Thanks for all the guidance in this thread!

                          Is there any benefit or harm to doing it that way vs. attaching the limiters to a floating rule as @johnpoz did?

                          Also, how does all this apply to OpenVPN clients (with pfSense as the server)? Would either setup also work with the OpenVPN clients, or is one setup better than the other?

                          Thanks for all your help!

                          1 Reply Last reply Reply Quote 0
                          • B
                            belt9
                            last edited by

                            Floating rules vs interface rules won't make a difference. It will also work well on VPN clients. VPN traffic will always have higher latency relative to the same traffic not routed through a VPN. fq_codel can't fix that, but it will still work with fairly queuing the traffic and reducing bufferbloat.

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

                              I came back here to say thanks because it works well. I completed my setup differently than some of what has just been posted.

                              I setup limiters just as seen in the screenshots. (post 121)(upload, download, wan, lan)
                              I ran the single command for IPFW pipes. (ipfw sched 1 config pipe 1 type fq_codel && ipfw sched 2 config pipe 2)
                              I installed shellcmd and added the single IPFW statement.
                              Modified the two stock LAN firewall rules (IPV4 and IPV6 advanced configuration) so that wan and lan would be used just as seen in the screenshots.
                              I restarted the firewall.

                              That is all I have done. Prior my buffer bloat was a D to F. Post I get an A each time. I may/may not be setup correctly but whatever it is works. I originally used the wizard for setup of traffic shaping which used HFSC and which gave @425 upload on my gigabit connection. This new setup gives @750. So, good for me.

                              1 Reply Last reply Reply Quote 0
                              • w0wW
                                w0w
                                last edited by

                                Definitely I am blind what screenshots are you all talking about? :D

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

                                  @w0w:

                                  Definitely I am blind what screenshots are you all talking about? :D

                                  Reply 121 of this thread.

                                  1 Reply Last reply Reply Quote 0
                                  • w0wW
                                    w0w
                                    last edited by

                                    Thanks.  :)

                                    1 Reply Last reply Reply Quote 0
                                    • J
                                      JTravers
                                      last edited by

                                      @belt9:

                                      Floating rules vs interface rules won't make a difference. It will also work well on VPN clients. VPN traffic will always have higher latency relative to the same traffic not routed through a VPN. fq_codel can't fix that, but it will still work with fairly queuing the traffic and reducing bufferbloat.

                                      I tested floating rules vs. lan rules and they both give excellent results. Latency results in bufferbloat tests seemed to be just slightly lower with the lan rules, but that's just splitting hairs.

                                      I had very poor bufferbloat results when testing through my OpenVPN connection as a client connected to the OpenVPN server in pfSense. Is there any way to fix this? Should I be creating limiters to apply to the OpenVPN interface rules in the firewall and then selecting fq_codel on those limiters, as well?

                                      1 Reply Last reply Reply Quote 0
                                      • B
                                        belt9
                                        last edited by

                                        Yes you would need to apply limiters to your openvpn interface in order to queue your clients traffic. However, you can only fix your end, if the client is connecting to you via a poor connection then you can't get any better than the worst link.

                                        1 Reply Last reply Reply Quote 0
                                        • J
                                          JTravers
                                          last edited by

                                          @belt9:

                                          Yes you would need to apply limiters to your openvpn interface in order to queue your clients traffic. However, you can only fix your end, if the client is connecting to you via a poor connection then you can't get any better than the worst link.

                                          Thanks, that makes sense.
                                          I’ll try it out and see how much it helps.

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

                                            Finally got around to trying this again, and everything worked great!  John's screenshots in reply 121 are spot on and there is no need to edit any files if one uses shellcmd.

                                            I actually recently changed to a 100/100 Fiber connection - here are results (using the DSL Reports speed test which has a nice Bufferbloat check):

                                            Before (no shaping):

                                            Using ALTQ FAIRQ + Codel Active Queue Management; 100Mbit Limit on Both WAN and LAN:

                                            Using fq_codel and 100Mbit Limit on Both Upload and Download:

                                            What's interesting to me here is that fq_codel appears to perform a bit better than the ALTQ emulation of fq_codel (using FAIRQ + Codel) - I find this very interesting.  Anyone have any thoughts as to why?

                                            I also ran a more intense FLENT test on another system with fq_codel enabled and the results looked great as well (stable ping and stable download/upload over the course of the test).

                                            Given the relatively little effort required to get this to work on pfSense, it's a fantastic way to improve the stability of a connection.

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