System Preparation and Firewall Configuration
Update existing packages, install essential tools, and configure UFW to protect RPC interfaces while exposing P2P ports.
sudo apt update && sudo apt upgrade -y
sudo apt install -y curl ufw git jq
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp comment "SSH"
sudo ufw allow 30303/tcp comment "Geth P2P TCP"
sudo ufw allow 30303/udp comment "Geth P2P UDP"
sudo ufw allow 9000/tcp comment "Lighthouse P2P TCP"
sudo ufw allow 9000/udp comment "Lighthouse P2P UDP"
sudo ufw enableFirewall is active and enabled on system startup