Viewing entries tagged
raspbian

Configure a Raspberry Pi as a Wi-Fi to Ethernet Router

Comment

Configure a Raspberry Pi as a Wi-Fi to Ethernet Router

Recently, I found myself in a situation where a client was moving to a new office, within the same building. Up until the move they had been sharing an Internet connection with a neighbouring business, however the new office had a completely separate network and networked photocopier.

The client had applied for the Internet to be connected at the new office, however due to the pace of the ISP it was not ready in time and a temporary Internet connection was required to get them operational.

They were still able to access their neighbours Wi-Fi From the new office, but were not able to access the new photocopier as it was connected to their new network.

To temporarily provide an Internet connection to the new network two solutions came to mind:

  1. Connect a 4G modem to the router; with the number of devices on the network mobile data charges could become excessive.
  2. Configure a spare Raspberry Pi to connect to the neighbours Wi-Fi and share it out the Ethernet port, connected to the WAN port of the new network's router.
Network Diagram

Going by the title you know which option I went with. Thankfully Gus at Pi My Life Up has a written a great guide to achieve just that.

Tips

  • Before you start to follow the guide you will need to copy Raspbian Stretch Lite to a microSD card. You can find the steps to do so here.
  • Instead of following Step 4, run sudo raspi-config to connect the Raspberry Pi to Wi-Fi, as this will limit the Wi-Fi chipset to operate within your country's channel restrictions.
  • After following Gus' guide I had an intermittent error during boot; "Failed to start dnsmasq - A lightweight DHCP and caching DNS server", this was resolved by removing the line bind-interfaces in /etc/dnsmasq.conf.

Comment

Raspberry Pi Tips & Tricks

Comment

Raspberry Pi Tips & Tricks

Introduction

For those unfamiliar, a Raspberry Pi is a low-cost, energy efficient, highly extensible, credit card sized computer. To assist new Raspberry Pi owners I have put together my notes on the topic and will continue to append to it as new discoveries are made.

Common Commands

Copying a Raspberry Pi Operating System Image (.img) to a microSD Card

Loading an initial operating system can seem like a daunting task, in fact many Mac users are unaware that copying an .img file to a microSD does not require any additional software. In this example I will be using Raspbian Stretch Lite, a good base image for most Raspberry Pi projects.

Connect the microSD card to a Mac using an SD card adapter or a microSD to USB reader.

To find the disk identifier of the microSD card, open Terminal and run the following command:

diskutil list

In my situation the microSD was mounted as /dev/disk2, I could tell this by comparing the size of the disk (31.1 GB).

 

Before we can copy the Raspbian data to the microSD card we need to unmount the disk first with the command:

sudo diskutil unmountDisk /dev/disk2

Time to copy the contents of the image file to the microSD card, take note of the r in front of disk2:

sudo dd if=~/Downloads/2017-11-29-raspbian-stretch-lite.img of=/dev/rdisk2 bs=1m

Setting Up a Headless (No Screen) Raspberry Pi

By default SSH (remote login) is disabled. To enable SSH create an empty file called "ssh" in the root of the SD card. On a Mac this can be achieved with the Terminal command:

touch /Volumes/boot/ssh

Connect to Wi-Fi

Raspbian includes the Raspberry Pi Software Configuration Tool, this includes a user friendly way to configure network settings. To open type:

sudo raspi-config

If you are unable to run the above command (e.g. no display or Ethernet available) and want the Raspberry Pi to connect to Wi-Fi, create a wpa_supplicant.conf file in the root of the SD card (/Volumes/boot/) and add the following:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=AU

network={
    ssid="Your Wi-Fi network name"
    psk="Your Wi-Fi password"
    key_mgmt=WPA-PSK
}

Changing the Default User Password

By default the username is pi and the password raspberry. Once logged into the Raspberry Pi, the easiest way to change the password is with the command:

sudo raspi-config

Updating Raspbian

To check for and install any available updates:

sudo apt-get update && sudo apt-get dist-upgrade && sudo reboot now

Favourite Use Cases

Pi-hole - Block Ads On Your Local Network

Pi-hole is one of the best uses of the Raspberry Pi hardware. Pi-hole acts as a Domain Name System (DNS) server on the local network, blocking requests to ad related networks. This results in webpages and apps displaying content without unwanted ads. The screenshots below show the difference Pi-hole makes to the website speedtest.net.

Pi-hole also includes a nice dashboard, reporting usage and providing the ability to further blacklist/whitelist specific sites.

Digital Signage

Screenly & Yodeck have Raspberry Pi software allowing any TV to be used for digital signage. Updating what is displayed on screens is as easy as uploading new content via a web browser. Both currently offer a free tier for a single display.

Comment