Labels

Sunday, August 3, 2014

Resurrecting the 1-Port Router

I haven't looked through this project in a long time.  I thought that I might get my act together and at least approach the thought of making a 1-Port Router for myself.  I wanted to perform some experiments before I put it on the RPi that has the PiTFT display.  In addition, I wanted to try and see if there were any shortcomings with the Model B+.  I was fortunate to have two of them - no case for the B+ in sight at my friendly neighborhood Micro Center.

Anyway, I resurrected the Bud Box (the one with the RPi in it on the top of this page).  I figured since I wasn't using it I might put the B+ into it.  It turns out that if you trim the catch closest to the micro USB power input, it fits perfectly.

The micro USB is right up against the hold down tab.  I had removed about a quarter of an inch.  The new board fits just fine, even though it is slightly smaller and the corners are rounded.  I was able to get the RPi to talk just fine to two different VLANs (6 and 8) after following the instructions:

sudo apt-get update
sudo apt-get install vlan
sudo su
sudo echo "8021q" >> /etc/modules 
exit

After adding the 802.1q capability, I then modified the /etc/network/interfaces file to add the following two VLAN connections:

auto eth1
iface eth1 inet dhcp
post-up ifup vlan6
post-up ifup vlan8

iface vlan6 inet static
address <some_static_vlan6_ip_address>
netmask 255.255.255.0
vlan_raw_device eth1

iface vlan8 inet static
address <some_static_vlan8_ip_address>
netmask 255.255.255.0
vlan_raw_device eth1

In my particular case, I adjusted the GS108T switch to have only my VLAN6 and VLAN8 appearing as a tagged trunk on one port.  In addition, I have a separate USB to Ethernet adapter that I have plugged into the RPi B+.  I removed the Ethernet cable from the RPi B+ and plugged the other end of the Ethernet cable going from the USB to Ethernet adapter to the modified switch port.  Obviously, the <some_static_vlan6_ip_address> and <some_static_vlan8_ip_address> should be replaced with an IPv4 address on those VLANs.  After I added the VLAN items to the interfaces file, I rebooted and checked the connections by pinging known IP addresses on the VLAN6 and VLAN8 networks.  Once I got the results of the pings back, I knew that I had been successful.  So at this point, I have a 1-Port Ethernet connection which talks to two different VLANs in my house.

Update: Right now, my thoughts on the usefulness of this router center around providing a way for my Mac Mini to connect via firewalls to three different VLANs; the media VLAN, the experimental VLAN, and the Penetration Testing VLAN.  The router will allow only the Mac Mini to be able to connect to those VLANs and separate out each by firewalls, not allowing cross traffic of any kind between the VLANs.  I originally wanted to do this with a VM running on the Mac Mini, but I think this would be a far better way of accomplishing this.  I could also do this with an OpenWRT router, but I would prefer using the RPi.  I am thinking that I need to put in Shorewall to act as the router mechanism.  Shorewall is an iptables generator that provides an easy to understand way of accomplishing this.  This should be interesting.