Skip to content

Instructions – Installing The Router

Installing the router Raspberry Pi

The first Raspberry Pi we need to install is the router which is the Raspberry handling these tasks.

  • DHCP (Handling out IP addresses to the rest of the systems
  • NTP (We need a way to track time, the camera pods need to have as close to exacly the same time as possible)
  • DNS (All systems are addressed by there names in the Domain Name System)
  • IP Masquarade (Possibility to surf on the base station, this is optional)

Take your Raspberry Pi 3 (or better), insert the SD Card and HDMI Cable and boot it up.

Basic setup with raspi-config

Perform these steps to configure your router, text you need to enter is bold. The hostname for the router is set to vroute

Run raspi-config, which sets up basic parameters of your Raspberry Pi

sudo raspi-config

You are presented with a menu, perform these steps

1 System Options
   S4 Hostname
      vroute
   S5 Boot / Auto Login 
      B2 Console Autologin

3 Interface Options
   P2 SSH
      Yes

5 Localisation Options
   L2 Timezone
      None of the above
         UTC
   L3 Keyboard
      Your preferred keyboard layout
   L4 WLAN Country
      Your Country

6 Advanced Options
   A1 Expand Filesystem

8 Update

<Finish>

Reboot your Raspberry Pi to expand the filesystem

sudo reboot

After reboot upgrade your system to the latest packages

sudo apt update
sudo apt upgrade
sudo reboot

DHCP Configuration

DHCP is the protocol to assign IP addresses on a lan network. It is now time to configure the DHCP client of this Raspberry Pi. Even if this is the router which will assign IP to other computers using DHCP we will still keep it enabled on the router. This way if you put the router on your home network it will get an IP address so you can log into it, but at the field the router will be the one handing out addresses. We need to add a fallback to the dhcp configuration that enabled the router to assign a static IP whenever not on a network with another DHCP server.

The instructions are for 192.168.1.0/24 network, you can change as needed. It is not problem to use the same network as what you use at your home lan.

You will now need to edit text files on your Raspberry Pi, the easy to use editor nano is already installed, but of course, choose your weapon of choice if you are confident in Linux usage. If new to Linux nano is your best choice, start by reading how to use nano

The file we need to change is /etc/dhcpcd.conf

sudo nano /etc/dhcpcd.conf

Add these lines at the bottom of the file, this will make your raspberry assign it’s own IP address if no other DHCP server is found on the network.

profile static_eth0
static ip_address=192.168.1.50/24
interface eth0
fallback static_eth0

Installing Dnsmasq

Dnsmasq is a software that provide DHCP and DNS server for a small network such as ours, it handles the assignmend of IP addresses to the camera pods and host computers and also DNS names on the small lan we are building. Start of by installing Dnsmasq.

sudo apt install dnsmasq

We will now edit the /etc/dnsmasq.conf file

sudo nano /etc/dnsmasq.conf

Remove everything in this file and enter this into the file instead, save the file with this content

interface=eth0
listen-address=127.0.0.1,192.168.1.50
expand-hosts
domain=lan
address=/vroute.lan/192.168.1.50
server=8.8.8.8

dhcp-range=192.168.1.40,192.168.1.49,24h
dhcp-leasefile=/var/lib/misc/dnsmasq.leases

# semi static IP
dhcp-host=vpod1,192.168.1.45
dhcp-host=vpod2,192.168.1.46

lastly change the vroute IP address in /etc/hosts to your network address

sudo nano /etc/hosts

replace 127.0.1.1 vroute with

192.168.1.50 vroute

Installing NTP

NTP is the internet protocol for syncing time across computers. Since we may not have internet access at the field the router will be the truth of the time on your network. It doesn’t have to be correct but it is extremely important that the two camera pods have the same time down to at least a millisecond. NTP provides that. Start of by installing NTP

sudo apt install ntp

As with Dnsmasq we need to replace everything in a configuration file again, this time in /etc/ntp.conf

sudo nano /etc/ntp.conf

Replace the content of the file with this, and save the file

driftfile /var/lib/ntp/ntp.drift
server 127.127.1.0 prefer
fudge 127.127.1.0 stratum 10

Now we will disable the default time synchronization software and user NTP instead

sudo systemctl disable --now systemd-timesyncd

And we are done with the router for now, the optional part of using IP Masquarade to have internet on the network is explained in a separate section. Reboot the raspberry and make sure there are no errors regarding DHCP, Dnsmasq or NTP on startup.