Jump to content
kinel

Traffic prortization please read

Recommended Posts

11 minutes ago, Dopam-IT_1987 said:

bien evidemment knomax ;) je n'ai pas dit que j'ai créer mais qu'on a adapté pour ma connexion grace a l'aide de david, moeller, et daniel, et vous meme il faudrait pouvoir adapté pour chaque type de connexion,  c'est a dire vous en adsl , moi en vdsl2 et pour ceux qui ont de tres grandes connexion comme la fibre optique ;):) 

No i mean that juju1366 copy the script we adjust It for his connection... Then he upload a video like "script for gaming openwrt".. And then someone thinks that Will work for his connection. 

Latest script.. You Just set upload speed, download speed, ip of console ... Set game up speed and game download speed aloacated... Then you run script and auto recognizes what type of connection you have.. What ever It is... Adsl, docsis, fiber.. Then based of your set up creates classes for console and other devices.. Different thing than Just upload a video. 

Share this post


Link to post
Share on other sites

oui il faut expiquer aussi aux personnes qu'il faut telecharger des packages comme au debut du post je n'avais ni pfifo ni pie etc pour resumer 

 

et corrigez si je me trompes, pour que cela soit clair pour les personnes qui voudrait essayer 

 

then install via putty opkg update

opkg install tc

opkg install kmod-sched

you can tap then the command

ls -lha /lib/modules/$(uname -r)/ | grep sch

for see the qdisc pfifo

then go to the luci page and sofware tap sqm and download just the top sqm scripts

or opkg install sqm-scripts

then go to putty and tape chmod +x qosgaming.sh

after tap just ls you can see qosgaming.sh in green

to appair after that reboot

go to system startup and below exit 0 enter echo "y" | /root/qosgaming.sh

ok now tap always in putty sh qosgaming.sh

 

if not error tape y you can see finally the firewall with classify 3 from your adress ps4 like my script 2.167 (my ps4) and test dsl reports for verify your connection to upload bandwith is correct then tap tc -s qdisc and verify pfifo sent packet kbps if sent your ps4 classify work , test in game for see

Share this post


Link to post
Share on other sites

I am not responsible if you decide to do what juju suggest. 

"Original " post and latest update are in Openwrt forum. 

Complete script Will be available if nothing goes wrong in Sqm. 

For now everyone cound have access in the code.. And has at least knowledge.. How to create script in his pc.. How to transfer It to openwrt... How to make It executable.. How to trouble shoot basic things. 

Share this post


Link to post
Share on other sites
27 minutes ago, Dopam-IT_1987 said:

then go to the luci page and sofware tap sqm and download just the top sqm scripts

or opkg install sqm-scripts

Etc.. You dont need this at all... Qos is implement by custom qos script and not by sqm.!! 

Share this post


Link to post
Share on other sites
1 hour ago, Knomax said:

Etc.. You dont need this at all... Qos is implement by custom qos script and not by sqm.!! 

I am after installing OpenWRT on my Edgerouter X. Could you write step by step what to do to apply this script? Anything else to change after a fresh system update?

Share this post


Link to post
Share on other sites
1 hour ago, Sherman85 said:

I am after installing OpenWRT on my Edgerouter X. Could you write step by step what to do to apply this script? Anything else to change after a fresh system update?

I write from my Phone... It is difficult. I Will send you from my pc. 

Share this post


Link to post
Share on other sites

 

1 hour ago, Knomax said:

I write from my Phone... It is difficult. I Will send you from my pc. 

Hello,

I'm also interesed in understanding how I should be executed the script. I have just installed openwrt in edgerouterX.

Thanks a lot

Share this post


Link to post
Share on other sites
On 11/20/2020 at 7:54 AM, johnnytran said:

After changing lan to eth0.1 it still doesn't seem to work for me, when I check the system log I'm seeing this

Fri Nov 20 06:42:19 2020 daemon.notice procd: /etc/rc.d/S95done: /etc/rc.local: line 5: /root/qos.sh: not found
Fri Nov 20 06:42:27 2020 daemon.notice procd: /etc/rc.d/S95done: /etc/rc.local: line 7: /root/gaming.sh: not found

But I have transferred the files over to /root/ and made them executable as u can see in the screenshot they are green.

