1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

[Release] FreshJR Adaptive QOS (Improvements / Custom Rules / and Inner workings)

Discussion in 'Asuswrt-Merlin' started by FreshJR, Jan 12, 2017.

  1. FreshJR

    FreshJR Very Senior Member

    Joined:
    Oct 8, 2016
    Messages:
    799
    Yes they should be.
    The compatible version is listed as v3 in the filename now (the quoted post had v1 in the file name). That's the only minor change.

    The error message after his uninstall/reinstall procedure has been fixed.

    Report back if any errors occur during the installation procedure.

    192.168.2.8/31 includes 192.168.2.8 - 192.168.2.9.
    You can check it with the CIDR calculator.
    This was covered within the first posts.

    Yes the install instructions should be fine.
     
    Last edited: Jun 1, 2018
    Andy1932 likes this.
  2. Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!
  3. fearz

    fearz Regular Contributor

    Joined:
    Jun 20, 2012
    Messages:
    146
    I got it , i ued the calculator and found out that only by adding one line 192.168.2.8/31 will add both 192.168.2.8 and 192.168.2.9
     
  4. fearz

    fearz Regular Contributor

    Joined:
    Jun 20, 2012
    Messages:
    146
    Thank you so much once again @FreshJR for your efforts and help.
     
  5. fearz

    fearz Regular Contributor

    Joined:
    Jun 20, 2012
    Messages:
    146
    All working fine now, but say i want all downloads.com go to File Transfer instead of Web Surfing, how to do that?
     
  6. FreshJR

    FreshJR Very Senior Member

    Joined:
    Oct 8, 2016
    Messages:
    799
    Custom rule encompassing the entire downloads.com server range.

    The range is not continuous, so I would expand the range and get some overlap instead of adding 11 individual rules.

    With this approach you still have to hope your ISP doesn’t use an encrypted caching server for download content since the custom filtered iprange would not match if you would be getting downloads from a local CDN cache server
     
    Last edited: Jun 1, 2018
  7. fearz

    fearz Regular Contributor

    Joined:
    Jun 20, 2012
    Messages:
    146

    I understand half of what you said, but can you give me a sample / rule to do that in the file?
     
  8. FreshJR

    FreshJR Very Senior Member

    Joined:
    Oct 8, 2016
    Messages:
    799
    There is already a sample rule template that filters WAN server ip addresses via CIDR notation.

    Filtering by simply adding a downloads.com keyword into the script is not possible if that is what you are asking.

    This keyword method should technically be possible to implement via the framework we have at our disposal but it is not a priority for me nor something I am considering spending any time looking into since I am happy with the present state of performance.
     
    Last edited: Jun 1, 2018
  9. fearz

    fearz Regular Contributor

    Joined:
    Jun 20, 2012
    Messages:
    146
    So I should look into finding the IP of downloads.com and use that CIDR notation to add it? can you give me one example please?
     
  10. FreshJR

    FreshJR Very Senior Member

    Joined:
    Oct 8, 2016
    Messages:
    799
    The link I gave you listed ALL registered IP addresses of downloads.com via CIDR notation. (They have a few thousand addresses consolidated into 11 CIDR ranges)

    What I have been further saying is that even with 11 rules encompassing all 11 ranges owned by downloads.com, your actual download traffic might be coming from mirror hosted by your local ISP AND NOT “downloads.com” servers.

    Your local ISP mirror, called a CDN, wouldnt be included in those 11 filtering ranges. CDNs are used by ISPs to decrease the amount of traffic flowing from outside their networks to decrease network interconnect bottlenecks.

    It’s up to you to learn the remainder. When I found deficiencies with QOS for my personal setup, I learned all supporting information via Google & YouTube and figured out how it works and how to make it work. I have no networking certification so it is possible without being spoonfed.
     
    Last edited: May 31, 2018
    FadgewackeR likes this.
  11. fearz

    fearz Regular Contributor

    Joined:
    Jun 20, 2012
    Messages:
    146
    Thanks, but which link?
     
  12. joe scian

    joe scian Regular Contributor

    Joined:
    Apr 22, 2018
    Messages:
    50
    This reminds me of support at my previous employment when there was always 1 customer who was a total pita. 99% of support resources went into supporting this 1 customer.
     
    Last edited: Jun 1, 2018
    FadgewackeR and gffmac like this.
  13. Andy1932

    Andy1932 Regular Contributor

    Joined:
    Mar 10, 2016
    Messages:
    68
    Seems to have worked. Thank you!
    Code:
    Jun  1 07:12:00 adaptive QOS: Delayed Start Triggered (5min)
    Jun  1 07:17:01 adaptive QOS: Applying - Down Rules
    Jun  1 07:17:01 adaptive QOS: Applying --- Up Rules
    Jun  1 07:17:01 adaptive QOS: Modifying Class Rates
    Jun  1 07:17:01 kernel: HTB: quantum of class 10015 is big. Consider r2q change.
    
     
    Vexira and FreshJR like this.
  14. maxsteel

    maxsteel Regular Contributor

    Joined:
    Dec 27, 2014
    Messages:
    58
    Any idea what "PS4 Remote Play" is categorized at in the script?
     
  15. FreshJR

    FreshJR Very Senior Member

    Joined:
    Oct 8, 2016
    Messages:
    799
    Start a session and look for large amounts of uploads traffic via app analysis or QOS statistics.

    If you find it in an undesired category then at least it uses a unique set of ports which you can easily prepare a rule for.

    Remote play
    UDP 9296, UDP 9297, UDP 9303

    Note: this only applies to an remote play session over the internet.

    A remote play session between two local (LAN) devices is not affected since QOS is only for internet traffic.
     
    Last edited: Jun 1, 2018
    FadgewackeR likes this.
  16. maxsteel

    maxsteel Regular Contributor

    Joined:
    Dec 27, 2014
    Messages:
    58
    Thank you it is LAN based
     
  17. Pit_g

    Pit_g Occasional Visitor

    Joined:
    Mar 11, 2018
    Messages:
    23
    [​IMG]


    Thank you so much for your help @FreshJR

    Now all traffic works amazing..........
     
  18. FreshJR

    FreshJR Very Senior Member

    Joined:
    Oct 8, 2016
    Messages:
    799
    Script for users with non typical internet connections

    This post is a release intended for users with non typical internet connections.

    A majority of QOS users have "eth0" as their interface. The "eth0" interface works with the original scripts as intended.
    It has been found that for non "eth0" interfaces, SOME custom rules in the QOS script are not working as intended.

    PoPPE connection may have "ppp0" as their interface.
    Fiber connections may have "vlanXXX" as their interface.

    These different interfaces leave some script custom rules partially broken.
    For users, with non typical interfaces, feel free to TRY using this alternate script.

    --

    A quick way to check your WAN interface is to launch QOS and then look at system log.
    Keep an eye out for this line. **Only appears on RMerlin firmware.

    Code:
    custom_script: Running /jffs/scripts/firewall-start (args: eth0)
    
    As you can see, on my computer I am using eth0

    Stock users need to manually consult iptables to find their WAN interface as the above line will not be present in your system log.

    Stock users could potentiality try this command after QOS is up and running running and see if it will correctly identify and return your interface name:

    Code:
    iptables -vL -t mangle | grep "BWDPI_FILTER  " |  awk '{print $6}'
    
    If the interface is found NOT to be eth0, then this alternate version is recommended instead of the compatible version in the first post.

    To use the alternate version with stock firmware, the WAN interface, found from the previous step, will need to be manually defined within the script via a commented out variable located towards the top the script, immediately after the start of the "iptable_up_rules" section.

    ** To be clear, this section does not apply to RMerlin Users as WAN interface identification will happen automatically for RMerlin users. **

    Script for users with non typical internet connections
    (users with non "eth0" interfaces)

    Changes:
    --Implemented custom rules a different way since some TC rules have been found not functioning as intended for non "eth0" interfaces
    --Added ability to pass a multi-word query to appdb function instead of being limited to a single word
    --Changed wording in template comments hopefully reducing questions as to why custom port rules are not working

    Note: This release uses a different firewall-start entry.

    You will have to fully uninstall any previous version of the script, and then fresh install this one.


    ** IF IT HASN'T BEEN CLEAR, ONCE AGAIN THIS IS INTENDED FOR USERS WITH NON eth0 INTERFACES **
     

    Attached Files:

    Last edited: Jul 13, 2018
    Quoc Huynh, Pit_g and Kingp1n like this.
  19. Jack Yaz

    Jack Yaz Very Senior Member

    Joined:
    Apr 20, 2017
    Messages:
    1,118
    Is this just for the iptables or the tc bits too? FYI DSL is not "non-typical" for an Internet connection :)

    You need to check based on:
    Code:
    nvram get wan0_proto
     
    Last edited: Jun 2, 2018
  20. FreshJR

    FreshJR Very Senior Member

    Joined:
    Oct 8, 2016
    Messages:
    799
    I know dsl is primarily pppo. ;)
    I was just trying to use easier keywords rather than non eth0 interfaces.

    Custom TC rules that are ONLY dealing with marks will work regardless of any interface.
    Anything that deals with IP’s or port’s for non eth0 connections **might** need to be implemented via iptables.

    As uploaded, all the default rules in the alternate version should work.

    Id rather not have two sets of rules in one script that users will both have to setup.

    I’ll just leave it as two separate scripts without the check.

    Since your wireless script works in this area, do you know if wan0_ifname the correct value to query?

    Keep in mind the script not working on non eth0 are generalizations based on bug reports.
    I am not in a position to test this first hand.
     
    Last edited: Jun 2, 2018
  21. Jack Yaz

    Jack Yaz Very Senior Member

    Joined:
    Apr 20, 2017
    Messages:
    1,118
    Output of wan0_ifname on my DSL reports eth0 still.

    TC on down with ports seems to be OK, but thats perhaps because I'm working on sport rather than dport?

    Code:
    ${tc} filter add dev br0 protocol all prio $1 u32 match ip sport 563 0xffff flowid ${Downloads}
    I think I spotted that TC on upload didnt work so I resorted to iptables. I was lazy and didn't specify an out interface, figured setting a mark wouldn't hurt if it wasn't WAN destined (correct me if that's wrong!)

    Code:
    iptables -t mangle $ACTION POSTROUTING -p tcp --dport 563 -j MARK --set-mark ${Downloads_mark} 2>/dev/null
     
Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!