This guide covers firewall configuration for hosting a Woodlanders server. Proper firewall setup is essential for security while allowing legitimate game traffic.
The Woodlanders server requires one TCP port for all game traffic:
- Default Port: 25565 (TCP)
- Protocol: TCP only (no UDP required)
- Direction: Inbound connections from clients
-
Open Windows Defender Firewall:
- Press
Win + R - Type
wf.mscand press Enter
- Press
-
Click "Inbound Rules" in left panel
-
Click "New Rule..." in right panel
-
Configure rule:
- Rule Type: Port
- Protocol: TCP
- Specific local ports: 25565
- Action: Allow the connection
- Profile: Check all (Domain, Private, Public)
- Name: Woodlanders Server
-
Click "Finish"
# Allow inbound TCP on port 25565
New-NetFirewallRule -DisplayName "Woodlanders Server" `
-Direction Inbound `
-Protocol TCP `
-LocalPort 25565 `
-Action Allow `
-Profile Any
# Verify rule was created
Get-NetFirewallRule -DisplayName "Woodlanders Server"netsh advfirewall firewall add rule name="Woodlanders Server" dir=in action=allow protocol=TCP localport=25565# PowerShell
Remove-NetFirewallRule -DisplayName "Woodlanders Server"
# Command Prompt
netsh advfirewall firewall delete rule name="Woodlanders Server"UFW (Uncomplicated Firewall) is the default on Ubuntu and Debian.
# Enable firewall
sudo ufw enable
# Check status
sudo ufw status# Allow TCP port 25565
sudo ufw allow 25565/tcp
# Allow with comment
sudo ufw allow 25565/tcp comment 'Woodlanders Server'
# Verify rule
sudo ufw status numbered# Allow only from specific IP
sudo ufw allow from 192.168.1.100 to any port 25565 proto tcp
# Allow from subnet
sudo ufw allow from 192.168.1.0/24 to any port 25565 proto tcp# List rules with numbers
sudo ufw status numbered
# Delete by number
sudo ufw delete <number>
# Or delete by specification
sudo ufw delete allow 25565/tcpFor systems using iptables directly (CentOS, RHEL, older systems).
# Allow TCP port 25565
sudo iptables -A INPUT -p tcp --dport 25565 -j ACCEPT
# Save rules (Ubuntu/Debian)
sudo iptables-save | sudo tee /etc/iptables/rules.v4
# Save rules (CentOS/RHEL)
sudo service iptables save# Allow only from specific IP
sudo iptables -A INPUT -p tcp -s 192.168.1.100 --dport 25565 -j ACCEPT
# Allow from subnet
sudo iptables -A INPUT -p tcp -s 192.168.1.0/24 --dport 25565 -j ACCEPT# List all rules
sudo iptables -L -n -v
# List with line numbers
sudo iptables -L INPUT --line-numbers# Delete by line number
sudo iptables -D INPUT <line-number>
# Delete by specification
sudo iptables -D INPUT -p tcp --dport 25565 -j ACCEPTUsed on Fedora, CentOS 7+, RHEL 7+.
# Allow TCP port 25565
sudo firewall-cmd --permanent --add-port=25565/tcp
# Reload firewall
sudo firewall-cmd --reload
# Verify
sudo firewall-cmd --list-ports# Create rich rule for specific IP
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.100" port protocol="tcp" port="25565" accept'
# Reload
sudo firewall-cmd --reload# Remove port
sudo firewall-cmd --permanent --remove-port=25565/tcp
# Remove rich rule
sudo firewall-cmd --permanent --remove-rich-rule='rule family="ipv4" source address="192.168.1.100" port protocol="tcp" port="25565" accept'
# Reload
sudo firewall-cmd --reloadmacOS firewall is application-based by default.
- Open System Preferences → Security & Privacy
- Click "Firewall" tab
- Click lock icon and authenticate
- Click "Firewall Options"
- Click "+" and add Java
- Set to "Allow incoming connections"
# Edit pf configuration
sudo nano /etc/pf.conf
# Add rule (before any block rules)
pass in proto tcp from any to any port 25565
# Load configuration
sudo pfctl -f /etc/pf.conf
# Enable pf
sudo pfctl -e
# Check status
sudo pfctl -s rulesTo host a server accessible from the internet, configure port forwarding on your router.
-
Find your server's local IP address:
# Linux/macOS ip addr show # Windows ipconfig
-
Access router admin panel:
- Usually at
192.168.1.1or192.168.0.1 - Check router label for default gateway
- Usually at
-
Navigate to Port Forwarding section:
- May be under "Advanced", "NAT", or "Virtual Server"
-
Create port forwarding rule:
- Service Name: Woodlanders
- External Port: 25565
- Internal Port: 25565
- Internal IP: Your server's local IP
- Protocol: TCP
-
Save and apply settings
TP-Link:
- Advanced → NAT Forwarding → Virtual Servers
Netgear:
- Advanced → Advanced Setup → Port Forwarding/Port Triggering
Linksys:
- Security → Apps and Gaming → Single Port Forwarding
ASUS:
- WAN → Virtual Server/Port Forwarding
D-Link:
- Advanced → Port Forwarding
Some routers support automatic port forwarding via UPnP.
Pros:
- Automatic configuration
- No manual setup needed
Cons:
- Security risk if enabled globally
- Not all routers support it
- May not work reliably
Enable UPnP (if desired):
- Access router admin panel
- Find UPnP settings (usually under Advanced)
- Enable UPnP
- Restart router
Note: For security, prefer manual port forwarding over UPnP.
# Using AWS CLI
aws ec2 authorize-security-group-ingress \
--group-id sg-xxxxxxxxx \
--protocol tcp \
--port 25565 \
--cidr 0.0.0.0/0Using AWS Console:
- EC2 → Security Groups
- Select your security group
- Inbound Rules → Edit
- Add Rule:
- Type: Custom TCP
- Port: 25565
- Source: 0.0.0.0/0 (or specific IPs)
# Using gcloud CLI
gcloud compute firewall-rules create woodlanders-server \
--allow tcp:25565 \
--source-ranges 0.0.0.0/0 \
--description "Woodlanders game server"Using GCP Console:
- VPC Network → Firewall
- Create Firewall Rule:
- Name: woodlanders-server
- Direction: Ingress
- Action: Allow
- Targets: All instances
- Source IP ranges: 0.0.0.0/0
- Protocols and ports: tcp:25565
# Using Azure CLI
az network nsg rule create \
--resource-group myResourceGroup \
--nsg-name myNSG \
--name WoodlandersServer \
--protocol tcp \
--priority 1000 \
--destination-port-range 25565 \
--access AllowUsing Azure Portal:
- Network Security Groups → Your NSG
- Inbound security rules → Add
- Configure:
- Source: Any
- Source port ranges: *
- Destination: Any
- Destination port ranges: 25565
- Protocol: TCP
- Action: Allow
- Priority: 1000
- Name: WoodlandersServer
Using DigitalOcean Control Panel:
- Networking → Firewalls
- Create Firewall or edit existing
- Inbound Rules → New Rule:
- Type: Custom
- Protocol: TCP
- Port Range: 25565
- Sources: All IPv4, All IPv6
# Check if port is listening
netstat -tuln | grep 25565
# Linux - check if port is open
sudo ss -tulpn | grep 25565
# Test with telnet (from another machine)
telnet <server-ip> 25565# Using netcat
nc -zv <server-ip> 25565
# Using telnet
telnet <server-ip> 25565
# Using nmap
nmap -p 25565 <server-ip>Use online tools to verify port is accessible:
Steps:
- Ensure server is running
- Enter your public IP and port 25565
- Click "Check Port"
- Should show "Port is open"
Only open ports that are absolutely necessary:
# Good: Only allow game port
sudo ufw allow 25565/tcp
# Bad: Allow all ports
sudo ufw allow from any to anyIf you know player IPs, restrict access:
# Allow only specific IPs
sudo ufw allow from 203.0.113.0/24 to any port 25565 proto tcp
# Allow multiple IPs
sudo ufw allow from 203.0.113.10 to any port 25565 proto tcp
sudo ufw allow from 198.51.100.20 to any port 25565 proto tcpConsider using a non-standard port to reduce automated attacks:
# server.properties
server.port=27015Then configure firewall for the custom port.
Protect against connection floods:
# iptables rate limiting
sudo iptables -A INPUT -p tcp --dport 25565 -m state --state NEW -m recent --set
sudo iptables -A INPUT -p tcp --dport 25565 -m state --state NEW -m recent --update --seconds 60 --hitcount 10 -j DROPMonitor blocked connection attempts:
# UFW logging
sudo ufw logging on
# iptables logging
sudo iptables -A INPUT -p tcp --dport 25565 -j LOG --log-prefix "Woodlanders: "Periodically review firewall rules:
# List all rules
sudo ufw status verbose
# Check for unnecessary rules
sudo iptables -L -n -vAutomatically ban IPs with suspicious activity:
# Install fail2ban
sudo apt install fail2ban
# Create filter for Woodlanders
sudo nano /etc/fail2ban/filter.d/woodlanders.conf[Definition]
failregex = ^.*\[WARNING\] Rate limit exceeded for client <HOST>.*$
^.*\[WARNING\] Invalid message from <HOST>.*$
ignoreregex =# Configure jail
sudo nano /etc/fail2ban/jail.local[woodlanders]
enabled = true
port = 25565
protocol = tcp
filter = woodlanders
logpath = /var/log/woodlanders/server.log
maxretry = 5
bantime = 3600
findtime = 600# Restart fail2ban
sudo systemctl restart fail2ban# Find what's using the port
sudo lsof -i :25565
sudo netstat -tulpn | grep 25565
# Kill the process
sudo kill -9 <PID># Temporarily disable firewall for testing
sudo ufw disable
# Test connection
# If it works, firewall is the issue
# Re-enable firewall
sudo ufw enable
# Review and fix rules- Verify server is running:
netstat -tuln | grep 25565 - Check local firewall:
sudo ufw status - Check router port forwarding configuration
- Verify public IP:
curl ifconfig.me - Test with online port checker
- Check ISP doesn't block port (some ISPs block common ports)
- Increase timeout in client
- Check for packet loss:
ping <server-ip> - Verify no intermediate firewalls blocking traffic
- Check server logs for connection attempts
- Server Setup Guide - Installation and deployment
- Server Configuration - Configuration options
- Troubleshooting Guide - Common issues and solutions