Ultimate SQM settings: Layer_cake + DSCP marks

ipt="iptables -t mangle"
$ipt -A mark_DSCP_ul \
		-p udp \
		-m multiport --dports 1024:65535 \
		-m connmark ! --mark 0x30/0xf0 \
		-m connbytes \
			--connbytes :128 \
			--connbytes-dir original \
			--connbytes-mode avgpkt \
		-m connbytes \
			--connbytes :512 \
			--connbytes-dir reply \
			--connbytes-mode avgpkt \
		-m hashlimit \
			--hashlimit-above 15 \
			--hashlimit-mode srcip,srcport \
			--hashlimit-srcmask 32 \
			--hashlimit-name "mark_game_above" \
		-m hashlimit \
			--hashlimit-upto 128 \
			--hashlimit-mode srcip,srcport \
			--hashlimit-srcmask 32 \
			--hashlimit-name "mark_game_upto" \
		-j CONNMARK --set-xmark 0x50/0xf0 \
		-m comment --comment "Realtime Interactive: Games, match upload traffic, tickrate 15(PUBG)-128(CSGO)"

$ipt -A PREROUTING -m conntrack --ctstate RELATED,ESTABLISHED -m connmark ! --mark 0xf0/0xf0 -m connmark ! --mark 0x60/0xf0 -m connmark ! --mark 0x70/0xf0 -m statistic --mode random --probability 0.005 -j CONNMARK --and-mark 0xff0f
$ipt -A PREROUTING -i br-lan -m connmark --mark 0x0/0xf0 -j mark_DSCP_ul

$ipt -A PREROUTING -m connmark --mark 0x50/0xf0 -j DSCP --set-dscp-class CS4

My iptables rule to match the game traffic. Connmark, connbytes and hashlimit are used. LOL tested.

1 Like