<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.nftables.org/wiki-nftables/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mate</id>
	<title>nftables wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.nftables.org/wiki-nftables/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mate"/>
	<link rel="alternate" type="text/html" href="http://wiki.nftables.org/wiki-nftables/index.php/Special:Contributions/Mate"/>
	<updated>2026-05-13T19:19:02Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>http://wiki.nftables.org/wiki-nftables/index.php?title=Setting_packet_metainformation&amp;diff=317</id>
		<title>Setting packet metainformation</title>
		<link rel="alternate" type="text/html" href="http://wiki.nftables.org/wiki-nftables/index.php?title=Setting_packet_metainformation&amp;diff=317"/>
		<updated>2018-05-04T22:03:05Z</updated>

		<summary type="html">&lt;p&gt;Mate: /* mark and conntrack mark */ fixed mark setting example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You can set some metainformation in a packet: one of mark, priority or nftrace.&lt;br /&gt;
&lt;br /&gt;
Please note that you require a Linux kernel &amp;gt;= 3.14 to use these features.&lt;br /&gt;
&lt;br /&gt;
== mark ==&lt;br /&gt;
The following example shows how to set the packet mark:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
% nft add rule route output mark set 123&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== mark and conntrack mark ==&lt;br /&gt;
&lt;br /&gt;
You can save/restore conntrack mark like in iptables.&lt;br /&gt;
&lt;br /&gt;
In this example, the nf_tables engine set the packet mark to 1. &lt;br /&gt;
In the last rule, that mark is store in the conntrack entry associated with the flow:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
% nft add rule filter forward meta mark set 1&lt;br /&gt;
% nft add rule filter forward ct mark set mark&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, the conntrack mark is stored in the packet.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
% nft add rule filter forward meta mark set ct mark&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== priority ==&lt;br /&gt;
You can set the priority of a packet.&lt;br /&gt;
&lt;br /&gt;
This example shows a similar operation to what &amp;quot;-j CLASSIFY&amp;quot; does in iptables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
% nft add table mangle&lt;br /&gt;
% nft add chain postrouting {type route hook output priority -150\; }&lt;br /&gt;
% nft add rule mangle postrouting tcp sport 80 meta priority set 1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Warning&#039;&#039;&#039;: There is a bug in the priority syntax that will be fixed in following versions of nftables.&lt;br /&gt;
&lt;br /&gt;
== nftrace ==&lt;br /&gt;
&lt;br /&gt;
Setting nftrace in a packet will report the journey through the nf_tables stack.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
% nft add rule filter forward udp dport 53 meta nftrace set 1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== combination of options ==&lt;br /&gt;
&lt;br /&gt;
Given the flexible design of nftables, remember you can perform several actions to a packet in one rule:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
% nft add rule filter forward ip saddr 192.168.1.1 meta nftrace set 1 meta priority set 2 meta mark set 123&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mate</name></author>
	</entry>
</feed>