{"id":117,"date":"2018-01-07T15:00:19","date_gmt":"2018-01-07T15:00:19","guid":{"rendered":"https:\/\/www.kuncar.net\/blog\/?p=117"},"modified":"2018-01-07T16:04:41","modified_gmt":"2018-01-07T16:04:41","slug":"using-vconfig-to-set-vlan-tagged-interface-with-802-1p-cos-priority-bits-set","status":"publish","type":"post","link":"https:\/\/www.kuncar.net\/blog\/2018\/using-vconfig-to-set-vlan-tagged-interface-with-802-1p-cos-priority-bits-set\/","title":{"rendered":"Using vconfig to set vlan tagged interface with 802.1p CoS priority bits set"},"content":{"rendered":"<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-120\" src=\"https:\/\/www.kuncar.net\/blog\/wp-content\/uploads\/2018\/01\/tux-150x150.png\" alt=\"\" width=\"150\" height=\"150\" srcset=\"https:\/\/www.kuncar.net\/blog\/wp-content\/uploads\/2018\/01\/tux-150x150.png 150w, https:\/\/www.kuncar.net\/blog\/wp-content\/uploads\/2018\/01\/tux-150x150-100x100.png 100w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/>This is just quick how-to on setting up vlan interface on a Linux system. As this is in lengths described elsewhere I will stick just to the commands and brief explanations.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">The first thing to do is to get the \u201cvlan\u201d package as it is not normally installed. The other bit is the 8021q kernel module which is not normally loaded but is present on Debian-based systems by defualt.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">Checking the state of the module:<\/span><\/p>\n<pre><em><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">lsmod | grep 8021q<\/span><\/em><\/pre>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">if this will return empty result you must load the module using mordprobe<\/span><\/p>\n<pre><em><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">modprobe 8021q<\/span><\/em><\/pre>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">and verify again with lsmod as before.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">Now the system is ready to get new tagged interfaces<\/span><\/p>\n<pre><em><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">vconfig add eth0 X<\/span><\/em><\/pre>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">Where eth0 is your physical interface and X is the VLAN ID you want the new interface to be tagged with. The command will have an output saying that interface eth0.X has been created. This is great but you also must now somehow specify what pbit setting do you want in there as by default egress traffic is by default priority 0. In order to make lets say ping ICMP packets marked with CoS we must create an egress map for the default priority (o) in which we will re-map it to whatever we want.<\/span><\/p>\n<pre><em><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">vconfig set_egress_map eth0.X 0 7<\/span><\/em><\/pre>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">In this example I have re-mapped the default priority 0 to egress priority 7<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">This setup can be made permanent by adding the module name in \/etc\/modules and adding the relevant lines in the interfaces file e.g.:<\/span><\/p>\n<pre><em><span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">auto eth0.100<\/span>\r\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">iface eth0.100 inet static<\/span>\r\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">address 192.168.100.1<\/span>\r\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">netmask 255.255.255.0<\/span>\r\n<span style=\"font-family: arial, helvetica, sans-serif; font-size: 14px;\">vlan-raw-device eth0<\/span><\/em><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is just quick how-to on setting up vlan interface on a Linux system. As this is in lengths described elsewhere I will stick just to the commands and brief explanations. The first thing to do is to get the \u201cvlan\u201d package as it is not normally installed. The other bit is the 8021q kernel &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.kuncar.net\/blog\/2018\/using-vconfig-to-set-vlan-tagged-interface-with-802-1p-cos-priority-bits-set\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Using vconfig to set vlan tagged interface with 802.1p CoS priority bits set&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,13],"tags":[],"class_list":["post-117","post","type-post","status-publish","format-standard","hentry","category-linux","category-recovered"],"_links":{"self":[{"href":"https:\/\/www.kuncar.net\/blog\/wp-json\/wp\/v2\/posts\/117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kuncar.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kuncar.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kuncar.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kuncar.net\/blog\/wp-json\/wp\/v2\/comments?post=117"}],"version-history":[{"count":7,"href":"https:\/\/www.kuncar.net\/blog\/wp-json\/wp\/v2\/posts\/117\/revisions"}],"predecessor-version":[{"id":126,"href":"https:\/\/www.kuncar.net\/blog\/wp-json\/wp\/v2\/posts\/117\/revisions\/126"}],"wp:attachment":[{"href":"https:\/\/www.kuncar.net\/blog\/wp-json\/wp\/v2\/media?parent=117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kuncar.net\/blog\/wp-json\/wp\/v2\/categories?post=117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kuncar.net\/blog\/wp-json\/wp\/v2\/tags?post=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}