I have Fibre to the premises, here's the option i'm using in qos.sh but to me it seems I need to do something else to get this working because it's not finding the files

## for ethernet / DOCSIS / VDSL etc use this
tc qdisc replace dev $DEV stab overhead $OH linklayer ethernet handle 1: root hfsc default 3
# for old school DSL with ATM use this:
#tc qdisc replace dev "$DEV" handle 1: root stab mtu 2047 tsize 512 mpu 68 overhead ${OH} linklayer atm hfsc default 3

I have followed al your other steps, local startup matches exactly. SQM is off. Any ideas?

sqdisc.JPG

qos.sh 1.45 kB · 6 downloads gaming.sh 354 B · 5 downloads

How did you fix it? I have the same problem, I don't have pfifo.

Share this post


Link to post
Share on other sites

do you have try to opkg install kmod-sched

 

and for the lan supp # at the last line ? 

 

try this command for add pfifo at qdsic :)

 
tc qdisc add dev eth0.2 root pfifo limit 3

Share this post


Link to post
Share on other sites
9 hours ago, Sherman85 said:

How did you fix it? I have the same problem, I don't have pfifo.

I don't have pfifo when I check the list of schedulers but made an adjustment to the script which seems to be working (thanks to Dopam-IT for the idea). Maybe Knomax can look over it if it's ok, I left the last line uncommented because that worked in the previous script I had running without pfifo. Do I have to # this or is it ok to leave uncommented? not sure what it does.

I haven't tried gaming with this yet, but with the other one it was good for a couple days but then I started experiencing very bad shoot first die first moments so stopped playing. In my case I don't know if it was the script that helped or that the cod patch had fixed my connection (I tried the script right after the patch downloaded).

Curious to know how the script can be changed to work better with direct fibre to the premises connections. Do I need to contact the guys on the openwrt forums to assist or are they working on something already?

[email protected]:~# tc -d qdisc
qdisc noqueue 0: dev lo root refcnt 2
qdisc pfifo 8006: dev eth0 root refcnt 2 limit 1000p
qdisc noqueue 0: dev br-lan root refcnt 2
qdisc hfsc 1: dev eth0.1 root refcnt 2 default 3 linklayer ethernet overhead 44
qdisc pfifo 8009: dev eth0.1 parent 1:2 limit 10p
qdisc pie 800a: dev eth0.1 parent 1:3 limit 100p target 80.0ms tupdate 40.0ms alpha 2 beta 20 ecn bytemode
qdisc noqueue 0: dev eth0.3 root refcnt 2
qdisc hfsc 1: dev eth0.2 root refcnt 2 default 3 linklayer ethernet overhead 44
qdisc pfifo 8007: dev eth0.2 parent 1:2 limit 10p
qdisc pie 8008: dev eth0.2 parent 1:3 limit 100p target 80.0ms tupdate 40.0ms alpha 2 beta 20 ecn bytemode
 

Script

Quote

#!/bin/sh
WAN=eth0.2 # change this to your WAN device name
UPRATE=17000 #change this to your 80% kbps upload speed (in kbps)
LAN=eth0.1 # change this to your LAN device name
DOWNRATE=104000 #change this to about 80% of your download speed (in kbps)
GAMEUP=500  # throttle your speeds for upload in PS4/Xbox
GAMEDOWN=2000  # throttle your speeds for download in PS4/Xbox

setqdisc () {
DEV=$1
RATE=$2
OH=44
highrate=$((RATE*90/100))
lowrate=$((RATE*10/100))
gamerate=$3

tc qdisc replace dev eth0 root pfifo
tc qdisc delete dev $WAN
tc qdisc delete dev $LAN

## for ethernet / DOCSIS / VDSL etc use this
tc qdisc replace dev $DEV stab overhead $OH linklayer ethernet handle 1: root hfsc default 3
# for old school DSL with ATM use this:
#tc qdisc replace dev "$DEV" handle 1: root stab mtu 2047 tsize 512 mpu 68 overhead ${OH} linklayer atm hfsc default 3


tc class add dev "$DEV" parent 1: classid 1:1 hfsc ls m2 "${RATE}kbit" ul m2 "${RATE}kbit"

# high prio class
tc class add dev "$DEV" parent 1:1 classid 1:2 hfsc rt m1 "${highrate}kbit" d 40ms m2 "${gamerate}kbit"

tc class add dev "$DEV" parent 1:1 classid 1:3 hfsc ls m1 "${lowrate}kbit" d 40ms m2 "${highrate}kbit"

tc qdisc add dev "$DEV" parent 1:2 pfifo limit 10
tc qdisc add dev "$DEV" parent 1:3 pie limit 100 target 80ms ecn tupdate 40ms bytemode

}

