Networking - Basics
π Networking Basics (for Servers)
When running a node or validator, understanding basic networking is very important. This helps you solve problems related to syncing, peer connections, RPC access, and firewalls.
This page covers:
Public & Private IP
Ports & Port Forwarding
Basic tools for networking
Common network troubleshooting
π Public IP vs Private IP
Public IP: The IP address visible to the internet. Your node uses this to communicate with other peers or to expose an RPC/API.
Private IP: Local IP used inside a private network (like
192.168.x.x
). Useful for internal-only services.
VPS servers usually get a Public IP by default. You can see it with:
curl ifconfig.me
π’ What is a Port?
A port is like a door to your server. Each app/service runs on a different port.
Examples:
SSH
22
HTTP
80
HTTPS
443
Cosmos P2P
26656
Cosmos RPC
26657
π― Port Forwarding (NAT)
Relevant mostly for home servers or local VMs, not typical VPS setups.
If you're running a node from your home or local network, your router/firewall might block outside connections.
Youβll need to:
Login to your router admin page
Go to Port Forwarding / NAT settings
Forward the needed port (e.g. 26656) to your local server IP
For example: Forward
26656
to192.168.1.100
π¦ Allowing Ports in Ubuntu Firewall (UFW)
By default, Ubuntu might block certain ports. Use ufw
to allow them:
# Enable UFW
sudo ufw enable
# Allow SSH (important to avoid locking yourself out!)
sudo ufw allow 22
# Allow Cosmos P2P & RPC ports
sudo ufw allow 26656
sudo ufw allow 26657
# Check status
sudo ufw status
π§ͺ Useful Networking Commands
π Check open ports on your server:
sudo lsof -i -P -n | grep LISTEN
π‘ Check public IP:
curl ifconfig.me
π Test if a port is open (from outside):
telnet <your-server-ip> 26656
π§± Check if a port is blocked by firewall:
nc -zv <your-server-ip> 26656
π Connecting to Peers
Most blockchain nodes need to connect to other peers. Make sure:
Your
p2p
port is openYou're not behind NAT (or have port forwarding)
Youβre advertising your correct external IP in config (e.g.
external_address = "<ip>:<port>"
)
π Monitor Who's Connecting
sudo netstat -tulnp
Or using ss
:
sudo ss -tuln
To see SSH login attempts:
journalctl -u ssh
π« Block Dangerous Traffic
Block unused ports and protocols. Example:
sudo ufw deny 8000
sudo ufw deny from 0.0.0.0/0 to any port 23 proto tcp
Donβt expose unnecessary services like FTP, Telnet, or open databases.
Last updated