Step 2: Configuring Node
⚒️ Node Configuration
Logging to the node
Using Ubuntu Server: Begin by connecting with your SSH client.
Using Ubuntu Desktop: You're likely in-front of your local node. Simply open a terminal window from anywhere by typing Ctrl+Alt+T.
Updating the node
Ensure all the latest packages, tools and patches are installed first, then reboot.
sudo apt-get update -y && sudo apt dist-upgrade -y
sudo apt-get install git ufw curl ccze jq -y
sudo apt-get autoremove
sudo apt-get autoclean
sudo reboot
🔑 Security Configuration
Create a non-root user with sudo privileges
🔥Important reminder: Ensure you are logged in and execute all steps in this guide as this non-root user, ethereum
.
Hardening SSH Access
Transferring the SSH Public Key to Remote node
Disabling Password Authentication
Synchronizing time with Chrony
chrony is an implementation of the Network Time Protocol and helps to keep your computer's time synchronized with NTP.
To install chrony:
sudo apt-get install chrony -y
To see the source of synchronization data.
chronyc sources
To view the current status of chrony.
chronyc tracking
Setting Timezone
To pick your timezone run the following command:
sudo dpkg-reconfigure tzdata
Find your region using the simple text-based GUI.
In the event that you are using national system like India's IST
select:
Asia/Kolkata
This will be appropriate for all locales in the country (IST
, GMT+0530
).
Creating the jwtsecret file
A jwtsecret file contains a hexadecimal string that is passed to both Execution Layer client and Consensus Layer clients, and is used to ensure authenticated communications between both clients.
#store the jwtsecret file at /secrets
sudo mkdir -p /secrets
#create the jwtsecret file
openssl rand -hex 32 | tr -d "\n" | sudo tee /secrets/jwtsecret
#enable read access
sudo chmod 644 /secrets/jwtsecret
🔗 Network Configuration
The standard UFW - Uncomplicated firewall can be used to control network access to your node and protect against unwelcome intruders.
Configure UFW Defaults
By default, deny all incoming traffic and allow outgoing traffic.
sudo ufw default deny incoming
sudo ufw default allow outgoing
Configure SSH Port 22
If your node is remote in the cloud, or at home but on a different headless server, you will need to enable SSH port 22 in order to connect.
# Allow ssh access for remote node
sudo ufw allow 22/tcp comment 'Allow SSH port'
If your node is local at home and you have keyboard access to it, it's good practice to deny SSH port 22.
# Deny ssh access for local node
sudo ufw deny 22/tcp comment 'Deny SSH port'
Allow Execution Client Port 30303
Peering on port 30303, execution clients use this port for communication with other network peers.
sudo ufw allow 30303 comment 'Allow execution client port'
Allow Consensus Client port
Consensus clients generally use port 9000 for communication with other network peers. Using tcp port 13000 and udp port 12000, Prysm uses a slightly different configuration.
# Lighthouse, Lodestar, Nimbus, Teku
sudo ufw allow 9000 comment 'Allow consensus client port'
# Lighthouse Quic Port https://lighthouse-blog.sigmaprime.io/Quic.html
sudo ufw allow 9001/udp comment 'Allow lighthouse client quic port'
# Prysm
sudo ufw allow 13000/tcp comment 'Allow consensus client port'
sudo ufw allow 12000/udp comment 'Allow consensus client port'
Enable firewall
Finally, enable the firewall and review the configuration.
sudo ufw enable
sudo ufw status numbered
Example of ufw status for a remote staking node configured for Prysm consensus client.
To Action From -- ------ ---- [ 1] 22/tcp ALLOW IN Anywhere [ 2] 9000 ALLOW IN Anywhere [ 3] 30303 ALLOW IN Anywhere [ 4] 22/tcp (v6) ALLOW IN Anywhere (v6) [ 5] 9000 (v6) ALLOW IN Anywhere (v6) [ 6] 30303 (v6) ALLOW IN Anywhere (v6)
Configure Port Forwarding
Port Forwarding Tip for Local Stakers at Home: You'll need to forward ports to your validator.
For optimal connectivity, ensure Port Forwarding is setup for your router. Learn to port forward with guides found at https://portforward.com/how-to-port-forward
Verify port forwarding is working with the following.
Option 1: From the terminal on staking machine. Choose accordingly to your clients.
# Lighthouse, Lodestar, Nimbus, Teku
curl https://eth2-client-port-checker.vercel.app/api/checker?ports=30303,9000
# Prysm
curl https://eth2-client-port-checker.vercel.app/api/checker?ports=30303,12000,13000
Result: Open ports will be shown if reachable from public.
Option 2: Using the browser
As an example, for Lighthouse, you would verify ports 9000 and 30303 are reachable.
Optional: Whitelisting Connections
Whitelisting, which means permitting connections from a specific IP, can be setup via the following command.
sudo ufw allow from <your client machine>
# Example
# sudo ufw allow from 192.168.50.22
⛓️ Install Fail2ban
To install fail2ban:
sudo apt-get install fail2ban -y
Edit a config file that monitors SSH logins.
sudo nano /etc/fail2ban/jail.local
Add the following lines to the bottom of the file.
[sshd]
enabled = true
port = 22
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
To exit and save, press Ctrl
+ X
, then Y
, thenEnter
.
Restart fail2ban for settings to take effect.
sudo systemctl restart fail2ban