Skip to content

Networking & Firewall

This section provides comprehensive coverage of Linux networking and firewall configuration, with particular focus on the complex interactions between UFW, Docker, KVM/libvirt, and LXC.

Why This Matters

A home server running virtualization and containers creates a complex networking environment where multiple tools manipulate the same underlying systems. Without understanding these interactions, you risk:

  • Security holes - Services exposed unintentionally
  • Broken connectivity - VMs or containers unable to reach the network
  • Debugging nightmares - Hours spent on issues caused by conflicting rules
  • False sense of security - UFW enabled but not actually protecting anything

Section Overview

Fundamentals

UFW

Docker Networking

KVM/libvirt Networking

LXC/LXD Networking

Integration & Conflicts

External Access

Troubleshooting

Reference

Quick Start

If you're setting up a new server, start with:

  1. UFW Fundamentals - Basic firewall setup
  2. Docker UFW Conflict - Understand the problem
  3. Docker UFW Solutions - Fix it
  4. Complete before.rules - Copy a working config

Key Takeaways

Docker Bypasses UFW

By default, Docker published ports are accessible from anywhere, regardless of UFW rules. See Docker UFW Conflict.

Multiple Tools, One iptables

Docker, libvirt, and LXD all manipulate iptables. They can conflict. See Multi-Technology Conflicts.

Use before.rules

Most integration issues are solved by properly configuring /etc/ufw/before.rules. See Complete before.rules.