An Interest In:
Web News this Week
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
Linux - LAN Cluster
Premise
In this guide we'll create the simplest slave/master server configuration, using only Linux devices.
You can use any suitable device for the master, we'll use a generic HP Pavilion 15 laptop with two ethernet ports.
As slaves, we will be using a generic HP 250 G6 Notebook and an E402MA (ASUS-NotebookSKU), 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 if not available:$ apt install dhcpcd5
or$ apt install dhcpcd
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 adding a new rule set to udev; create a new file, we'll call it 60-homecluster.rules:$ touch /etc/udev/rules.d/60-homecluster.rules
Get each slave MAC address: from each slave server, use ifconfig
or cat /sys/class/net/${INTERFACE}/address
to retrieve the interface MAC. For example:
$ cat /sys/class/net/eno1/address
In this 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 NotebookSUBSYSTEM=="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 eth1static ip_address=10.0.99.1/24interface eth2static ip_address=10.0.98.1/24
Finally, make sure you connect each ethernet cable, restart DHCPCD$ dhcpcd -k
It is a good idea to wait at least a couple of seconds:$ dhcpcd
Try connect with SSH$ ssh [email protected]
$ ssh [email protected]
Original Link: https://dev.to/jacopo/linux-otg-cluster-4jlh
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To