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:
Code: Select all
/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
https://www.waveform.com/tools/bufferbl ... e21448d12c
Thanks for reading :]