{"id":3312,"date":"2022-12-20T17:02:18","date_gmt":"2022-12-20T20:02:18","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/vlan-manipulation-action-in-tc-man8\/"},"modified":"2022-12-20T17:02:18","modified_gmt":"2022-12-20T20:02:18","slug":"vlan-manipulation-action-in-tc-man8","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/vlan-manipulation-action-in-tc-man8\/","title":{"rendered":"VLAN manipulation action in tc (man8)"},"content":{"rendered":"<h1 align=\"center\">VLAN manipulation action in tc<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">vlan &#8211; vlan manipulation module<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:23%; margin-top: 1em\"><b>tc<\/b> &#8230; <b>action vlan<\/b> { <b>pop<\/b> | <b>pop_eth<\/b> | <i>PUSH<\/i> | <i>MODIFY<\/i> | <i>PUSH_ETH<\/i> } [ <i>CONTROL<\/i> ]<\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><i>PUSH<\/i> := <b>push<\/b> [ <b>protocol<\/b> <i>VLANPROTO<\/i> ] <b>[<\/b> priority <i>VLANPRIO<\/i> ] <b>id<\/b> <i>VLANID<\/i><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><i>MODIFY<\/i> := <b>modify<\/b> [ <b>protocol<\/b> <i>VLANPROTO<\/i> ] <b>[<\/b> priority <i>VLANPRIO<\/i> ] <b>id<\/b> <i>VLANID<\/i><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><i>PUSH_ETH<\/i> := <b>push_eth dst_mac<\/b> <i>LLADDR<\/i> <b>src_mac<\/b> <i>LLADDR<\/i><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><i>CONTROL<\/i> := { <b>reclassify<\/b> | <b>pipe<\/b> | <b>drop<\/b> | <b>continue<\/b> | <b>pass<\/b> | <b>goto chain CHAIN_INDEX<\/b> }<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>vlan<\/b> action allows to perform 802.1Q en- or decapsulation on a packet, reflected by the operation modes <i>POP<\/i>, <i>PUSH<\/i> and <i>MODIFY<\/i>. The <i>POP<\/i> mode is simple, as no further information is required to just drop the outer-most VLAN encapsulation. The <i>PUSH<\/i> and <i>MODIFY<\/i> modes require at least a <i>VLANID<\/i> and allow to optionally choose the <i>VLANPROTO<\/i> to use.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>vlan<\/b> action can also be used to add or remove the base Ethernet header. The <b>pop_eth<\/b> mode, which takes no argument, is used to remove the base Ethernet header. All existing VLANs must have been previously dropped. The opposite operation, adding a base Ethernet header, is done with the <b>push_eth<\/b> mode. In that case, the packet must have no MAC header (stacking MAC headers is not permitted). This mode is mostly useful when a previous action has encapsulated the whole original frame behind a network header and one needs to prepend an Ethernet header before forwarding the resulting packet.<\/p>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p style=\"margin-top: 1em\"><b>pop<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p style=\"margin-top: 1em\">Decapsulation mode, no further arguments allowed.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>push<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>Encapsulation mode. Requires at least <b>id<\/b> option.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>modify<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>Replace mode. Existing 802.1Q tag is replaced. Requires at least <b>id<\/b> option.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>pop_eth<\/b><\/p>\n<p style=\"margin-left:22%;\">Ethernet header decapsulation mode. Only works on a plain Ethernet header: VLANs, if any, must be removed first.<\/p>\n<p style=\"margin-left:11%;\"><b>push_eth<\/b><\/p>\n<p style=\"margin-left:22%;\">Ethernet header encapsulation mode. The Ethertype is automatically set using the network header type. Chaining Ethernet headers is not allowed: the packet must have no MAC header when using this mode. Requires the <b>dst_mac<\/b> and <b>src_mac<\/b> options.<\/p>\n<p style=\"margin-left:11%;\"><b>id<\/b> <i>VLANID<\/i><\/p>\n<p style=\"margin-left:22%;\">Specify the VLAN ID to encapsulate into. <i>VLANID<\/i> is an unsigned 16bit integer, the format is detected automatically (e.g. prefix with \u2019<b>0x<\/b>\u2019 for hexadecimal interpretation, etc.).<\/p>\n<p style=\"margin-left:11%;\"><b>protocol<\/b> <i>VLANPROTO<\/i><\/p>\n<p style=\"margin-left:22%;\">Choose the VLAN protocol to use. At the time of writing, the kernel accepts only <b>802.1Q<\/b> or <b>802.1ad<\/b>.<\/p>\n<p style=\"margin-left:11%;\"><b>priority<\/b> <i>VLANPRIO<\/i><\/p>\n<p style=\"margin-left:22%;\">Choose the VLAN priority to use. Decimal number in range of 0-7.<\/p>\n<p style=\"margin-left:11%;\"><b>dst_mac<\/b> <i>LLADDR<\/i><\/p>\n<p style=\"margin-left:22%;\">Choose the destination MAC address to use.<\/p>\n<p style=\"margin-left:11%;\"><b>src_mac<\/b> <i>LLADDR<\/i><\/p>\n<p style=\"margin-left:22%;\">Choose the source MAC address to use.<\/p>\n<p style=\"margin-left:11%;\"><i>CONTROL<\/i><\/p>\n<p style=\"margin-left:22%;\">How to continue after executing this action. <b><br \/> reclassify<\/b><\/p>\n<p style=\"margin-left:32%;\">Restarts classification by jumping back to the first filter attached to this action\u2019s parent.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>pipe<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>Continue with the next action, this is the default.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>drop<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>Packet will be dropped without running further actions.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:22%;\"><b>continue<\/b><\/p>\n<p style=\"margin-left:32%;\">Continue classification with next filter in line.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>pass<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>Return to calling qdisc for packet processing. This ends the classification process.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The following example encapsulates incoming ICMP packets on eth0 from 10.0.0.2 into VLAN ID 123:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">#tc qdisc add dev eth0 handle ffff: ingress <br \/> #tc filter add dev eth0 parent ffff: pref 11 protocol ip <\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>u32 match ip protocol 1 0xff flowid 1:1 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>match ip src 10.0.0.2 flowid 1:1 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>action vlan push id 123<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">Here is an example of the <b>pop<\/b> function: Incoming VLAN packets on eth0 are decapsulated and the classification process then restarted for the plain packet:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">#tc qdisc add dev eth0 handle ffff: ingress <br \/> #tc filter add dev $ETH parent ffff: pref 1 protocol 802.1Q <\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>u32 match u32 0 0 flowid 1:1 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>action vlan pop reclassify<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">For an example of the <b>pop_eth<\/b> and <b>push_eth<\/b> modes, see <b>tc-mpls<\/b>(8).<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>tc<\/b>(8), <b>tc-mpls<\/b>(8)<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  vlan &#8211; vlan manipulation module <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5,52,4,442],"class_list":["post-3312","post","type-post","status-publish","format-standard","hentry","category-8-administracion-del-sistema","tag-5","tag-administracion","tag-man8","tag-tc-vlan"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=3312"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3312\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=3312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=3312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=3312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}