setqdisc $WAN $UPRATE $GAMEUP

## uncomment this to do the download direction via output of LAN
setqdisc $LAN $DOWNRATE $GAMEDOWN

old script i had used without pfifo had

#tc qdisc replace dev eth0 pfifo

this line

tc qdisc add dev "$DEV" parent 1:2 pfifo limit 10

was replaced by 

tc qdisc add dev "$DEV" parent 1:2 pie limit 100 target 80ms ecn tupdate 40ms bytemode

 

*edit*

Still having shoot first die first games, killcam showing they're hitting me first but on my end I haven't taken damage when I start hitting them first. Script is probably doing what it's supposed to but you can't do anything about shit servers and the lag comp

 

*edit2*

testing out the new script seems to be working better

Share this post


Link to post
Share on other sites
8 hours ago, johnnytran said:

I don't have pfifo when I check the list of schedulers but made an adjustment to the script which seems to be working (thanks to Dopam-IT for the idea). Maybe Knomax can look over it if it's ok, I left the last line uncommented because that worked in the previous script I had running without pfifo. Do I have to # this or is it ok to leave uncommented? not sure what it does.

I haven't tried gaming with this yet, but with the other one it was good for a couple days but then I started experiencing very bad shoot first die first moments so stopped playing. In my case I don't know if it was the script that helped or that the cod patch had fixed my connection (I tried the script right after the patch downloaded).

Curious to know how the script can be changed to work better with direct fibre to the premises connections. Do I need to contact the guys on the openwrt forums to assist or are they working on something already?

[email protected]:~# tc -d qdisc
qdisc noqueue 0: dev lo root refcnt 2
qdisc pfifo 8006: dev eth0 root refcnt 2 limit 1000p
qdisc noqueue 0: dev br-lan root refcnt 2
qdisc hfsc 1: dev eth0.1 root refcnt 2 default 3 linklayer ethernet overhead 44
qdisc pfifo 8009: dev eth0.1 parent 1:2 limit 10p
qdisc pie 800a: dev eth0.1 parent 1:3 limit 100p target 80.0ms tupdate 40.0ms alpha 2 beta 20 ecn bytemode
qdisc noqueue 0: dev eth0.3 root refcnt 2
qdisc hfsc 1: dev eth0.2 root refcnt 2 default 3 linklayer ethernet overhead 44
qdisc pfifo 8007: dev eth0.2 parent 1:2 limit 10p
qdisc pie 8008: dev eth0.2 parent 1:3 limit 100p target 80.0ms tupdate 40.0ms alpha 2 beta 20 ecn bytemode
 

Script

old script i had used without pfifo had

#tc qdisc replace dev eth0 pfifo

this line

tc qdisc add dev "$DEV" parent 1:2 pfifo limit 10

was replaced by 

tc qdisc add dev "$DEV" parent 1:2 pie limit 100 target 80ms ecn tupdate 40ms bytemode

 

*edit*

Still having shoot first die first games, killcam showing they're hitting me first but on my end I haven't taken damage when I start hitting them first. Script is probably doing what it's supposed to but you can't do anything about shit servers and the lag comp

 

*edit2*

testing out the new script seems to be working better

Can you share your entire scrypt with me? preferably a script file

Share this post


Link to post
Share on other sites
50 minutes ago, Sherman85 said:

Can you share your entire scrypt with me? preferably a script file

Attached is the one I was using. If you're going to use you'll have to edit it to match your own interfaces. If you're on windows use notepad++

The one I'm using now is the one mentioned a few posts back with the youtube video

qos_old.sh

Share this post


Link to post
Share on other sites
29 minutes ago, johnnytran said:

Attached is the one I was using. If you're going to use you'll have to edit it to match your own interfaces. If you're on windows use notepad++

