Community discussions

MikroTik App
 
eliasAD
just joined
Topic Author
Posts: 8
Joined: Tue Aug 15, 2023 9:36 am

Using ChatGPT to make a QOS script for PS5, Opinions?

Tue Sep 05, 2023 7:56 pm

Hey everyone nobody Mikrotik user here. I have been using Chat GPT to learn how to configure Mikrotik routers. Its great because I can ask it endless questions without it getting frustrated and laughing at me XD anyway after a few days of learning how to write scripts and how the rules affect the network i'm trying to build, we have come up with this script shown below.

The goal of this script is to Prioritise gaming traffic to a PS5 this is important to my son to have low ping at home, he's actually really good and plays in a lot of tournaments so i'm all for supporting him. This means keeping ping below 10ms as much as possible.

The purpose of this post is to see what the Mikrotik experts on here think of an AI generated script. Is there any mistakes? or conflicting rules? and perhaps more importantly is this the best way to do it?

*Edited* [ after 2 days of using this I am encountering issues with "add name="GAMING_D" parent="MASTER_DOWN" packet-mark="GAMING" queue=default limit-at=75M max-limit=225M priority=1" all other queue tree rules are showing traffic on it except Gaming down, it only ever shows 0 I wonder if there is some mangle rule that is missing for this Queue?)

he partly AI generated SCRIPT:
/ip firewall mangle
# DNS requests. Mark in two places because DNS is sent out by the router (itself) too.
add chain=prerouting action=mark-connection protocol=udp port=53 connection-state=new new-connection-mark="DNS" comment="DNS"
add chain=postrouting action=mark-connection protocol=udp port=53 connection-state=new new-connection-mark="DNS"
add chain=postrouting action=mark-packet passthrough=no connection-mark="DNS" new-packet-mark="DNS"
# Mark all VoIP traffic (adjust ports and protocols as needed).
add chain=prerouting action=mark-connection protocol=tcp dscp=46 new-connection-mark="VOIP" comment="VOIP"
add chain=prerouting action=mark-connection protocol=udp dscp=46 new-connection-mark="VOIP"
add chain=prerouting action=mark-packet passthrough=no connection-mark="VOIP" new-packet-mark="VOIP"
# Mark gaming traffic (adjust ports as needed for your PS5).
add chain=prerouting action=mark-connection protocol=udp port=3074,9308 new-connection-mark="GAMING" comment="Gaming"
add chain=prerouting action=mark-packet passthrough=no connection-mark="GAMING" new-packet-mark="GAMING"
# Ping replies. Mark in two places because ICMP is sent out by the router (itself) too.
add chain=prerouting action=mark-connection protocol=icmp connection-state=new new-connection-mark="ICMP" comment="ICMP"
add chain=postrouting action=mark-connection protocol=icmp connection-state=new new-connection-mark="ICMP"
add chain=postrouting action=mark-packet passthrough=no connection-mark="ICMP" new-packet-mark="ICMP"
# Mark everything else that has no mark applied.
add chain=prerouting action=mark-connection connection-mark=no-mark new-connection-mark="OTHER" comment="OTHER"
add chain=prerouting action=mark-packet passthrough=no connection-mark="OTHER" new-packet-mark="OTHER"

/ip firewall filter
add chain=input action=accept connection-state=established,related comment="Allow established/related connections"
add chain=input action=drop in-interface=ether1 comment="Drop invalid connections on WAN interface"
add chain=input action=accept in-interface=ether1 dst-port=53 protocol=udp comment="Allow DNS UDP"
add chain=input action=accept in-interface=ether1 dst-port=53 protocol=tcp comment="Allow DNS TCP"
add chain=input action=accept in-interface=ether1 dst-port=3074,9308 protocol=udp comment="Allow Gaming UDP (Adjust Ports)"
add chain=input action=accept in-interface=ether1 protocol=icmp comment="Allow ICMP"
add chain=input action=accept in-interface=ether1 dst-port=80,443 protocol=tcp comment="Allow HTTP/HTTPS"
add chain=input action=drop in-interface=ether1 comment="Drop all other incoming traffic on WAN interface"
add chain=forward action=fasttrack-connection connection-mark=GAMING comment="Fast Track Gaming" 
add chain=forward action=fasttrack-connection connection-mark=DNS comment="Fast Track DNS" 
add chain=forward action=accept connection-state=established,related comment="Allow established/related connections"
add chain=forward action=accept connection-state=new in-interface=ether1 comment="Allow new connections from LAN to WAN"
add chain=forward action=drop connection-state=invalid comment="Drop invalid connections"
add chain=forward action=accept in-interface=bridge comment="Allow traffic from LAN to WAN"
add chain=forward action=drop comment="Drop all other traffic from LAN to WAN"

