Jump to content

Knomax

Members
  • Content Count

    252
  • Joined

3 Followers

About Knomax

  • Rank
    Dedicated

Basic Info

  • Gender
    Male
  • Location
    Greece
  • DumaOS Routers Owned
    Netduma R1

Recent Profile Visitors

2,422 profile views
  1. Nevermind... Do you have sfq and HTB? More tomorrow... It is SBMM i think throwing you in a "bad" lobby.
  2. run this command and post here to see if you have pie...maybe missing... ls -lha /lib/modules/$(uname -r)/ | grep sch
  3. It is correct...delete the file from openwrt...create a new file with the same code and copy it again in openwrt.
  4. You make something wrong when you copy the code...copy the code here to see what is wrong.
  5. You must see one more qdisc...pie...reboot the router and put a screenshot of tc -s qdsic.
  6. Both scripts must be executable....chmod +x
  7. You must run tc -s qdisc and you will see the hfsc ...pie and pfifo qdiscs. Dont put bridge interface in LAN.....br-lan.........change it to eth0.1 i am using edgerouter x to. Sorry i forgot to say that you must make them executable ....chmod +x qos.sh then chmod +x gaming.sh Disable SQM..you will use these scripts for QOS.For gaming.sh yo will see the rules attached in gui-->firewall...for qos.sh when yo reboot router..run tc -s qdisc to see. Please tell me if you are ok or have any other problems.
  8. Hello guys..for everyone using Openwrt ...a QOS script "hand made" tested with Cold War. In this script it creates a realtime HFSC class to control the game traffic. It gives a maximum bandwidth that it absolutely guarantees for the real-time class. You can throttle your speeds that game can use changing values in GAMEUP (upload) or GAMEDOWN (download). It uses HFSC ...for gaming priority we use pfifo qdisc to dont drop packets and make sure no packet loss will occur.And a pie qdisc for non prioritize traffic. Doing that gives some reasonable amount of delay control to the "less sensitive" users but still prioritizes mainly the game traffic from console (ps4/xbox). This results in bufferbloat in the 80-150 ms range for things like general web surfing, but essentially zero bufferbloat and zero packet drops for the gaming traffic. For typical stuff, 80-150ms is actually not particularly a big deal, you blink your eye in about 100-150ms. It's a huge deal however for games, or VOIP. So for people who dedicate a particular console or gaming machine to their games, this script should produce very good results after tuning the appropriate values in the header. Just create an empty file..name it etc. qos.sh put the code inside..save it...copy to openwrt /root/ folder. #!/bin/sh WAN=pppoe-wan # change this to your WAN device name UPRATE=818 #change this to your 80% kbps upload speed (in kbps) LAN=eth0.1 # change this to your LAN device name DOWNRATE=16000 #change this to about 80% of your download speed (in kbps) GAMEUP=400 # 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 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 Second script for iptables Classify....gaming traffic from Ps4/Xbox falls in "high priority" class...1:2 Just change the value to your Ps4/Xbox IP...save the file etc. as gaming.sh #!/bin/sh GAMINGIP="192.168.1.xxx" # change this to Ps4/xbox IP. #reclassify all udp packets from your gaming machine as 1:2, high priority iptables -t mangle -A POSTROUTING -p udp --sport 1024:65535 -s ${GAMINGIP} -j CLASSIFY --set-class 1:2 iptables -t mangle -A POSTROUTING -p udp --dport 1024:65535 -d ${GAMINGIP} -j CLASSIFY --set-class 1:2 In Openwrt "System-->startup--->local start up" put this before "exit 0" so in every reboot the scripts auto loaded. # Put your custom commands here that should be executed once # the system init finished. By default this file does nothing. sleep 8 /root/qos.sh sleep 8 /root/gaming.sh exit 0 That's it guys...have fun.😉 **Big thanks to Dlakelan and others "gurus" in Openwrt forum spending hours and hours with me..changing code,trying different q disc's..trying to "guess" how game mechanics works..lag comp and so on to find sweet spot.** ***Scripts approach is in logic..."all about gaming and nothing else".
  9. Many rles filled by dnsmasq.
  10. First of all ..create a text file and name it DSCP.sh.......then copy all the code in it........move the file in openwrt /root/ folder......make it executable .....then in openwrt GUI...."System-->>Startup".......write this ... /root/DSCP.sh Reboot router...check in firewall if you see the ip table rules.
  11. tc -s qdisc....you can see here if you use 3 or 4 tins or one tin... From firewall stats you can see if the traffic falls in firewall rules...if you see firewall rules counting packets so this rule is working normal.
  12. These rules is for at least "basic" prioritization of your network....if you want to have full control in any traffic you can use a more complicated set up.(this is what i am using) I will explain... Control of this traffic: # give a high priority for PS4 or xbox # washing all traffic dscp to CS0 and then start to mark them # mark connections that go over 115 packets per second, not prioritized # unmarked UDP streams with small packets get CS6 # large udp streams like video call get AF41 # ICMP, to prioritize pings # DNS traffic both udp and tcp # NTP ##Browsing ######## ## medium priority for browsing #TCP SYN,ACK flows ################## #Make sure ACK,SYN packets get priority (to avoid upload speed limiting our download speed) #Small packet is probably interactive or flow control #Small packet connections: multi purpose (don't harm since not maxed out) # Streaming Media (videos/audios) ######################################## #Known video streams sites like netflix # some iptv provider's #known usrcdn like google # Background Traffic (Bulk/file transfer) ######################################### #bulk traffic ipset, like windows updates and steam updates/downloads These rules are running as a script when router boots and script set's up the firewall. #!/bin/bash -x IPT="iptables" ########## ######### ##ipset for streaming sites.they are being filled by dnsmasq ipset create streaming hash:ip ipset create usrcdn hash:ip ipset create bulk hash:ip ipset create latsens hash:ip ## add routing for veth0 this will handle all traffic #ip route add default dev veth0 table 100 #ip rule add iif $WANIF table 100 priority 100 $IPT -t mangle -N dscp_mark > /dev/null 2>&1 $IPT -t mangle -F dscp_mark ## check if POSTROUTING already exits then jumps to our tables if not, add them $IPT -t mangle -L POSTROUTING -n | grep dscp_mark || $IPT -t mangle -A POSTROUTING -j dscp_mark iptmark(){ $IPT -t mangle -A dscp_mark "[email protected]" } #give a high priority for PS4 or xbox $IPT -t mangle -A PREROUTING -p udp -m conntrack --ctorigsrc 192.168.1.200 -m multiport ! --ports 80,443,8080 -j DSCP --set-dscp-class CS4 -m comment --comment "PS4" $IPT -t mangle -A PREROUTING -p tcp -m conntrack --ctorigsrc 192.168.1.200 -m multiport ! --ports 80,443,8080 -j DSCP --set-dscp-class CS4 -m comment --comment "PS4" #for PS4 or xbox etc, change the ip according to your ip setting. ## start by washing the dscp to CS0 iptmark -j DSCP --set-dscp 0 iptmark -p udp -m conntrack --ctorigsrc 192.168.1.250 -j DSCP --set-dscp-class CS1 -m comment --comment "tablet udp Low" iptmark -p tcp -m conntrack --ctorigsrc 192.168.1.250 -j DSCP --set-dscp-class CS1 -m comment --comment "tablet tcp Low" #A robust 2 rules to detect realtime traffic # mark connections that go over 115 packets per second, not prioritized iptmark -p udp -m hashlimit --hashlimit-name udp_high_prio --hashlimit-above 115/sec --hashlimit-burst 50 --hashlimit-mode srcip,srcport,dstip,dstport -j CONNMARK --set-mark 0x55 -m comment --comment "connmark for udp" # unmarked UDP streams with small packets get CS6 iptmark -p udp -m connmark ! --mark 0x55 -m multiport ! --ports 22,25,53,67,68,123,143,161,162,514,5353,80,443,8080,60001 -m connbytes --connbytes 0:940 --connbytes-dir both --connbytes-mode avgpkt -j DSCP --set-dscp-class CS6 -m comment --comment "small udp connection gets CS6" #large udp streams like video call get AF41 iptmark -p udp -m connmark ! --mark 0x55 -m multiport ! --ports 22,25,53,67,68,123,143,161,162,514,5353,80,443,8080,60001 -m connbytes --connbytes 940:1500 --connbytes-dir both --connbytes-mode avgpkt -j DSCP --set-dscp-class AF41 -m comment --comment "large udp connection gets AF41" ######################################## # Latency Sensitive (gaming/voip) ######################################## ##ICMP, to prioritize pings iptmark -p icmp -j DSCP --set-dscp-class CS5 -m comment --comment "ICMP-pings" #DNS traffic both udp and tcp iptmark -p udp -m multiport --port 53,5353,8888 -j DSCP --set-dscp-class CS5 -m comment --comment "DNS udp" iptmark -p tcp -m multiport --port 53,5353,8888 -j DSCP --set-dscp-class CS5 -m comment --comment "DNS tcp" #NTP iptmark -p udp -m multiport --port 123 -j DSCP --set-dscp-class CS6 -m comment --comment "NTP udp" #High priority ipset, i use for pubgM #iptmark ! -p tcp -m set --match-set latsens src,dst -j DSCP --set-dscp-class CS6 -m comment --comment "latency sensitive ipset" ## set dscp tag for Latency Sensitive (latsens) ipset,udp #iptmark -p tcp -m set --match-set latsens src,dst -j DSCP --set-dscp-class CS5 -m comment --comment "latency sensitive ipset" ## set dscp tag for Latency Sensitive (latsens) ipset ######## ##Browsing ######## ## medium priority for browsing iptmark -p tcp -m multiport --ports 80,443,8080 -j DSCP --set-dscp-class CS3 -m comment --comment "Browsing at CS3" ################## #TCP SYN,ACK flows ################## #Make sure ACK,SYN packets get priority (to avoid upload speed limiting our download speed) iptmark -p tcp --tcp-flags ALL ACK -m length --length :128 -j DSCP --set-dscp-class CS3 iptmark -p tcp --tcp-flags ALL SYN -m length --length :666 -j DSCP --set-dscp-class CS3 #Small packet is probably interactive or flow control iptmark -m dscp ! --dscp 24 -m dscp ! --dscp 18 -m dscp ! --dscp 34 -m dscp ! --dscp 40 -m dscp ! --dscp 48 -m length --length 0:500 -j DSCP --set-dscp-class CS3 #Small packet connections: multi purpose (don't harm since not maxed out) iptmark -m dscp ! --dscp 24 -m dscp ! --dscp 18 -m dscp ! --dscp 34 -m dscp ! --dscp 40 -m dscp ! --dscp 48 -m connbytes --connbytes 0:250 --connbytes-dir both --connbytes-mode avgpkt -j DSCP --set-dscp-class CS3 ######################################## # Streaming Media (videos/audios) ######################################## #Known video streams sites like netflix iptmark -m set --match-set streaming src,dst -j DSCP --set-dscp-class AF41 -m comment --comment "video audio stream ipset" # some iptv provider's use this port iptmark -p tcp -m multiport --ports 1935,9982 -j DSCP --set-dscp-class AF41 -m comment --comment "some iptv streaming service" #known usrcdn like google or akamai iptmark -m set --match-set usrcdn src,dst -j DSCP --set-dscp-class AF21 -m comment --comment "usrcdn ipset" ######################################### # Background Traffic (Bulk/file transfer) ######################################### #bulk traffic ipset, like windows udates and steam updates/downloads iptmark -p tcp -m set --match-set bulk src,dst -j DSCP --set-dscp-class CS1 -m comment --comment "bulk traffic ipset" iptmark -p udp -m set --match-set bulk src,dst -j DSCP --set-dscp-class CS1 -m comment --comment "bulk traffic ipset" iptmark -p tcp -m connbytes --connbytes 350000: --connbytes-dir both --connbytes-mode bytes -m dscp --dscp-class CS0 -j DSCP --set-dscp-class CS1 -m comment --comment "Downgrade CS0 to CS1 for bulk tcp traffic" iptmark -p tcp -m connbytes --connbytes 350000: --connbytes-dir both --connbytes-mode bytes -m dscp --dscp-class CS3 -j DSCP --set-dscp-class CS1 -m comment --comment "Downgrade CS3 to CS1 for bulk tcp traffic" iptmark -p udp -m multiport --port 60001 -j DSCP --set-dscp-class CS1 -m comment --comment "bulk torrent port UDP" #tcpdump rule, copy and paste this rule into terminal, this rule is used to capture realtime traffic, you can change ip to what you like #tcpdump -i br-lan host 192.168.1.126 and udp and portrange 1-65535 and !port 53 and ! port 80 and ! port 443 -vv -X -w /root/cap-name.pcap Then i add in dnsmasq configuration file these parameters ... ##video/audio streams # Youtube is also isolated by my isp ipset=/googlevideo.com/*.googlevideo.com/streaming # NetFlix ipset=/nflxvideo.net/streaming # AmazonVideo ipset=/s3.ll.dash.row.aiv-cdn.net/d25xi40x97liuc.cloudfront.net/aiv-delivery.net/streaming # Facebook ipset=/fbcdn.net/streaming # Twitch ipset=/ttvnw.net/streaming # VeVo ipset=/vevo.com/streaming # Spotify ipset=/audio-fa.scdn.cot/streaming # Deezer ipset=/deezer.com/streaming # SoundCloud ipset=/sndcdn.com/streaming # last.fm ipset=/last.fm/streaming #reddit videos ipset=/v.redd.it/streaming #twitch.tv ipset=/ttvnw.net/streaming ##i have isolated speed for those cdn's ipset=/googletagmanager.com/googleusercontent.com/*.googleusercontent.com/google.com/fbcdn.net/*.fbcdn.net/akamaihd.net/*.akamaihd.net/whatsapp.net/*.whatsapp.net/whatsapp.com/*.whatsapp.com/www-cdn.whatsapp.net/googleapis.com/*.googleapis.com/ucy.ac.cy/1e100.net/hwcdn.net/usrcdn ## Bulk downloads #qq download ipset=/download.qq.com/bulk # Steam Download ipset=/steamcontent.com/bulk # PSN Download ipset=/gs2.ww.prod.dl.playstation.net/bulk # DropBox ipset=/dropbox.com/dropboxstatic.com/dropbox-dns.com/log.getdropbox.com/bulk # Google Drive ipset=/drive.google.com/drive-thirdparty.googleusercontent.com/bulk # Google Docs ipset=/docs.google.com/docs.googleusercontent.com/bulk # PlayStore Download ipset=/gvt1.com/bulk # WhatsApp Files ipset=/mmg-fna.whatsapp.net/bulk # Youtube Upload ipset=/upload.youtube.com/upload.video.google.com/bulk # WindowsUpdate ipset=/windowsupdate.com/update.microsoft.com/bulk So when you see a video in Netflix etc. it falls in streaming ipset (ipset=/nflxvideo.net/streaming) by dnsmasq..and this traffic matching this rule... iptmark -m set --match-set streaming src,dst -j DSCP --set-dscp-class AF41 -m comment --comment "video audio stream ipset" It falls in video tin because i mark it as AF41 and according to tc-cake(8) — Linux manual page AF41 is "video" tin. Also you must use diffserv4. 😉
  13. If you want to get highest priority you must mark them as CS4 If you try to have full bandwidth to ps4 you don't need QOS-SQM.With CS4 it uses 25% threshold. Yes you can try this...range from 30000 to 45000 was a result by what players have seen in wireshark. When you run tc -s qdisc you will 3 tins...if you see 3 tins then everything is ok.Look in this example from Cake man page.You can try diffserv4 with 4 tins. # tc -s qdisc show dev eth0 qdisc cake 1: root refcnt 2 bandwidth 100Mbit diffserv3 triple- isolate rtt 100.0ms noatm overhead 38 mpu 84 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 memory used: 0b of 5000000b capacity estimate: 100Mbit min/max network layer size: 65535 / 0 min/max overhead-adjusted size: 65535 / 0 average network hdr offset: 0 Bulk Best Effort Voice thresh 6250Kbit 100Mbit 25Mbit target 5.0ms 5.0ms 5.0ms interval 100.0ms 100.0ms 100.0ms pk_delay 0us 0us 0us av_delay 0us 0us 0us sp_delay 0us 0us 0us pkts 0 0 0 bytes 0 0 0 way_inds 0 0 0 way_miss 0 0 0 way_cols 0 0 0 drops 0 0 0 marks 0 0 0 ack_drop 0 0 0 sp_flows 0 0 0 bk_flows 0 0 0 un_flows 0 0 0 max_len 0 0 0 quantum 300 1514 762
  14. Now i am using DumaOS 3...testing it to find bugs.I like experiment with new things..new methods...new ideas to improve gaming.
×
×
  • Create New...