The one I'm using now is the one mentioned a few posts back with the youtube video

qos_old.sh 1.44 kB · 0 downloads

What can I change if I don't have Pfifo?

 

#!/bin/sh

## "atm" for old-school DSL or change to "DOCSIS" for cable modem, or "other" for everything else

LINKTYPE="DOCSIS"

WAN=eth0.2 # change this to your WAN device name
UPRATE=16384 #change this to your kbps upload speed
LAN=eth0.1
DOWNRATE=245760 #change this to about 80% of your download speed (in kbps)

## how many kbps of UDP upload and download do you need for your games
## across all gaming machines? 

GAMEUP=450
GAMEDOWN=1200

## set this to "pfifo" or if you want to differentiate between game
## packets into 3 different classes you can use either "drr" or "qfq"
## be aware not all machines will have drr or qfq available

gameqdisc="pfifo"

GAMINGIP="192.168.2.139" ## change this

cat <<EOF

This script prioritizes the UDP packets from / to a set of gaming
machines into a real-time HFSC queue with guaranteed total bandwidth 

Based on your settings:

Game upload guarantee = $GAMEUP kbps
Game download guarantee = $GAMEDOWN kbps

Download direction only works if you install this on a *wired* router
and there is a separate AP wired into your network, because otherwise
there are multiple parallel queues for traffic to leave your router
heading to the LAN.

Based on your link total bandwidth, the **minimum** amount of jitter
you should expect in your network is about:

UP = $(((1500*8)*3/UPRATE)) ms

DOWN = $(((1500*8)*3/DOWNRATE)) ms

In order to get lower minimum jitter you must upgrade the speed of
your link, no queuing system can help.

Please note for your display rate that:

at 30Hz, one on screen frame lasts:   33.3 ms
at 60Hz, one on screen frame lasts:   16.6 ms
at 144Hz, one on screen frame lasts:   6.9 ms

This means the typical gamer is sensitive to as little as on the order
of 5ms of jitter. To get 5ms minimum jitter you should have bandwidth
in each direction of at least:

$((1500*8*3/5)) kbps

The queue system can ONLY control bandwidth and jitter in the link
between your router and the VERY FIRST device in the ISP
network. Typically you will have 5 to 10 devices between your router
and your gaming server, any of those can have variable delay and ruin
your gaming, and there is NOTHING that your router can do about it.

EOF


setqdisc () {
DEV=$1
RATE=$2
OH=26
MTU=1500
highrate=$((RATE*90/100))
lowrate=$((RATE*10/100))
gamerate=$3
useqdisc=$4


tc qdisc del dev "$DEV" root

case $LINKTOP in
    "atm")
    tc qdisc replace dev "$DEV" handle 1: root stab mtu 2047 tsize 512 mpu 68 overhead ${OH} linklayer atm hfsc default 3
    ;;
    "DOCSIS")
    tc qdisc replace dev $DEV stab overhead 25 linklayer ethernet handle 1: root hfsc default 3
    ;;
    *)
    tc qdisc replace dev $DEV stab overhead 40 linklayer ethernet handle 1: root hfsc default 3
    ;;
esac
     

#limit the link overall:
tc class add dev "$DEV" parent 1: classid 1:1 hfsc ls m2 "${RATE}kbit" ul m2 "${RATE}kbit"

# high prio class
tc class add dev "$DEV" parent 1:1 classid 1:2 hfsc rt m1 "${highrate}kbit" d 80ms m2 "${gamerate}kbit"

# other prio class
tc class add dev "$DEV" parent 1:1 classid 1:3 hfsc ls m1 "${lowrate}kbit" d 80ms m2 "${highrate}kbit"


## set this to "drr" or "qfq" to differentiate between different game
## packets, or use "pfifo" to treat all game packets equally

REDMIN=$((gamerate*30/8)) #30 ms of data
REDMAX=$((gamerate*200/8)) #200ms of data

