LightYear
/Docs
DocsNetworkingConfigure Firewall Rules

Configure Firewall Rules

Create and manage LightYear firewall groups to control inbound and outbound traffic to your servers.

beginner
8 min read
LightYear Docs Team
Updated April 24, 2026
firewallsecuritynetworkingrules
Ready to get started?

Security Architecture Diagram

LightYear firewall groups let you define inbound and outbound traffic rules that are applied at the network level, before traffic reaches your server. This guide explains how to create and manage firewall groups.

Understanding Firewall Groups

A firewall group is a named set of rules that can be attached to one or more servers. Changes to a group apply to all attached servers immediately.

Default behaviour: All inbound traffic is denied unless explicitly allowed. All outbound traffic is allowed by default.

Step 1 — Create a Firewall Group

  1. Navigate to Networking → Firewall Groups.
  2. Click Create Firewall Group.
  3. Enter a descriptive name (e.g., web-servers).

Step 2 — Add Inbound Rules

Click Add Rule and configure each rule:

Essential Rules for a Web Server

ProtocolPortSourceDescription
TCP22Your IPSSH access
TCP80AnywhereHTTP traffic
TCP443AnywhereHTTPS traffic
ICMPAnywherePing/diagnostics

[!WARNING] Never open port 22 (SSH) to 0.0.0.0/0 (anywhere) in production. Restrict SSH access to your office or home IP address to prevent brute-force attacks.

Restrict SSH to a Specific IP

ProtocolPortSourceDescription
TCP22203.0.113.10/32SSH from office

Step 3 — Attach the Firewall Group to a Server

  1. Navigate to Servers → Your Server → Settings.
  2. Under Firewall Group, select the group you created.
  3. Click Save.

The rules take effect within 30 seconds.

Manage Rules via API

List Firewall Groups

>_BASH
$curl https://api.lightyear.host/v1/firewalls \
$ -H "Authorization: Bearer YOUR_API_KEY"

Add a Rule

>_BASH
$curl -X POST https://api.lightyear.host/v1/firewalls/FIREWALL_ID/rules \
$ -H "Authorization: Bearer YOUR_API_KEY" \
$ -H "Content-Type: application/json" \
$ -d '{
$ "ip_type": "v4",
$ "action": "accept",
$ "protocol": "tcp",
$ "port": "443",
$ "subnet": "0.0.0.0",
$ "subnet_size": 0,
$ "notes": "Allow HTTPS from anywhere"
$ }'

Common Rule Configurations

Database Server (MySQL/PostgreSQL)

Only allow database connections from your application servers:

ProtocolPortSourceDescription
TCP22Your IPSSH
TCP330610.0.0.0/24MySQL from private network

Game Server (Minecraft)

ProtocolPortSourceDescription
TCP22Your IPSSH
TCP25565AnywhereMinecraft Java Edition
UDP19132AnywhereMinecraft Bedrock Edition

[!NOTE] LightYear firewall rules are stateful — you do not need to add explicit outbound rules for established connections.

Was this article helpful?

Your cookie choices for this website

This site uses cookies and related technologies, as described in our privacy policy, for purposes that may include site operation, analytics, and enhanced user experience. You may choose to consent to our use of these technologies, or manage your own preferences. Cookie policy