{"id":917,"date":"2013-04-16T20:43:45","date_gmt":"2013-04-17T00:43:45","guid":{"rendered":"https:\/\/infotechguy.net\/?p=917"},"modified":"2025-02-22T13:14:39","modified_gmt":"2025-02-22T18:14:39","slug":"multiple-access-points-over-802-1q-using-openwrtpart2","status":"publish","type":"post","link":"https:\/\/infotechguy.net\/?p=917","title":{"rendered":"OpenWRT &#8212; Multiple Access Points With 802.1Q (part2)"},"content":{"rendered":"<p>Welcome back!<\/p>\n<p>In the last part, part 1, we configured our OpenWRT device, got it to emit two(2) Access Point SSIDs (insecureWiFi &amp; secureWiFi), created two(2) VLANs to separate traffic frames, and created a trunk to our PoweConnect switch! Wow!<br \/>\nFor this part, <strong>part 2<\/strong>, we will be creating another VLAN Trunk from our Dell PowerConnect switch to our Linux router, designing and configuring some Firewall rules.<br \/>\n<!--more--><br \/>\nNow, back to our topology&#8230;.<\/p>\n<h3>Topology<\/h3>\n<p><a href=\"http:\/\/s6.postimg.org\/edzl0ay9t\/Open_WRT_802_1_Q.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/s6.postimg.org\/edzl0ay9t\/Open_WRT_802_1_Q.png\" alt=\"\" \/><\/a><a href=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Open-WRT-802-1-Q.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3512\" src=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Open-WRT-802-1-Q-300x172.png\" alt=\"\" width=\"600\" height=\"344\" srcset=\"https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Open-WRT-802-1-Q-300x172.png 300w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Open-WRT-802-1-Q-1024x586.png 1024w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Open-WRT-802-1-Q-768x439.png 768w, https:\/\/infotechguy.net\/wp-content\/uploads\/2021\/03\/Open-WRT-802-1-Q.png 1197w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<h3>Creating the 802.1Q Trunk Link<\/h3>\n<ol>\n<li>\n<h4>Installing and Configuring VLANs on Linux<\/h4>\n<p>I am using a home based Linux router, running Ubuntu 12.04 server. Here is where I run my IPTABLES and firwall rules. Look back at our topology diagram. Do you see the Trunk between the Dell PowerConnect switch and the IPTABLES firewall? Great, we need to prepare each side of the Trunk link. Let&#8217;s start with the Linux IPTABLES side.<\/p>\n<p><strong>NOTICE: eth1<\/strong> <em>is the physical interface of the Trunk link.<br \/>\n<\/em><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo apt-get install vlan<\/pre>\n<p>Load the 802.1Q module<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo modprobe 8021q<\/pre>\n<p>Have the module automatically load on startup by adding <strong>&#8220;8021q&#8221;<\/strong> at the end of the <strong>\/etc\/modules<\/strong> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo echo \"8021q\" &gt;&gt; \/etc\/modules<\/pre>\n<\/li>\n<li>\n<h4>Adding VLANs to our eth0 interface<\/h4>\n<p>The next step will add the VLAN tags to the eth1 interface, so we must specify 100 and 110. Once we add the first VLAN tag the interface will be converted into a Trunk interface.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo vconfig add eth1 100 \r\nsudo vconfig add eth1 110 \r\nifconfig<\/pre>\n<p>You should see two(2) new interfaces called <strong>eth1.100 and eth1.110<\/strong>. Seem familar? It&#8217;s because back when we did it under OpenWRT, it was linux too!<\/li>\n<li>\n<h4>Adding IPs to each VLAN interface<\/h4>\n<p>I am picking the first host address in each subnet, remember our subnets are 192.168.0.0\/24 and 192.168.1.0\/24.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo ip addr add 192.168.0.1 eth1.100 \r\nsudo ip addr add 192.168.1.1 eth1.110<\/pre>\n<p>Let&#8217;s also add these address to the \/etc\/network\/interfaces config, so they will remain permanant.<br \/>\nIn your \/etc\/network\/interfaces add:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">auto eth1.100\r\niface eth1.100 inet static\r\n        address 192.168.0.1\r\n        netmask 255.255.255.0\r\n        network 192.168.0.0\r\n        broadcast 192.168.0.255\r\n        vlan_raw_device eth1\r\n\r\nauto eth1.110\r\niface eth1.110 inet static\r\n        address 192.168.1.1\r\n        netmask 255.255.255.0\r\n        network 192.168.1.0\r\n        broadcast 192.168.1.255\r\n        vlan_raw_device eth1\r\n<\/pre>\n<p><strong>NOTICE:<\/strong> <em>vlan_raw_device<\/em>, denotes the physical interface to bind\/attach itself to.<\/li>\n<li>\n<h4>Creating Trunk Link on PowerConenct<\/h4>\n<p>We did this in part 1, so quickly create a Trunk link on port<strong> g21<\/strong>. g21 is connected to eth1 on our Linux router.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"> SW1 configure<\/pre>\n<p>SW1(config) interface ethernet g21<\/p>\n<p>SW1(config-if) switchport mode trunk<br \/>\nswitchport trunk allowed 100<br \/>\nswitchport trunk allowed 110<\/li>\n<\/ol>\n<h3>Basic IPTABLES<\/h3>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>We now have to give both networks Internet access, but deny the insecure network(192.168.1.0\/24) to our secure network (192.168.0.0\/24). Assume for this tutorial that on our Linux Router, the eth0 interface is a public interface.<\/ol>\n<\/li>\n<\/ol>\n<p>On the Linux Router&#8230;<\/p>\n<ol>\n<li>\n<h4>Allow Secure to Insecure Network<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">iptables -I FORWARD -s 192.168.0.0\/24 -d 192.168.1.0\/24 -p all -j ACCEPT<\/pre>\n<\/li>\n<li>\n<h4>Deny Insecure to Secure Network<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">iptables -A FORWARD -s 192.168.1.0\/24 -d 192.168.0.0\/24 -p all -j DROP<\/pre>\n<\/li>\n<li>\n<h4>Masquerade Internet bound traffic<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">iptables -t nat -A POSTROUTING -s 192.168.0.0\/24 -o eth0 -j MASQUERADE \r\niptables -t nat -A POSTROUTING -s 192.168.1.0\/24 -o eth0 -j MASQUERADE<\/pre>\n<p><strong>NOTICE: <\/strong><em>This will allow full Internet access for both networks. You may want to filter your Insecure network to only HTTP and HTTPS.<\/em><\/li>\n<\/ol>\n<h3>Verifying It All Works<\/h3>\n<ol>\n<li>\n<h4>Set OpenWRT IPs<\/h4>\n<p>Log back onto the OpenWRT Web Configuration page. Browse to the Insecure Interface and make sure it has an IP address set on the 192.168.0.0\/24 network, next do the same thing for the Secure Interface. For my example OpenWRT has an IP address of <strong>192.168.0.2 on the Secure network<\/strong> and <strong>192.168.1.2 on the Insecure network<\/strong>.<\/li>\n<li>\n<h4>Try to Ping each IP<\/h4>\n<p>Try to ping each IP <strong>192.168.0.2 and 192.168.1.2<\/strong> from an end user device on the Secure network. My laptop has an IP of 192.168.0.155. I get a 100% echo response from both OpenWRT IPs. This will verify that our new Trunk and our routing is working, since the Linux router needs to route from 192.168.0.0 to 192.168.1.0 networks.<\/li>\n<li>\n<h4>Connecting Wirelessly<\/h4>\n<p>Go ahead and set a static IP address or use OpenWRTs DHCP feature, to assign an insecure network IP. Such as 192.168.1.54. Try to ping a computer on the Secure network. Does it reply? If so, recheck your IPTABLES. Else, try to ping an outside website or Google at 8.8.8.8. Do a traceroute. Does it receive a response? Awesome!<\/li>\n<\/ol>\n<h3>Congrats!!! You have two working Access Points using one Wireless Router!!<\/h3>\n<h4>See <a title=\"Multiple Access Points Over 802.1Q using OpenWRT(part1)\" href=\"https:\/\/infotechguy.net\/multiple-access-points-over-802-1q-using-openwrtpart1\/\">part 1<\/a>, <a title=\"Multiple Access Points Over 802.1Q using OpenWRT(part2)\" href=\"https:\/\/infotechguy.net\/multiple-access-points-over-802-1q-using-openwrtpart2\/\">part 2<\/a><\/h4>\n<p>Sources:<\/p>\n<ul>\n<li><a title=\"WNDR3700\" href=\"http:\/\/www.netgear.com\/home\/products\/wirelessrouters\/high-performance\/wndr3700.aspx\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.netgear.com\/home\/products\/wirelessrouters\/high-performance\/wndr3700.aspx<\/a><\/li>\n<li><a href=\"https:\/\/openwrt.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">OpenWRT<\/a><\/li>\n<li><a href=\"http:\/\/wiki.openwrt.org\/toh\/netgear\/wndr3700\" target=\"_blank\" rel=\"noopener noreferrer\">OpenWRT WNDR3700 Wiki page<\/a><\/li>\n<li><a href=\"http:\/\/etherealmind.com\/basics-cisco-ios-native-vlans\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/etherealmind.com\/basics-cisco-ios-native-vlans\/<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Welcome back! In the last part, part 1, we configured our OpenWRT device, got it to emit two(2) Access Point SSIDs (insecureWiFi &amp; secureWiFi), created two(2) VLANs to separate traffic frames, and created a trunk&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":4272,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[141],"tags":[112,129],"class_list":["post-917","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-openwrt","tag-security-2","tag-wifi"],"_links":{"self":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts\/917","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=917"}],"version-history":[{"count":2,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts\/917\/revisions"}],"predecessor-version":[{"id":4273,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/posts\/917\/revisions\/4273"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=\/wp\/v2\/media\/4272"}],"wp:attachment":[{"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infotechguy.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}