【Dev Odyssey】 How To Build A Custom Raspberry Pi Router // OpenWrt on RPi 4



Dev Odyssey : How To Build A Custom Raspberry Pi Router // OpenWrt on RPi 4

How To Build A Custom Raspberry Pi Router // OpenWrt on RPi 4

Welcome back to Dev Odyssey Home Networking! In this episode, I show you how to take a Raspberry Pi, and make it a great custom home router, better than what you can buy. A Raspberry Pi 4 comes with plenty of improvements over a stock router, like a better ARM CPU, more RAM, increased storage and two 2.0 and 3.0 USB ports. There are drawbacks with using a Raspberry Pi as a router, as it only has 1 Gb ethernet port, and smaller WiFi chip / no WiFi antennas, reducing potential WiFi coverage. However, these drawbacks are overcome with a network switch and access points. Another way to overcome them is by using different single board computers (SBCs), such as a Raspberry Pi CM4, Banana Pi BPI-R2, ClearFog Pro, Seeed Odyssey, and many other SBCs. With OpenWrt, the possibilities are endless!

Follow me on Twitter and Facebook

https://twitter.com/Dev_Odyssey
https://www.facebook.com/Dev0dyssey

Links

OpenWrt Image for Raspberry Pi 4B
https://downloads.openwrt.org/releases/21.02.1/targets/bcm27xx/bcm2711/
https://firmware-selector.openwrt.org/

Balena Etcher
https://www.balena.io/etcher/

Ubuntu 20.04 Image
https://ubuntu.com/download/desktop

Raspberry Pi 4B Kit
https://www.amazon.com//dp/B07V5JTMV9

Pluggable USB GB Ethernet Adapter
https://www.amazon.com/dp/B00AQM8586

Ethernet Cable
https://www.amazon.com/dp/B001W28L2Y

Managed Network Switch (UniFi Switch 8)
https://store.ui.com/collections/unifi-network-switching/products/unifi-switch-8

Access Point (WiFi Lite 6)
https://store.ui.com/products/unifi-ap-6-lite

Raspberry Pi CM 4
https://www.raspberrypi.com/products/compute-module-4/?variant=raspberry-pi-cm4001000

Banana Pi BPI-R2
https://www.banana-pi.org/bananapi-router/

ClearFog Pro
https://shop.solid-run.com/product/SRM6828S00D01GE000P02CH/

Seeed Odyssey
https://www.seeedstudio.com/ODYSSEY-X86J4125800-p-4915.html

Video Description / Outline

— Flashing OpenWrt microSD

Use Balena Etcher, or other software like Raspberry Pi Imager, or dd
https://www.raspberrypi.com/software/

— Partition Disk

https://openwrt.org/docs/guide-user/installation/openwrt_x86#resizing_filesystem

* Requires fdisk and resize2fs
* First use lsblk to see disks and where they are mounted
* Then unmount rootfs! Otherwise changes won’t work (use sudo umount /media/username/rootfs)
* Then use fdisk to delete second partition, and recreate it using the rest of the available space
* sudo fdisk /dev/sdb
* p
* d
* 2
* n
* p
* 2
* Use sector from previous 2nd partition before deletion
* (Press Enter to assume using the last sector as end point for partition)
* n
* w
* Then run command sudo e2fsck -f /dev/sdb2
* Press ‘y’ to fix padding
* Then run command sudo resize2fs /dev/sdb2
* Then unmount first partition, unplug from computer, and plug sd card into raspberry pi
* sudo umount /dev/sdb1

— USB Ethernet Driver install

* Login with ssh root@192 . 168 . 1 . 1 (or connect monitor and keyboard to pi)
* Change password with passwd
* Turn off DHCP in /etc/config/dhcp (add line under “config dhcp ‘lan’”, option ignore ‘1’. Delete option limit and option start lines (or comment out)
* Edit /etc/config/network, change “option ipaddr” to static IP of choosing (important so we know what IP to connect to), add lines “option dns” and “option gateway” with respective IPs to connect it to the network. Use public DNS server. Reboot
* Connect Ethernet cable to existing network / router
* Login to router via ssh (or use peripherals)
* Run opkg update
* Login to LuCI with credentials
* Next go to System, Software, and type in kmod-usb-net-asix-ax88179 and install that package
* Plug in the USB Ethernet adapter to a USB 3.0 port on Raspberry Pi
* Then, go to Network, Interfaces, Add New Interface. Name it WAN, Choose DHCP Client, and Choose eth1 device, Create Interface
* Then in Firewall tab, change zone to “WAN” zone, Save, Save and Apply
* Then plug in ethernet cable to USB Ethernet adapter, and then plug ethernet cable into modem or home network to test first.

— Network Configuration

* Next, we’ll edit the LAN Interface and revert it back to your initial settings. Or, you can create your own network of choosing. Refer to changes made above to revert them back

— WiFi Configuration

* Edit /etc/config/wireless
https://gist.github.com/odevodyssey/bd16cd8eb4707ef14c4d59d6fb15a406#file-wireless

* Reboot router
* Test network connection (speedtest.net)

00:00 Intro
02:54 Flash OpenWrt to microSD
03:58 Partition OpenWrt Image
10:45 Install USB Ethernet Driver
11:52 Network Configuration
14:11 WiFi Configuration
16:05 Speed Test
17:21 Outro

Attributions

Music | “Ocean” by LiQWYD
Watch: https://youtu.be/RqObOn9XbPk
License: www.liqwydmusic.com/how-to-use
Download/Stream: https://hypeddit.com/link/j8xoyk

Icon made by Freepik, Eucalyp from Flaticon
https://www.flaticon.com

Ubuntu is a trademark of Canonical
Raspberry Pi trademark of Raspberry Pi Trading

#RaspberryPi #Router #HomeNetwork #OpenWrt

openwrt