According to wikipedia:
... class of service (CoS) is a 3-bit field called the Priority Code Point (PCP) within an Ethernet frame header when using VLAN tagged frames as defined by IEEE 802.1Q. It specifies a priority value of between 0 and 7 inclusive that can be used by QoS disciplines to differentiate traffic.
I have an internet-facing linux router that i needed to configure this on; and while i see some content for various consumer firewalls, i havent seen much on how to configure this on linux.
With a vlan device vlan_enp4s0
configured using systemd-networkd:
# cat /etc/systemd/network/02_vlan_dhcp_client_hw.network
[Match]
Name=enp4s0
[Network]
VLAN=vlan_enp4s0
[Link]
ActivationPolicy=always-up
RequiredForOnline=no
# cat /etc/systemd/network/02_vlan_dhcp_client.netdev
[NetDev]
Name=vlan_enp4s0
Kind=vlan
[VLAN]
Id=2
one can then set the egress CoS:
vconfig set_egress_map vlan_enp4s0 0 3
A good way to run something like this on boot in modern linux is with networkd-dispatcher
:
apt install networkd-dispatcher
systemctl enable networkd-dispatcher
echo "vconfig set_egress_map vlan_enp4s0 0 3" > /etc/networkd-dispatcher/routable.d/egress_cos.sh