/queue tree
add name=“MASTER_UP” parent=“ether1” queue=default max-limit=90M priority=8
add name=“MASTER_DOWN” parent=“ether2” queue=default max-limit=900M priority=8
# Prioritize gaming traffic
add name="GAMING_U" parent="MASTER_UP" packet-mark="GAMING" queue=default limit-at=7500k max-limit=22500k priority=1
add name="GAMING_D" parent="MASTER_DOWN" packet-mark="GAMING" queue=default limit-at=75M max-limit=225M priority=1
# Prioritize other important traffic
add name="VOIP_U" parent="MASTER_UP" packet-mark="VOIP" queue=default limit-at=7500k max-limit=22500k priority=2
add name="VOIP_D" parent="MASTER_DOWN" packet-mark="VOIP" queue=default limit-at=75M max-limit=225M priority=2
add name="DNS_U" parent="MASTER_UP" packet-mark="DNS" queue=default limit-at=7500k max-limit=22500k priority=3
add name="DNS_D" parent="MASTER_DOWN" packet-mark="DNS" queue=default limit-at=75M max-limit=225M priority=3
add name="ICMP_U" parent="MASTER_UP" packet-mark="ICMP" queue=default limit-at=7500k max-limit=22500k priority=4
add name="ICMP_D" parent="MASTER_DOWN" packet-mark="ICMP" queue=default limit-at=75M max-limit=225M priority=4
# Mark everything else as lower priority
add name="OTHER_U" parent="MASTER_UP" packet-mark="OTHER" queue=default limit-at=7500k max-limit=22500k priority=5
add name="OTHER_D" parent="MASTER_DOWN" packet-mark="OTHER" queue=default limit-at=75M max-limit=225M priority=5
Bufferbloat test: (bare in mind i'm not sure how to test if the script its effecting the bufferbloat on the PS5 directly. This test was done on a MAC via ethernet, the MAC is not optimised for in the queue tree so results may not be very useful?)
Image
https://www.waveform.com/tools/bufferbl ... e21448d12c

Thanks for reading :]
You do not have the required permissions to view the files attached to this post.
Last edited by eliasAD on Tue Sep 05, 2023 10:01 pm, edited 1 time in total.
 
User avatar
Larsa
Forum Guru
Forum Guru
Posts: 1611
Joined: Sat Aug 29, 2015 7:40 pm
Location: The North Pole, Santa's Workshop

Re: Using ChatGPT to make a QOS script for PS5, Opinions?

Tue Sep 05, 2023 9:10 pm

ChatGPT is just a dumb language model that makes up a lot of stuff so you can never ever trust it to supply the correct facts. It's better to find another source for your project.
 
eliasAD
just joined
Topic Author
Posts: 8
Joined: Tue Aug 15, 2023 9:36 am

Re: Using ChatGPT to make a QOS script for PS5, Opinions?

Tue Sep 05, 2023 9:55 pm

ChatGPT is just a dumb language model which makes up a lot of stuff so you can never ever trust the supplied facts. It's better to seek another source for your project.
Yes i've caught it out on mistakes many a Time its not perfect, I would still like to know whether the above script is done correctly or if anyone knows a better way im all ears. What GPT is good at is explaining certain things that are hard to quickly grasp for a Leyman. I am looking into other sources including many posts on here about qos, it's just all so personalised to peoples needs etc... The best post on qos I have come across so far is PCunites qos post for making a basic qos but even his "basic qos" seems to prioritise VOIP traffic. (viewtopic.php?f=23&t=73214&sid=ddd36255 ... 3e06d43205)
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 4324
Joined: Sun May 01, 2016 7:12 pm
Location: California
Contact:

Re: Using ChatGPT to make a QOS script for PS5, Opinions?

Wed Sep 06, 2023 1:36 am

ChatGPT does better at things like bash scripts, Dockerfiles, or DNS BIND9 zone files, etc. For RouterOS is doesn't have a transformer to help it, so results are often context-less version of reddit post.

Anyway, seems it working other than your "gaming queue". The issue is the ports used vary by game. You can look at /ip/firewall/connections and filter on your PS5's IP address and see what port/protocols it's uses and mark them specifically. You can also just mark GAMING traffic based on the PS5's IP (and add DHCP static lease for it), not just specific port/protocol, so any port it uses are covers and given priority.
 
