Fill the Server: 80% off your first 4 monthly invoices, monthly billing. Ends Nov 30, 2026. 25 spots in this batch.FILL25
Fill the Server, annual: about 29.63% off your first annual invoice. Ends Nov 30, 2026.FILL25Y
Fill the Server, 2 year term: about 15.69% off your first biennial invoice. Ends Nov 30, 2026.FILL25B
Fill the Server, 3 year term: about 11.11% off your first triennial invoice. Ends Nov 30, 2026.FILL25T
80% off your first 3 months, monthly billing. Ends Dec 25, 2027.3MONTHS80
50% off your first annual Shared term. Ends Dec 31, 2027.50SHARED
Shared Starter, 3 year term: C$105.84 total.MOOSE294
20% off your first 3 monthly VPS invoices. Ends Dec 31, 2027.20VPS3
25% off your first annual base VPS term.25VPS

← All guides

Security

Linux firewall basics: build rules around the services you actually run

Published August 2026 · 2 min read · Updated 2026-09-05

A Linux firewall is most useful when it expresses a small, reviewable service policy: allow the ports the workload actually serves, keep administration deliberate, and reject exposure that exists only because software happened to start listening.

Inventory listeners before writing rules

Use ss or equivalent tools to list listening addresses and ports. Map each listener to a service owner and decide whether it should be loopback-only, private-network-only, publicly reachable, or not running at all.

Do not open a port because an installation guide mentions it if the current architecture does not need public access.

Build an allowlist from the application path

Typical public web service needs may include 80/443, while SSH, databases, dashboards, and management interfaces often deserve tighter source controls. IPv4 and IPv6 policy should match; allowing one family while forgetting the other creates an accidental bypass.

Keep established connection handling and required outbound behavior in mind before applying a default-deny policy remotely.

Separate host and provider firewalls

An upstream firewall and the guest firewall protect different boundaries. Document both so incident responders know which layer is rejecting traffic. A port reachable in one policy can still be blocked by the other.

Avoid duplicated complex rule sets unless the ownership of each layer is clear.

Test from outside after every change

Validate expected open and closed ports from an external network, confirm IPv6 too, and keep console recovery available. Save rules persistently so a reboot does not silently return the host to a different exposure state.

  • Inventory listeners.
  • Allow only required public services.
  • Apply equivalent IPv4/IPv6 intent.
  • Verify from an external source.

Next step

Map listening services first, then apply a Linux firewall policy that permits required traffic, limits exposure and keeps administrative access recoverable.

Explore DotMoose VPS hosting

Keep reading

Related guides.

HTTP 500, 502 and 503 errors explained for website owners

Learn what HTTP 500, 502 and 503 errors usually indicate, which layer to investigate, what evidence to collect, and when restarting a service is not the real fix.

Read the guide

Linux file permissions: ownership, modes, groups and ACLs explained

Understand Unix ownership and rwx modes, then use groups and ACLs where needed so services can access files without opening them to every user.

Read the guide

Moving a DreamHost VPS to Canadian hosting

Inventory the server, copy it safely, test it, and cut DNS over with a rollback plan.

Read the guide

More vps & linux guides

We will handle the move. You check it first.

Your current site stays online until your new one is ready. You approve the copy first, and if anything is not right we switch you back right away. The price you pick is the price you renew at.

Start my free moveSee plans and prices
See pricesFree move