Premise
In this guide we'll create the simplest slave/master server configuration, using only Linux devices.
You can use any suitable machine for the master; we'll use a generic HP Pavilion 15 laptop with two ethernet ports.
I'm using a generic HP 250 G6 Notebook and an E402MA (ASUS-NotebookSKU), as slaves, both of which are laptops.
Link each slave to the master with an ethernet cable.
It's worth mentioning that a PC is not meant to be used as a server;
bad performance/energy consumption.
Requirements
- 1 Linux Device with at least 2 ethernet ports
- 1 or more linux devices (slave) with at least 1 ethernet port each
- 1 ethernet cable for each slave
- DHCPCD client installed in each device
Slave
Install DHCPCD:
$ apt install dhcpcd5
Edit edit the configuration file of DHCPCD, usually /etc/dhcpcd.conf
, and give a static IP to the ethernet interface of each slave, in my case the interface name is eno1, you can refer to the following lines:
(HP 250 G6 Notebook)
interface eno1
static ip_address=10.0.99.2
[E402MA (ASUS-NotebookSKU)]
interface eno1
static ip_address=10.0.98.2
And so on.
Master
Userspace /dev
It's worth creating a new rule set for udev; make a new file, we'll call it 60-homecluster.rules:
$ touch /etc/udev/rules.d/60-homecluster.rules
For each slave server, use ifconfig
or cat /sys/class/net/${INTERFACE}/address
to retrieve the interface MAC address. For example:
$ cat /sys/class/net/eno1/address
In our example, the master has two ethernet interfaces, eth1 and eth2.
Map each device MAC with an interface.
Remember to replace DEVICE_MAC with the MAC address you retrieved.
For the HP 250 G6 Notebook
SUBSYSTEM=="net", ATTR{address}=="DEVICE_MAC", NAME="eth1"
For the E402MA (ASUS-NotebookSKU)
SUBSYSTEM=="net", ATTR{address}=="DEVICE_MAC", NAME="eth2"
And so on.
60-homecluster.rules should look like this
SUBSYSTEM=="net", ATTR{address}=="f4:30:b9:52:55:78", NAME="eth1"
SUBSYSTEM=="net", ATTR{address}=="10:f0:05:ce:87:28", NAME="eth2"
DHCP
Edit the configuration file of DHCPCD, usually /etc/dhcpcd.conf
, and give each slave a local IP block
interface eth1
static ip_address=10.0.99.1/24
interface eth2
static ip_address=10.0.98.1/24
Finally, make sure you connected each ethernet cable; restart DHCPCD
$ dhcpcd -k
Wait at least a couple of seconds:
$ dhcpcd
Try connect with SSH
$ ssh username@10.0.99.2
$ ssh username@10.0.98.2
Top comments (0)