Moba
Member Candidate
Member Candidate
Posts: 213
Joined: Sun Sep 27, 2020 6:15 pm

Re: Using ChatGPT to make a QOS script for PS5, Opinions?

Sat Sep 23, 2023 12:11 am

At the risk of starting another QoS debate thread...

1. Get the best Internet service you can afford (many latency issues occur on the WAN side, where you can't control anything).

2. You can't improve your base latency with QoS, because schedulers/traffic shapers always add latency and CPU time. Only the average latency under load can be improved.

3. Less is more. While pcunite's guide is spot-on (and very educational) for his use case, it's also resource intensive IMO by its scope. Every rule and packet mark has to be processed by the small processor in your router. Do you really need to process every packet to achieve your goal ? There's a post in that thread with a brilliant and cleverly implemented 3 tier setup (microCAKE). It basically prioritizes time critical packets (you can add your gaming ports in that class i.e. 3074) and buffers/drops everything else as required. Alternatively, a simple queue with CoDel or SFQ might suffice without any additional tweaks.

Hence, in that regard, I love Amm0's simple approach: prioritize the console over everything else. You can also limit traffic from other devices and reserve a portion for the console, so it never has to fight over other packets. Real time gaming packets are very small, after all…

Lastly, you probably should not use ChatGPT...the only smart thing about it is how it plagiarizes the work of others without crediting them...
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12554
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Using ChatGPT to make a QOS script for PS5, Opinions?

Sat Sep 23, 2023 1:53 am

I have been using Chat GPT to learn how to configure Mikrotik routers.

In fact, you can see the effect...

all other queue tree rules are showing traffic on it except Gaming down, it only ever shows 0
I wonder if there is some mangle rule that is missing for this Queue?



Using ChatGPT to make a QOS script for PS5, Opinions?
...and then you have problems and come and ask here...
Why don't you ask that question to ChatGPT?
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 2975
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Using ChatGPT to make a QOS script for PS5, Opinions?

Sat Sep 23, 2023 2:20 pm

I have been using Chat GPT to learn how to configure Mikrotik routers. ...
It is like visiting a fairy ... ChatGPT "tells" you what you want to "hear" but you never know if the fairytale is true or correct in narration.
If only the "story" matches your expectations good enough then you are convinced that this is a correct "answer".

Have anyone seen the possibility to negate the ChatGPT answer? It's answers are the truth revealed.
It is a newer version of Facesomething where you had no chance to negate the post so every post was treated as positive or super postive.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 21893
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Using ChatGPT to make a QOS script for PS5, Opinions?

Sat Sep 23, 2023 3:04 pm

Suggest a CHAT GPT forum withini MT, where all chatGPT conversations can go, and we never have to visit. :-)
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 4324
Joined: Sun May 01, 2016 7:12 pm
Location: California
Contact:

Re: Using ChatGPT to make a QOS script for PS5, Opinions?

Sat Sep 23, 2023 5:28 pm

At the risk of starting another QoS debate thread...
No it's the ChatGPT part that gets folks all rilled up.

But @moba's post above is spot on, see viewtopic.php?t=199319#p1026772
Every rule and packet mark has to be processed by the small processor in your router. Do you really need to process every packet to achieve your goal ? There's a post in that thread with a brilliant and cleverly implemented 3 tier setup (microCAKE). It basically prioritizes time critical packets (you can add your gaming ports in that class i.e. 3074) and buffers/drops everything else as required. Alternatively, a simple queue with CoDel or SFQ might suffice without any additional tweaks.
I'm a fan of prioritizing the device(s), then SFQ rest in queue tree. Every config line in a "mangle" or "queue" is slowing down packet processing, so "less is more" is a great summary :).

Perhaps you can add also a simple queue for Wi-Fi to throttle client speeds which reduce load before it gets to WAN queue tree be another addition. If router has lightly loaded CPU before queueing, perhaps newer CoDel/FQCoDel/CAKE likely might add benefits over older (but simple/low-overhead) SFQ.

FWIW I don't know what "microCAKE" is.
 
Moba
Member Candidate
Member Candidate
Posts: 213
Joined: Sun Sep 27, 2020 6:15 pm

Re: Using ChatGPT to make a QOS script for PS5, Opinions?

Sat Sep 23, 2023 6:59 pm


FWIW I don't know what "microCAKE" is.

It was a v6 config posted in pcunite's QoS thread that was meant to somewhat replicate CAKE before it became available with the kernel update in v7. It used SFQ type queues with a minimal amount of mangle rules.

Who is online

Users browsing this forum: gigabyte091 and 15 guests