How to get your RV Wifi Online

Quick and Easy Raspberry Pi RV Wifi Router to Get Your RV Online

 

These instructions are a compilation of a few different tutorials with some side notes as well for creating your RV wifi router.  This is one of many possible solutions to solve the need for mobile internet on the go whether you are a full time RV’er or not.  The original idea was brought about by the need for consistent internet within the RV and I wanted to do it in an RV smart fashion.

On a quick note, this took me about 10 tries to get right and there were a handful of road blocks on the way as well so hopefully you can learn from my mistakes!

Preparation

 

If you have not already you want to install the heat sinks onto the board before you put the RasPi all together.

RasPi Wifi Router

Take the little sticky off of the heatsink and place it on the applicable chipset (bigger heatsink goes on the bigger chip).  After that go ahead and put the kit together leaving the SD card out for now.

Where’s my Head??

 

First thing is that the RasPi kit that I picked up came pre-loaded with NOOBS.  Unfortunately they stopped allowing a headless start up on this and of course I have no USB keyboard or mouse around anymore!  So the first challenge was getting SSH access to the RasPi on startup.  I went on over to raspberrypi.org and downloaded the lite load.

Typically I would flash the SD card through terminal on OS X, but a few years back I accidentally wiped out my laptop so I have since started using this software (Free!!) Etcher to flash the SD card with the img.  This is exceptionally simple.  However that in itself does not fix the headless start up issue.  After you flash the SD card mount it on your machine, there should be two volumes mounted.  The smaller “boot” partition is what we are going to be changing a bit.

All we need to do here is, if using CLI, change directory to the root directory on the boot partition and punch in the following:

touch ssh

Easy right? Go ahead and unmount the drive and pop the SD card into the RasPi.

Instructions

 

I’m going to be honest here, I definitely did not take enough notes on this and I am in no way trying to reinvent the wheel! But the two links that I am including are what got me through this mess after hours of pouring over other material.

Step 1: 10 minute instructions is where I started, this guide will get you a nice web UI to administer the Raspberry Pi Wifi Router as well. Nothing too complicated there, but that is not the end of the tutorial and you will not have full functionality so do not stop there.

Step 2: Access Point part 1 There is some overlap between these two what you want to focus on here is the configuration files. At this point hostapd should already be installed from step 1 and it should be noted I am using the on board wifi chipset.

The RasPi’s are a little bit tricky, I found, with assigning a static IP. You likely can do this in the typical /etc/network/interfaces file but out of the box it seems to rely on /etc/dhcpcd.conf more so.

I injected this into /etc/dhcpdcd.conf just right at the top works fine.

interface wlan0
static ip_address=10.0.0.1/24
static routers=10.0.0.1
static domain_name_servers=8.8.8.8 8.8.4.4

This is my /etc/hostapd/hostapd.conf file contents which sets your hotspot name, pass, etc.

driver=nl80211
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
beacon_int=100
auth_algs=1
wpa_key_mgmt=WPA-PSK
ssid=YOUR SSID
channel=1
hw_mode=g
wpa_passphrase=YOUR PASSWORD
interface=wlan0
wpa=2
wpa_pairwise=TKIP
country_code=US

Next configuration file to note is /etc/dnsmasq.conf

interface=wlan0
dhcp-range=10.0.0.50,10.0.0.255,255.255.255.0,12h
dhcp-option=3,10.0.0.1

Basically the above is telling dnsmasq which interface to serve DHCP to and what the range is.

Now you may think that we are done…but no!

Step 3: There is not a whole lot left to do to get this Raspberry Pi Wifi Router online but this is important so pay attention. Edit the /etc/sysctl.conf and uncomment the following line: #net.ipv4.ip_forward=1 and then run sysctl -p to reload the file.

Next up: Firewall!

First thing run the following to install iptables-persistent so the rules do not flush every reboot.

sudo apt-get install iptables-persistent

This is my configuration for /etc/iptables/rules.v4 it is lax on the filtering at the present but once I get this all set up I will definitely be correcting this.

# Generated by iptables-save v1.6.0 on Thu Jan 4 05:16:53 2018
*nat
:PREROUTING ACCEPT [1343:166913]
:INPUT ACCEPT [401:28838]
:OUTPUT ACCEPT [385:25296]
:POSTROUTING ACCEPT [1:328]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Thu Jan 4 05:16:53 2018
# Generated by iptables-save v1.6.0 on Thu Jan 4 05:16:53 2018
*filter
:INPUT ACCEPT [390:53356]
:FORWARD ACCEPT [34702:37259388]
:OUTPUT ACCEPT [413:29123]
-A INPUT -i lo -j ACCEPT
-A INPUT -i wlan0 -j ACCEPT
-A FORWARD -i wlan0 -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o wlan0 -j ACCEPT
COMMIT
# Completed on Thu Jan 4 05:16:53 2018
# Generated by iptables-save v1.6.0 on Thu Jan 4 05:16:53 2018
*mangle
:PREROUTING ACCEPT [65506:41756910]
:INPUT ACCEPT [1296:115941]
:FORWARD ACCEPT [64098:41614653]
:OUTPUT ACCEPT [1068:112539]
:POSTROUTING ACCEPT [65168:41727256]
-A POSTROUTING -j TTL –ttl-set 65

COMMIT
# Completed on Thu Jan 4 05:16:53 2018

After that reload iptables or restore using iptables-restore -c < /your/directory/your_file and the rules should be all set. You can check by running iptables -L -n to list out your rules without doing DNS checks (this is handy when you are dealing with massive iptables).

The-A POSTROUTING -j TTL –ttl-set 65 at the end will change the TTL value on outgoing traffic to look like mobile traffic.  Some carriers will look at traffic with higher TTL as hotspot traffic and throttle the bandwidth.

Wrapping Up

 

As a general rule I would give the Raspberry Pi RV wifi router a reboot before calling it quits with: sudo shutdown now -r

Once it cycles back up your hotspot should start itself and iptables should load as planned next thing is just connect it and go!

I have the on board eth port plugged into that NetGear LB1120 I picked up a couple weeks back.  Before you go and buy that though you should know it does not work on CDMA networks! I ended up having to go via T-Mo but I got a pretty killer deal $70/month unlimited LTE and that’s the only device I have T-Mobile service on.

Ok time to stop talking…if you have any issues with your Raspberry Pi RV wifi router let me know below and I’ll do my best to help out!

But Wait There is More to RV Wifi…

Shortly after getting all this up and running I realized that the on-board wifi chipset is just not equipped to handle this sort of abuse.  That being said I had to find a supplementary RV Smart solution to augment the Raspberry Pi RV wifi router.  See the new addition here.