Replicating Netflix Part 3: Setting up a network for Raspberry PI Clusters
Previous chapter: Replicating Netflix Part 2: Casing up our tiny kick-ass cluster nodes (Raspberry PIs)
This is the third part of my "Replicating Netflix" series. The article's goal is to demonstrate the steps required to setup a simple network that would enable Raspberry PIs to communicate with each other and access the Internet.
At the end of this article, we will be able to achieve the following:
- Have a properly documented physical network layer
- Setup an additional router that serves as an extender
- Have static IPs for our Raspberry PIs
- Ensure zero conflicting IPs between DHCP leased clients and static node IPs
- SSH to our Raspberry PIs.
- Access the Internet using our Raspberry PIs
The Raspberry PI 3 Cluster Network Diagram
Above is a network diagram that describes the target network topology for our Raspberry PI cluster. It would be important to pay attention on the IPs of both routers and each Raspberry PI node.
What's Needed?
-
Your existing home router
The purpose of this router is to manage the communication between your home's internal devices and the Internet. This router will also be configured with a DHCP pool and static IP reservations that would later on be used for ensuring predictability of Raspberry PI addresses.
-
A TP-Link TL-WR840N Router
This router would serve as a repeater that would extend the reach of the main router to the switch where we intend to connect the cluster nodes. We're going to do this because installing long network cables require tons of work and time than simply connecting two routers together via WDS bridging.
-
An 8-Port 10/100 Network Switch (DLink DES-1008A)
Getting this switch is optional, connecting the nodes to the repeater via Wifi should be sufficient. It just happened that I prefer to have a switch because it provides more robust and resilient connection between the Internet and the Raspberry PIs. It also saves your brain from too much Wifi inside the room ;).
-
6 pieces of flat Ethernet cables
These flat network cables would be utilized for connecting our Raspberry PIs to the switch. (Remember this is optional, I am just taking this extra step because I want to reduce the WIFI interference inside my room)
-
6 pieces of micro USB power cable
These power cables would be used to provide power to your Raspberry PIs. (You would only need 4 but it would be safe to keep some reserves to prevent delays on your project).
-
4 Raspberry PIs with Raspbian Jessie Lite
We would need the Raspberry PIs that we've setup from my previous articles.
Steps
-
Step 1: Create Labels
The first thing that you have to do is to create labels that would be placed on each end of Ethernet cables, power cables and each node of the cluster. This would help us on identifying which cables connect to which node while working on the physical layer. (Don't punish your future self by not labeling your cables and nodes (LOL))
-
Step 2: Label Raspberry PIs
First step is to label all the nodes that would be attached to our cluster. This would enable you to determine which node is what.
-
Step 3: Label Ethernet Cables
Attach labels on both ends of your Ethernet cables so that you can easily determine which cable connects what on each switch.
-
Step 4: Label Power Cables
Attach labels on both ends of your power cables so that you can easily determine which power cable is used by each node.
-
Step 5: Setup DHCP pool on your existing home router (ROUTER A)
Connect to your existing router's admin portal (By default located at 192.168.1.1 or 192.168.0.1) and ensure that there would only be 50 IPs that the router can lease via DHCP (192.168.1.100 - 192.168.1.150). This step would prevent IP conflicts for your cluster nodes (statically addressed) with any DHCP leased client on your network.
-
Step 6: Connect your Router B (TPLink) to power outlet and a PC
Connecting your Router B to your PC via Ethernet cable would enable us to setup the repeater mode on it.
-
Step 7: Login to Router B
Navigate to the Router B's admin portal on 192.168.0.1 and login using admin/admin credentials.
-
Step 8: Go the router's quick setup mode
After a successful login to the router's admin portal, you will be seeing the quick setup menu on the left side of the page. Click it and select "Next" button.
-
Step 9: Enable Repeater Mode
You will be prompted with a option of operation mode that the router can perform. Select the "Range Extender" option from the list. This would enable us to connect the two Routers together and propagate internet connection from Router A to the Raspberry PIs in a wireless fashion.
-
Step 10: Select Router A as Access Point
After selecting the operation mode, you will be presented with a list of all available access points that your router can extend. Select your existing home access point and click connect.
-
Step 11: Setup Credentials on Router B
Provide the password to your Router A's Wifi network and customize the SSID of the range extender by providing a name on the "Customize" field and click "Next" button.
-
Step 12: Setup Router B's IP
Set the IP of router B to static and provide a IP address that will not conflict on your local network's DHCP pool. For me it is "192.168.1.10". You will also have to disable the DHCP server on this router to prevent IP collisions between router A and B clients.
-
Step 13: Verify Router B details and finish setup
Verify if all the values you provided on your router B are correct and click finish. Clicking finish will cause the Router B to reboot. To verify if your router's Internet propagation setup is working, try to connect to the router's Wifi channel and browse the Internet. If not you would have to revisit the steps you've taken and reset the router to factory configurations if required.
-
Step 14: Connect Switch to Router B
Connect your DLink switch to Router B via Ethernet cable.
-
Step 15: Setup PIs for static IP configuration
Connect your Raspberry PI to a keyboard, mouse and spare monitor. Connect power cable to outlet to ensure safety.
-
Step 16: Login to Raspberry PI
To configure the IP of each Raspberry PI, login to each of them using pi/raspberry credentials.
-
Step 17: Open dhcpcd.conf
Open DHCPCD.conf file using "sudo nano dhcpcd.conf" command. This file contains all the network configurations on a device running Raspbian Jessie Lite.
-
Step 18: Setup Ethernet Interface Configuration
To provide static IPs on your Raspberry PIs, navigate to the end of each DHCPCD.conf files and add the configuration (Put different IPs for each node, (Refer to network diagram on top)) below:
interface eth0
static ip_address=192.168.1.10/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
After entering each command, save the dhcpcd.conf file and exit.
-
Step 19: Reboot Raspberry PIs
For the network configurations to work, you will have to reboot the Raspberry PI using the "sudo shutdown -r now" command. The "-r" flag indicates that the command's intent is to reboot the system. Placing "-h" option there would cause the node to shutdown.
-
Step 20: Check if your router settings worked.
After rebooting the pi, test and check if your configurations were stored properly. You can do this by typing the ifconfig and verifying the Ethernet interface 0 configurations. Repeat steps 15-20 to configure all Raspberry PI nodes.
-
Step 21: Prepare Ethernet cables
Prepare the Ethernet cables by grouping them up.
-
Step 22: Prepare power cables
Just like the Ethernet cables, prepare the power cables by grouping them up.
-
Step 23: Connect Raspberry PIs to your the Switch and Power outlet
Hurray, this is where the fun starts, no more manual hardware configurations and everything can be done using SSH! :)
-
Step 24: Ping each PI from your PC
To test that your PIs are all properly working and discoverable in the network, ping them from your PC by running cmd and typing "ping 192.168.1.x" for each of your router nodes.
-
Step 25: SSH to each of your PIs using Putty
Now that you can ping each node from your PC, we have to test SSH connections as it will be a critical factor for installing Docker and Kubernetes on our cluster nodes.
-
Step 26: Login to PI using SSH
If the SSH connection triggered by Putty worked, you will see the screen above and you have to login using pi/raspberry credentials.
-
Step 27: Pinging Google
To celebrate the effort we had put on setting up the network, lets do the traditional ping Google party.
Conclusion
Today, we've successfully setup the network where we intend to run our Kubernetes Cluster. As mentioned on the top of the article, we've also achieve the following:
- Have a properly documented physical network layer
- Setup an additional router that serves as an extender
- Have static IPs for our Raspberry PIs
- Ensure zero conflicting IPs between DHCP leased clients and static node IPs
- SSH to our Raspberry PIs.
- Access the Internet using our Raspberry PIs
Related Articles
- Replicating Netflix Part 1: Installing Raspbian Jessie Lite using Etcher
- Replicating Netflix Part 2: Casing up our tiny kick-ass cluster nodes (Raspberry PIs)
Comments
Post a Comment