{"id":803,"date":"2013-03-11T15:22:58","date_gmt":"2013-03-11T19:22:58","guid":{"rendered":"https:\/\/infotechguy.net\/?p=803"},"modified":"2025-02-22T11:30:51","modified_gmt":"2025-02-22T16:30:51","slug":"inter-vlan-routing-with-linux-powerconnect-5324","status":"publish","type":"post","link":"https:\/\/infotechguy.net\/?p=803","title":{"rendered":"Linux &#8212; Inter-VLAN routing with PowerConnect 5324"},"content":{"rendered":"<p>I recently purchased a 24-port Gigabit Layer 2 Switch that supports VLAN tagging and trunking. Dell PowerConnect 5324, see here, has 24 Ethernet ports and is capable of tagging and untagging Frames at wire speed. It is a discontinued model, however doing some googling I found a updated firmware and IOS image!<\/p>\n<h3>Physical Topology<\/h3>\n<p>The topology is pretty typical of &#8220;routing-on-a-stick&#8221; for Multiple VLANs. I have a Linux server running Ubuntu 12.04 with a single NIC and the Dell PowerConnect switch.<\/p>\n<p><b>Port configuration:<\/b><br \/>\nNetwork 1 = g1 &#8211; g16<br \/>\nNetwork 2 = g17 -g23<\/p>\n<p><strong>802.1q Information:<\/strong><br \/>\nSwitch Trunk Port = g24<br \/>\nRouter Trunk Port = eth1<\/p>\n<p><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Multi-VLAN.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3526\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Multi-VLAN-300x204.png\" alt=\"\" width=\"601\" height=\"409\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Multi-VLAN-300x204.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Multi-VLAN.png 579w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/a><\/p>\n<h3>Logical Topology<\/h3>\n<p>I have a single LAN I want logically separated using a single switch. The VLAN IDs are 100 &amp; 200. The VLAN subnets and ports will be as follows;<\/p>\n<p><strong>Subnets:<\/strong><br \/>\nVLAN 100 = 192.168.1.1\/24<br \/>\nVLAN 200 = 192.168.2.1\/24<\/p>\n<p><strong>VLAN Access Ports:<\/strong><br \/>\nVLAN 100 = g1 &#8211; g16<br \/>\nVLAN 200 = g17 -g23<\/p>\n<p><!--more--><br \/>\nNow before we continue with the configurations, I want to explain the differences between an <strong>Access Port<\/strong> and a <strong>Trunk Port<\/strong> when using VLANs. An access port is 99% of the time connected to an end user device, such as a computer, Wireless AP, etc. A trunk port, is connected between network devices and carries multiple VLAN tagged Frames. A trunk link is what makes this setup possible, carrying VLAN 100 &amp; 200 Frames over one physical cable from the Linux Router to the Dell Switch.<\/p>\n<p>There is also the terminology of <strong>Tagging<\/strong> and <strong>Untagging<\/strong>. Tagging referes to the 802.1q (or Cisco&#8217;s ISL) Ethernet tagging of Frames as they enter a Access Port. Untagged is the opposite, this refers process to untagg Frames as they leave an Access Port. The tagging and untagging is VLAN ID specific, meaning you can&#8217;t tag a Frame with VLAN ID 100 and have VLAN ID 200 untag it. Also, Tagged Frames cannot be sent to end user devices, as the end user device will not know how to read the Frame. For our example, g1-g16, and g17-g23 are Access ports. Maintain these VLAN ID and Interface Port associations happens on the Switch itself, why Managed Switches are able to support VLANs and unmanaged Switches do not.<\/p>\n<p>When you run this command you are denoting a physical interface as an <strong>Access Port<\/strong> for VLAN 100, Frames leaving this interface will be Untagged from VLAN ID 100, and anything entering the interface tagged on VLAN ID 100.<\/p>\n<pre><code>console(config-if)# switchport access vlan 100 <\/code><\/pre>\n<p>Here is TCPDUMP showing the 802.1q header in an Ethernet Frame:<br \/>\n<a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/wireshark8021q.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3527\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/wireshark8021q-300x186.png\" alt=\"\" width=\"600\" height=\"372\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/wireshark8021q-300x186.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/wireshark8021q-768x475.png 768w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/wireshark8021q.png 1016w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>For more information on VLAN tagging see <a href=\"http:\/\/www.9tut.com\/virtual-local-area-network-vlan-tutorial\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<h3>Configure Switch<\/h3>\n<ol>\n<li>Add VLANs to VLAN Database on Switch\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">console# configure \nconsole(config)# vlan database \nconsole(config-vlan)# vlan 100 \nconsole(config-vlan)# vlan 200\nconsole# interface range ethernet g1,g2,g3,g4,g5,g6,g7,g8,g9,g10,g11,g12,g13,g14,g15,g16\nconsole# switchport mode access\nconsole# switchport access vlan 100\nconsole# interface range ethernet g17,g18,g19,g20,g21,g22,g23\nconsole# switchport mode access\nconsole# switchport access vlan 200\n<\/pre>\n<\/li>\n<li>Verify VLANs\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">console# show vlan\nVlan Name Ports Type Authorization\n---- ----------------- --------------------------- ------------ -------------\n1 1 g(17-24),ch(1-8) other Required\n100 Network1 g(1-16) permanent Required\n200 Network2 permanent Required\n<\/pre>\n<\/li>\n<li>Set IP on Network 1 (VLAN 100)\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">console# configure\nconsole(config)# interface vlan 100\nconsole(config-if)# ip address 192.168.1.2 255.255.255.0\n<\/pre>\n<\/li>\n<li>Lastly, set Trunk interface and the allowed VLANs to egress the Trunk link:\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">console# configure\nconsole# interface ethernet g24\nconsole# switchport mode trunk\nconsole# (config-if)# switchport trunk allowed vlan add all\n<\/pre>\n<p><strong>NOTICE:<\/strong> <em>The switch will spit back the current VLANs it knows about from it&#8217;s VLAN database. Therefore, if you add more VLANs to the database you will need to reissue this command to add the new VLANs to be allowed across the Trunk Link.<\/em><\/li>\n<li>Don&#8217;t forget to save!\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">console# copy startup-config running-config<\/pre>\n<\/li>\n<\/ol>\n<h3>Linux Router Configuration<\/h3>\n<ol>\n<li>Install VLAN package\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">apt-get install vlans<\/pre>\n<\/li>\n<li>Add the 8021q module to be in the startup modules\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">modprobe 8021q<\/pre>\n<p>Add 8021q mod to the bottom of \/etc\/modules<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">vi \/etc\/modules\n# \/etc\/modules: kernel modules to load at boot time.\n#\n# This file contains the names of kernel modules that should be loaded\n# at boot time, one per line. Lines beginning with \"# are ignored.\n\nloop\nlp\nrtc\n8021q\n<\/pre>\n<\/li>\n<li>Add VLANs to each Sub-Interfaces\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">vconfig add eth1 100\nvconfig add eth1 500<\/pre>\n<p><strong>NOTICE: <\/strong><em>The terminal will echo a information message telling you that eth1.100 and eth1.200 have been added. Run <strong>ifconfig<\/strong> and you&#8217;ll see them.<\/em><\/li>\n<li>Edit Network Interface Config\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">vi \/etc\/network\/interfacesm\nauto eth1.100\niface eth1.100 inet static\n        address 192.168.1.1\n        netmask 255.255.255.0\n        network 192.168.1.0\n        broadcast 192.168.1.255\n        vlan_raw_device eth1\n\nauto eth1.200\niface eth1.200 inet static\n        address 192.168.2.1\n        netmask 255.255.255.\n        network 192.168.2.0\n        broadcast 192.168.2.255\n        vlan_raw_device eth1\n<\/pre>\n<\/li>\n<li>If you want the two networks to talk to each other you need to enable IP forwarding on the Linux Router\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">echo \"1\" &gt; \/proc\/sys\/net\/ipv4\/ip_forward<\/pre>\n<\/li>\n<li>For good measure. Restart <strong>eth1<\/strong> on the Linux Router\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">\/etc\/init.d\/networking restart<\/pre>\n<\/li>\n<\/ol>\n<p>That&#8217;s It! The Linux Router is able to communicate with the Dell switch via an 802.1q Trunk Link.<\/p>\n<h3>How to Test<\/h3>\n<p>To test the VLANs are working and separating the Traffic based on the Access Ports, grab a Laptop and a Network cable. Configure your laptops local NIC to 192.168.1.5\/24. plug the cable into your laptop and any one of the g1-g16 ports. Try to ping another device on that network, such as 192.168.1 or .2. It works! Now lets test to make sure the VLANs are separating traffic, using the same ip of 192.168.1.5\/24 connect your laptop to any one fo the g17-g23 ports. Remember these ports are on a different LAN whos layer 3 network is 192.168.2.0\/24(this really doesn&#8217;t matter because we are dealing with Layer 2 only). Try to ping a device on the 192.168.1.0\/24 network. Hmm, doesn&#8217;t work&#8230;.That&#8217;s a Good thing! The reason is the VLAN separation going on in the switch. When you tried to ping 192.168.1.1 from 192.168.1.5(laptop) an Layer 2 broadcast went out to all ports VLAN, in this case VLAN 200. The broadcast did not cross into VLAN 100 because of the logical separation.<\/p>\n<p><em>A lot more is going on here, but is outside the scope of this article to be explained.<\/em><\/p>\n<p><strong>Sources:<\/strong><\/p>\n<ul>\n<li><a href=\"http:\/\/stevejenkins.com\/blog\/2011\/05\/dell-powerconnect-5324-setup-tasks\/\">http:\/\/stevejenkins.com\/blog\/2011\/05\/dell-powerconnect-5324-setup-tasks\/<\/a><\/li>\n<li><a href=\"http:\/\/ubuntuforums.org\/showthread.php?t=703387\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/ubuntuforums.org\/showthread.php?t=703387<\/a><\/li>\n<li><a href=\"http:\/\/www.9tut.com\/virtual-local-area-network-vlan-tutorial\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.9tut.com\/virtual-local-area-network-vlan-tutorial<\/a><\/li>\n<li><a href=\"http:\/\/www.linuxjournal.com\/article\/10821?page=0,2\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.linuxjournal.com\/article\/10821?page=0,2<\/a><\/li>\n<li><a href=\"http:\/\/wiki.hackspherelabs.com\/index.php?title=Dell_Powerconnect_5324\" target=\"_blank\" rel=\"noopener noreferrer\">Getting Started Wiki for Dell PowerConnect 5324<\/a><\/li>\n<li><a href=\"ftp:\/\/ftp.dell.com\/Manuals\/all-products\/esuprt_ser_stor_net\/esuprt_powerconnect\/powerconnect-5324_Reference%20Guide_en-us.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">Dell PowerConnect 5324 CLI Reference<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I recently purchased a 24-port Gigabit Layer 2 Switch that supports VLAN tagging and trunking. Dell PowerConnect 5324, see here, has 24 Ethernet ports and is capable of tagging and untagging Frames at wire speed.&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":4240,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[109],"class_list":["post-803","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-routing"],"_links":{"self":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts\/803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=803"}],"version-history":[{"count":2,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts\/803\/revisions"}],"predecessor-version":[{"id":4235,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts\/803\/revisions\/4235"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/media\/4240"}],"wp:attachment":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}