Configure Local Network for a Raspberry Pi Cluster
Best practices for connecting and configuring a Raspberry Pi cluster to a local network.
Static IP
What is a static IP?
An IP address that doesn’t get changed or re-assigned by the network (home router in our case) even after a restart and/or shutdown.
Why does a RPi cluster require a static IP?
When you create a RPi cluster you usually also configure client(s) to communicate with it. Lets look at a few examples of such clients:
- SSH by node name, using a local machine
/etc/hosts
file to assign names for every RPi cluster node (e.g.rpi-master
,rpi-node
) - Register one of the RPi nodes as a Kubernetes master node, setting its IP address on a local machine kube config file
-
Register these IP addresses within an Ansible hosts inventory
Note: These clients must work with static IP addresses to prevent a situation of which all clients must be aligned constantly on every newly assigned IP address for either of the RPi nodes.
TP-Link: Archer VR600
In this section we’ll learn how to configure a static IP address on a TP-Link: Archer VR600 router.
Retrieve a device network address (from router dashboard)
- Open the router Dashboard
- Select
Advanced
tab and afterwardsNetwork
from the side menu - Under
LAN settings
->Client List
retrieve theMAC Address
of a client namedraspberrypi
Retrieve a device network address (from RPi server directly)
In case there isn’t a MAC Address
column on the client list, we’ll retrive its value directly from the RPi server:
- Find the IP address of the new RPi device from the router’s
Client List
as described on the previous section -
Open a terminal shell session via SSH to the RPi server
1
ssh pi@<INSERT-IP-ADDRESS>
Important: You might require to supply the RPi server password in case the machine you are connecting from lacks the RPi server SSH private key in its SSH authentication agent (default password: raspberry). -
Run
ifconfig
and acquire the network physical address (MAC address) by searching foreth0
and copying theHWaddr
orether
value1
ip addr show eth0 | grep "ether\b" | awk '{print $2}' | cut -d/ -f1
Reserve a static IP address
- Open the router Dashboard
- Select the
Advanced
tab - Go to
Network
->LAN Settings
->Address Reservation
- Click
add
and fill out the following:MAC Address
: fill in theHWaddr
/ether
from the RPi node-
IP Address
: select a higher range IP address e.g.192.168.1.200
so it won’t get occupiedImportant: Make sureEnable this entry
is selected.
- Go to
System Tools
->Reboot