====== Assigning priorities according to the protocols ======
{{indexmenu_n>3}}
The protocol priorities (assigned by system administrator) are loaded by DPI from the file **/etc/dpi/protocols.dscp.**
This file is created in two steps: first one creates a text file with the list of protocols and their priorities. Second, it is converted into an internal format by a special utility.
To apply the changes you need to the DPI configuration with the following command:
service fastdpi reload
===== The file format of protocols and priorities list: =====
Each line contains the protocol name, then space, then dscp value. **For example:**
dns 0x3F
skype drop
compressnet 010
ftp keep
http cs0
default keep
[[dpi:dpi_options:opt_statistics:statistics_info|Full list of protocols.]]\\
DSCP value is specified as [[dpi:dpi_options:opt_priority:dscp_table|decimal, hex or octal number or as a text abbreviation]].
Keywords meaning:
* drop - indicates that packets must not be transmitted further. They must be dropped.
* keep - shows that priority must keep its current value (typically 0).
* default - means "for all remaining protocols" and allows to simplify significantly making the configuration file.
To ensure that the ''drop'' action is applied only after TLS has been parsed and the SNI has been determined, you must add the parameter ''smartdrop = 1'' to ''fastdpi.conf''. This means that if ''drop'' is specified for a protocol, the action will be deferred until TLS has been parsed or a TLS parsing error occurs. This is a hot parameter; simply reload the configuration.
===== Configuring Traffic Classification =====
1. Create a file named **protocols.txt** containing a list of the protocol groups we want to filter out from general traffic, along with their assigned priorities (classes):
dns cs0
ICMP cs0
http cs0
https cs0
QUIC cs1
default cs2
bittorrent cs7
where
* cs0 corresponds to priority 0, class 0, respectively
* cs1 corresponds to priority 1, class 1
* cs7 corresponds to priority 7, the lowest class
This marking is taken into account in class-based policing rules.
2. Convert it to the DSCP format, which fastDPI understands
cat protocols.txt|lst2dscp /etc/dpi/protocols.dscp
You can add comments (#) and blank lines to the input files of the lst2dscp utility.
3. Apply the settings
service fastdpi reload
When moving settings to the working directory after saving a configuration backup, you must perform a reload after the move:
mv protocols.dscp /etc/dpi/protocols.dscp
Use only the mv command — it is atomic; do not use copying