case $useqdisc in
    "drr")
    tc qdisc add dev "$DEV" parent 1:2 handle 2:0 drr
    tc class add dev "$DEV" parent 2:0 classid 2:1 drr quantum 8000
    tc qdisc add dev "$DEV" parent 2:1 handle 10: red limit 150000 min $REDMIN max $REDMAX probability 1.0
    tc class add dev "$DEV" parent 2:0 classid 2:2 drr quantum 4000
    tc qdisc add dev "$DEV" parent 2:2 handle 20: red limit 150000 min $REDMIN max $REDMAX probability 1.0
    tc class add dev "$DEV" parent 2:0 classid 2:3 drr quantum 1000
    tc qdisc add dev "$DEV" parent 2:3 handle 30: red limit 150000 min $REDMIN max $REDMAX probability 1.0
    ## with this send high priority game packets to 10:, medium to 20:, normal to 30:
    ## games will not starve but be given relative importance based on the quantum parameter
    ;;

    "qfq")
    tc qdisc add dev "$DEV" parent 1:2 handle 2:0 qfq
    tc class add dev "$DEV" parent 2:0 classid 2:1 qfq weight 8000
    tc qdisc add dev "$DEV" parent 2:1 handle 10: red limit 150000 min $REDMIN max $REDMAX probability 1.0
    tc class add dev "$DEV" parent 2:0 classid 2:2 qfq weight 4000
    tc qdisc add dev "$DEV" parent 2:2 handle 20: red limit 150000 min $REDMIN max $REDMAX probability 1.0
    tc class add dev "$DEV" parent 2:0 classid 2:3 qfq weight 1000
    tc qdisc add dev "$DEV" parent 2:3 handle 30: red limit 150000 min $REDMIN max $REDMAX probability 1.0
    ## with this send high priority game packets to 10:, medium to 20:, normal to 30:
    ## games will not starve but be given relative importance based on the weight parameter

    ;;

    *)
    PFIFOLEN=$((1 + 40*RATE/(MTU*8))) # at least 1 packet, plus 40ms worth of additional packets
    tc qdisc add dev "$DEV" parent 1:2 handle 10: pfifo limit $PFIFOLEN
    ## send game packets to 10:, they're all treated the same
    
    ;;
esac

if [ $((MTU * 8 * 10 / RATE > 50)) -eq 1 ]; then ## if one MTU packet takes more than 5ms
    echo "adding PIE qdisc for non-game traffic due to slow link"
    tc qdisc add dev "$DEV" parent 1:3 handle 3: pie limit  $((RATE * 200 / (MTU * 8))) target 80ms ecn tupdate 40ms bytemode
else ## we can have queues with multiple packets without major delays, fair queuing is more meaningful
    echo "adding fq_codel qdisc for non-game traffic due to fast link"
    tc qdisc add dev "$DEV" parent 1:3 handle 3: fq_codel limit $((RATE * 200 / (MTU * 8))) quantum $((MTU * 2))
fi

}


setqdisc $WAN $UPRATE $GAMEUP $gameqdisc

## uncomment this to do the download direction via output of LAN
setqdisc $LAN $DOWNRATE $GAMEDOWN $gameqdisc

## we want to classify packets, so use these rules

cat <<EOF

We are going to add classification rules via iptables to the
POSTROUTING chain. You should actually read and ensure that these
rules make sense in your firewall before running this script. 

Continue? (type y or n and then RETURN/ENTER)
EOF

read -r cont

if [ "$cont" = "y" ]; then

    iptables -t mangle -F POSTROUTING
    iptables -t mangle -A POSTROUTING -j CLASSIFY --set-class 1:3 # default everything to 1:3,  the "non-game" qdisc
    if [ "$gameqdisc" = "pfifo" ]; then
    iptables -t mangle -A POSTROUTING -p udp -s ${GAMINGIP} -j CLASSIFY --set-class 1:2
    iptables -t mangle -A POSTROUTING -p udp -d ${GAMINGIP} -j CLASSIFY --set-class 1:2
    else
    echo "YOU MUST PLACE CLASSIFIERS FOR YOUR GAME TRAFFIC HERE"
    echo "SEND TRAFFIC TO 2:1 (high) or 2:2 (medium) or 3:3 (normal)"
    fi
else
    cat <<EOF
Check the rules and come back when you're ready.
EOF
fi

echo "DONE!"

tc -s qdisc

 

 

EDIT:

Is it corrected?

 

 

Zrzut ekranu (107).png

