How to Secure Open Ports on us-central-1 Bare Metal machines
This guide explains how to restrict public access to open ports on a bare-metal cluster from us-central-1 while still allowing secure intra-cluster communication between nodes.
Overview
By default, Linux servers often expose services to the public Internet (e.g., SSH or RPC).We’ll configure a host-based firewall (
ufw) so that:
- Only your personal machine can connect via SSH (port 22)
- Cluster nodes can communicate with each other internally (via private IPs)
- All other public traffic is blocked
Prerequisites
- Root or
sudoaccess to each server - The private IP range of your cluster (e.g.
10.0.0.0/24) - Your own public IP address (from your local machine)
Step-by-Step Instructions
1. Verify open ports
Check which ports are currently listening:0.0.0.0 or [::] — these are publicly accessible.Common culprits include:
22/tcp→ SSH111/tcpand111/udp→ RPCBind (can be disabled if unused)
2. Disable unnecessary services (optional)
Ifrpcbind or other network daemons are running and not required:
3. Install and enable UFW
If not already installed:4. Configure default firewall policy
Deny all inbound connections except for explicitly allowed ports:Shell
5. Allow SSH from your personal machine
Replace203.0.113.25 with your own IP:
Shell
6. Allow internal cluster communication
If your cluster uses a private subnet (e.g.,10.0.0.0/24), you’ll need to allow internal access. For each of your cluster’s nodes, you’ll need to get the Private IP for each node. Replace 10.0.0.0 with each of your node’s Private IP.
Adjust the ports above as needed for your own services.
7. Block unwanted services
Explicitly deny unused or vulnerable ports:8. Enable the firewall
y to continue.
⚠️ Keep your current SSH session open until you confirm that your rules work.
9. Verify firewall configuration
10. Test SSH access
- Open a new terminal on your local machine.
- Try connecting via SSH:
- Once confirmed, close the original SSH session.
Summary
After completing this guide, your bare-metal cluster will:- Allow controlled SSH access from your machine and internal peers
- Block all public exposure of unused ports
- Maintain secure and predictable network behavior across nodes

