How to import script for gaming

Hello, totally noob here, recently i installed openwrt on a flint 2 router. Tried using Qosmate but i felt like i have better results with it turned off in games such as Apex Legends.. My bufferbloat is A+ without any qos or sqm, 300 down, 150 up. Yesterday i came across a post from 2021 from a person who poster his tweaked script. I will paste in in here, would someone be so kind to help me how to import this script through Putty or other methods? Thank you in advance!

I can help with nftables conversion :wink: rough equivalent of your script is called qosmate nowadays. Ever heard of ipv6?

Please use the "Preformatted text </>" button for logs, scripts, configs and general console output (red circle; this works best in the 'Markdown' composer view in the blue oval):

Screenshot 2025-10-20 at 8.14.14 PM

I would really appreciate your help, if you dont mind me asking, what is the program called because i only used so far Putty.. also i want to mention that whenever i had qosmate on i had this weird microstutter only when i looked at another player while whe it was off its completely gone.

it's a board feature, select the text you pasted from cli/Putty, and press the button.

There is a very friendly thread about qosmate where all the baking action happens, probably check there first before reviving 10 years old wheel.

2 Likes

Do i have to save the file first in a folder or how does it work? Also how do i gain access to the board feature? Thank you

just copy and past the text (which you've already done).
the feature is there, you just need to follow the instruction posted earlier by brada4.

Just copy paste script into a code section
I dont want to deal with un-formatting it.

a/ suggest modules to add to iptables-nft to make it work
b/ help with nftables conversion (involves moving ipset to nftset as seen in OpenWrt 24.10)

Alright, installed the iptables-nft, how do i convert nftables? Thank you.

Please use the "Preformatted text </>" button for logs, scripts, configs and general console output (red circle; this works best in the 'Markdown' composer view in the blue oval):

Screenshot 2025-10-20 at 8.14.14 PM

1 Like

iptables-translate

(BTW, please fix your first post.)

1 Like
iptables v1.8.10 (nf_tables): unknown option "--set-dscp"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
Warning: Extension conntrack is not supported, missing kernel module?
iptables v1.8.10 (nf_tables): Couldn't load match `conntrack':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): Couldn't load match `hashlimit':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): Couldn't load match `connmark':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): Couldn't load match `connmark':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): Couldn't load match `connmark':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): Couldn't load match `connmark':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): Couldn't load match `length':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): Couldn't load match `length':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): Couldn't load match `dscp':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): Couldn't load match `dscp':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): unknown option "--set-dscp-class"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.8.10 (nf_tables): Couldn't load match `connbytes':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
opkg list | grep conntrack
mod-ipt-conntrack - 6.6.110-r1 - Netfilter (IPv4) kernel modules for connection tracking Includes: - conntrack - defrag - iptables_raw - NOTRACK - state
kmod-ipt-conntrack-extra - 6.6.110-r1 - Netfilter (IPv4) extra kernel modules for connection tracking Includes: - connbytes - connmark/CONNMARK - conntrack - helper - recent

...

opkg install ....
opkg install iptables-mod-hashlimit iptables-mod-ipopt iptables-mod-conntrack-extra 

now ruleset loads....

nft list table ip mangle | grep "xt "

Now use dictionary to add respective nftables modules to use nftables engine

And show the ruleset without xt desviations in a properly formatted way using

nft list table ip mangle

Then we proceed to rewriting your script to #!/usr/sbin/nft -f one (btw shell is no good, you could use iptables-save/-restore style file for faster processing.

Thank you for all the help, already factory reseted the router because it didnt seems to work that well and didnt know how to delete it. Isnt there something more simple to do to the firewall that would have a bigger impact because it always seems to be the issue, and it only happens for example with a lot of players around, lets say everything is fine with 30 player count but once you join a game with 60 players ,its like a stuterry mess. Tried opening ports as well but didnt help. Thank you

Please add a link to the result of https://www.waveform.com/tools/bufferbloat test.

What is your game? The more player the bigger game status report, at some point it hits bandwidth either of connection or your router's CPU. Dont you think if such magic fixall button existed it was not already applied?

Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button (red circle; this works best in the 'Markdown' composer view in the blue oval):

Screenshot 2025-10-20 at 8.14.14 PM

Remember to redact passwords, VPN keys, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/network
cat /etc/config/wireless
cat /etc/config/dhcp
cat /etc/config/firewall
1 Like

https://www.waveform.com/tools/bufferbloat?test-id=a389f130-0446-4754-ac6f-951a40cad5df