Share this post


Link to post
Share on other sites
22 minutes ago, Sherman85 said:

What can I change if I don't have Pfifo?

EDIT:

Is it corrected?

 

 

Zrzut ekranu (107).png

I think so, it looks like mine. Play some games and see if your pfifo packets go up

Share this post


Link to post
Share on other sites

I played one Cold War game and pfifo doesn't seem to work

 

Zrzut ekranu (108).png

 

EDIT:

I don't have Pfifo on this list. Do you know what package it is in? I have Egderouter X with the latest OpenWRT.

Zrzut ekranu (109).png

Share this post


Link to post
Share on other sites
26 minutes ago, Sherman85 said:

I played one Cold War game and pfifo doesn't seem to work

EDIT:

I don't have Pfifo on this list. Do you know what package it is in? I have Egderouter X with the latest OpenWRT.

 

Hmmm i don't know enough about this to give you an answer sorry. I'm also running the same and don't have pfifo on that list but it seems to be working for me

*edit*

Only thing I can think of is make sure your console is off when you run the script? Try switch it off, reboot router and run script. Check tc qdisc if it's all there then start your console/have a game? Also make sure you have the correct IP in the script

Share this post


Link to post
Share on other sites
35 minutes ago, johnnytran said:

Hmmm i don't know enough about this to give you an answer sorry. I'm also running the same and don't have pfifo on that list but it seems to be working for me

now it works, i had the wrong xbox IP address entered. I honestly don't see the difference when playing with this script, I still have a situation where enemies see me a second earlier.

Thank you for your help

Share this post


Link to post
Share on other sites
On 11/26/2020 at 9:04 AM, Knomax said:

Sorry but you dont prioritize anything. 

Cake and piece of cake is a "General" solution.. All devices in the same network have low bufferbloat. If you want prioritization you must use layer cake which uses 4 tins of traffic... And Mark priority packets as etc. CS4 to fall in first tin priority which uses 25% of bandwidth. 

I cant say more for now.. But in Openwrt forum i start a topic and by far now involved many gamers.. devs of Sqm.. We already "catch" the traffic Cold War uses in real time gaming.. Analyze It and find many usefull things.. Etc in ps4 packets has 60Hz rate..and probably server works at 30Hz to have 2 packets to work.. One packet is my bullet to you.. And the other your bullet to me.. And decide what to do.. Also cold war "loves" bandwidth throttling.. Also  cold war uses from your machine port 3074 to a random port 30000+... And from 30000+ to 3074 in your console...Already working to can install some other qdiscs like DRR and qfq via gui and dont want to compile your own firmware to enable these. Many users like me already uses the script in Openwrt and Cold War and i can tell for sure that It works very well.. Shoot first.. Die first. Stopped. 

In gunfights etc if i saw him first.. He dies for sure.. Hit reg increase dramatically... I die "normal".. Like bad aiming.. Wrong decisions... While reloading etc. 

This the first try in Openwrt to implement something specific for gamers. Which tested by gamers in "real" gaming situations. 

When i have more news i Will tell more. 

Why is this on netdumas forum

Share this post


Link to post
Share on other sites

I agree that this dont have place here but as @Locosano said qos is not good..or set up of algorithms is wrong...untill it is fixed i use qos of openwrt ...i dont tell to anyone to dont use Netduma and place it in the corner.....i use another qos and netduma for geofilter until it is fixed.

In the same logic they doesnt have place here conversations like....headsets....monitors and so on.!!!!

Share this post


Link to post
Share on other sites
On 11/28/2020 at 12:51 PM, stokoe1011 said:

Why is this on netdumas forum

Why not.. i dont talk trash about netduma..

I dont like the qos of netduma but i like the geo-filter..

I have used the openwrt SQM to control my connection and use geo filter from netduma

Share this post


Link to post
Share on other sites

Here is a lot of OpenWRT Stuff... And so may i see, mainly PS5 Users.

Question? Anyone have working traffic priorization for BOCW for PC?

It is not so, that i will not Test, i will test, but maybe someone have already found good settings for PC !?

Edit: UDP - Source Port (3074:3074) - Destination Port (30000:65535) & Disable IPv6 & Set GamingPC as "Playstation" DID THE TRICK :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...