Configuring QoS with Managed Switch and OpenWrt

I have these two iptables

iptables -t mangle -A PREROUTING -p all --dst 192.168.1.18 -j DSCP --set-dscp-class CS5
iptables -t mangle -A PREROUTING -p all --src 192.168.1.18 -j DSCP --set-dscp-class CS5

in the firewall's custom rules and I've set Wireshark's display to filter to view to and from traffic to the PS4. I'm still seeing 0 in the DSCP column.

which port are you mirroring? you will only be able to see packets going to the PS4 with DSCP. packets coming from the PS4 and heading to the internet will have a different source IP because of NAT

TX and RX from ports 14 and 16 on the 24-port switch.

ok so packets from ingress to whichever of those two ports is your router's LAN with destination 192.168.1.18 should have DSCP = CS5

are you seeing that?

are you seeing that the DSCP rule is being hit in the firewall info tab on LUCI (Status > Firewall)?

I'm only seeing packets for the bottom rule


using these rules:-

iptables -t mangle -A PREROUTING -p all --dst 192.168.1.18 -j DSCP --set-dscp-class CS5
iptables -t mangle -A PREROUTING -p all --src 192.168.1.18 -j DSCP --set-dscp-class CS5

However, changing the top rule to POSTROUTING so the rules become:-

iptables -t mangle -A POSTROUTING -p all --dst 192.168.1.18 -j DSCP --set-dscp-class CS5
iptables -t mangle -A PREROUTING -p all --src 192.168.1.18 -j DSCP --set-dscp-class CS5

Wireshark shows DSCP CS5 with ip.dst == 192.168.1.18 set in the dispplay filters.

To see the DSCP packets PS4 > internet

On my 24-port switch I've set port 12 (the PS4) to Tx and set port 14 to Rx. With ip.addr == 123.456.789.010 (dummy public IP address) in Wireshark I'm able to see CS5 under the DSCP column.

Right, that make sense, NAT occurs after PREROUTING, so POSTROUTING is the appropriate place for the --dst rule

hello everybody i would make the rules directly in luci with traffic rules possible you think ?

and wan to lan

i don't know if i put squash and ignore dscp on my lan and not my wan ...

i use sqm on lan and wan to egress and ingress thanks in advance for your response

Good information in this topic to my setup but im using edgeswitch, at the moment i only see dscp tags on egress side..

Read and test :thinking: :joy:

I have try but i cant tag downstream

If anyone can help, tha acl as more settings but is hard to config, the diffserv is a lit simple but i cant set tag for downstream

Same here.

Here is my current setup on OpenWrt
Openwrt Interfaces:

Switch VLAN Setup:






Switch QoS Scheme:


Cable Logistics:

  • Port 1 on switch connects to Cable Modem VLAN20(WAN-eth0.20).
  • Port 2 on switch connects to Openwrt Modem VLAN1(Management-eth0.1) and VLAN10(LAN-eth0.10)
  • Port 3-24 LAN ports.

My question:

What are the best practices to configure QoS (either can be on switch or SQM with Openwrt)?

1 Like