"kernel": "6.6.110",
"hostname": "OpenWrt",
"system": "ARMv8 Processor rev 4",
"model": "GL.iNet GL-MT6000",
"board_name": "glinet,gl-mt6000",
"rootfs_type": "squashfs",
"release": {
"distribution": "OpenWrt",
"version": "24.10.4",
"revision": "r28959-29397011cc",
"target": "mediatek/filogic",
"description": "OpenWrt 24.10.4 r28959-29397011cc",
"builddate": "1760891865"

config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config globals 'globals'
option ula_prefix 'fdbe:7b81:829::/48'
option packet_steering '1'

config device
option name 'br-lan'
option type 'bridge'
list ports 'lan1'
list ports 'lan2'
list ports 'lan3'
list ports 'lan4'
list ports 'lan5'

config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'

config interface 'wan'
option device 'eth1'
option proto 'pppoe'
option username 'user'
option password 'user'
option ipv6 'auto'

config interface 'wan6'
option device 'eth1'
option proto 'dhcpv6'

config dnsmasq
option domainneeded '1'
option boguspriv '1'
option filterwin2k '0'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
option nonegcache '0'
option cachesize '1000'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
option nonwildcard '1'
option localservice '1'
option ednspacket_max '1232'
option filter_aaaa '0'
option filter_a '0'

config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option dhcpv4 'server'
option dhcpv6 'server'
option ra 'server'
option ra_slaac '1'
list ra_flags 'managed-config'
list ra_flags 'other-config'

config dhcp 'wan'
option interface 'wan'
option ignore '1'

config odhcpd 'odhcpd'
option maindhcp '0'
option leasefile '/tmp/hosts/odhcpd'
option leasetrigger '/usr/sbin/odhcpd-update'
option loglevel '4'
option piofolder '/tmp/odhcpd-piofolder'

config defaults
option input 'REJECT'
option output 'ACCEPT'
option forward 'DROP'
option synflood_protect '1'
option drop_invalid '1'

config zone
option name 'lan'
list network 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'

config zone
option name 'wan'
list network 'wan'
list network 'wan6'
option input 'DROP'
option output 'ACCEPT'
option forward 'DROP'
option masq '1'
option mtu_fix '1'

config forwarding
option src 'lan'
option dest 'wan'

config rule
option name 'Allow-DHCP-Renew'
option src 'wan'
option proto 'udp'
option dest_port '68'
option target 'ACCEPT'
option family 'ipv4'

config rule
option name 'Allow-Ping'
option src 'wan'
option proto 'icmp'
option icmp_type 'echo-request'
option family 'ipv4'
option target 'ACCEPT'

config rule
option name 'Allow-IGMP'
option src 'wan'
option proto 'igmp'
option family 'ipv4'
option target 'ACCEPT'

config rule
option name 'Allow-DHCPv6'
option src 'wan'
option proto 'udp'
option dest_port '546'
option family 'ipv6'
option target 'ACCEPT'

config rule
option name 'Allow-MLD'
option src 'wan'
option proto 'icmp'
option src_ip 'fe80::/10'
list icmp_type '130/0'
list icmp_type '131/0'
list icmp_type '132/0'
list icmp_type '143/0'
option family 'ipv6'
option target 'ACCEPT'

config rule
option name 'Allow-ICMPv6-Input'
option src 'wan'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
list icmp_type 'router-solicitation'
list icmp_type 'neighbour-solicitation'
list icmp_type 'router-advertisement'
list icmp_type 'neighbour-advertisement'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'

config rule
option name 'Allow-ICMPv6-Forward'
option src 'wan'
option dest '*'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'

config rule
option name 'Allow-IPSec-ESP'
option src 'wan'
option dest 'lan'
option proto 'esp'
option target 'ACCEPT'

config rule
option name 'Allow-ISAKMP'
option src 'wan'
option dest 'lan'
option dest_port '500'
option proto 'udp'
option target 'ACCEPT'

"kernel": "6.6.110",
"hostname": "OpenWrt",
"system": "ARMv8 Processor rev 4",
"model": "GL.iNet GL-MT6000",
"board_name": "glinet,gl-mt6000",
"rootfs_type": "squashfs",
"release": {
"distribution": "OpenWrt",
"version": "24.10.4",
"revision": "r28959-29397011cc",
"target": "mediatek/filogic",
"description": "OpenWrt 24.10.4 r28959-29397011cc",
"builddate": "1760891865"

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fdbe:7b81:829::/48'
        option packet_steering '1'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'
        list ports 'lan5'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option device 'eth1'
        option proto 'pppoe'
        option username 'user'
        option password 'user'
        option ipv6 'auto'

config interface 'wan6'
        option device 'eth1'
        option proto 'dhcpv6'

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option nonegcache '0'
        option cachesize '1000'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option nonwildcard '1'
        option localservice '1'
        option ednspacket_max '1232'
        option filter_aaaa '0'
        option filter_a '0'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'
        option piofolder '/tmp/odhcpd-piofolder'

config defaults
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'DROP'
        option synflood_protect '1'
        option drop_invalid '1'

config zone
        option name 'lan'
        list network 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'

config zone
        option name 'wan'
        list network 'wan'
        list network 'wan6'
        option input 'DROP'
        option output 'ACCEPT'
        option forward 'DROP'
        option masq '1'
        option mtu_fix '1'

config forwarding
        option src 'lan'
        option dest 'wan'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-IGMP'
        option src 'wan'
        option proto 'igmp'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-MLD'
        option src 'wan'
        option proto 'icmp'
        option src_ip 'fe80::/10'
        list icmp_type '130/0'
        list icmp_type '131/0'
        list icmp_type '132/0'
        list icmp_type '143/0'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        list icmp_type 'router-advertisement'
        list icmp_type 'neighbour-advertisement'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-IPSec-ESP'
        option src 'wan'
        option dest 'lan'
        option proto 'esp'
        option target 'ACCEPT'

config rule
        option name 'Allow-ISAKMP'
        option src 'wan'
        option dest 'lan'
        option dest_port '500'
        option proto 'udp'
        option target 'ACCEPT'

Didnt add wifi because i dont use it. Thank you

Your setup is ideal without any tuning.
Say 144fps you need to add 7ms latency to skip/compensate a frame, which means when game state transferred exceeds 200Mbps/144 ~150kB you skip frames, lower frame rate if permissible and it will get less often into situations with dropped frame.

Alright, i trust your word. How would i be able to add/edit latency into my connection through ssh,also how much lantecy is needed for 240hz? Sorry but i really want to learn these things. Thanks again.

Maybe I'm getting old..

But which games does online state refresh and sync with 240 Hz?

Or do you use cloud gaming? But here I would have guessed that it's caped at 144 max.

Back in the days i.e. with CS the server used a fix rate nevertheless what each client reported.... I'm just curious what you want to actually achieve here.

My bad probably i misunderstood it. Im not sure whats the best approach but simply put i have this weird microstutter every time a player looks at you, thats why i thought first place that it has to do something with the firewall or how packets are processed.