Proxmox Network Security Using VLANs and Firewall Rules

Boost Proxmox network security with VLANs, firewall rules, and SSH hardening. Isolate traffic, block attacks, and cut latency for faster VM performance.

Proxmox Pulse Proxmox Pulse
8 min read
Abstract glass planes floating with glowing seams, symbolizing network traffic isolation and security.

Securing and segmenting your Proxmox network with VLANs, firewall rules, and SSH hardening prevents lateral movement and reduces your attack surface, giving you a resilient foundation for VMs and containers. This guide walks you through the exact steps to configure Linux bridges, apply Proxmox firewall rules, and lock down SSH so your infrastructure stays protected under load.

Key Takeaways

  • VLAN Segmentation: Isolates management, VM, and storage traffic to reduce broadcast noise and improve security.
  • Proxmox Firewall: Applies stateful rules at the hypervisor level, protecting VMs without guest-agent overhead.
  • SSH Hardening: Disabling password authentication and using fail2ban blocks brute-force attacks effectively.
  • Network Performance: Proper MTU tuning and bridge configuration can reduce latency for storage and VM traffic.

Why VLAN Segmentation Matters for Proxmox

Start with a clear picture of your network traffic. In a flat network, management, VM, and storage traffic share the same broadcast domain. This works fine for a small setup, but as you add more VMs and containers, broadcast storms and security blind spots become real problems. VLANs slice your physical network into logical segments, so a compromised VM in the "VM" VLAN can't easily reach your Proxmox management interface or storage backend.

For a deeper dive into the mechanics of Linux bridges and VLANs on Proxmox, check out Configuring VLANs on Proxmox with Linux Bridges. That post covers the exact configuration file syntax and how to verify your trunk ports.

The real win comes when you pair VLANs with the Proxmox firewall. Instead of configuring firewall rules inside every guest VM, you apply them at the hypervisor level. This means you get stateful inspection and port filtering without needing to install or update agents in each guest.

How to Configure Linux Bridges and VLANs

Your Proxmox host uses a Linux bridge to connect VMs and containers to the physical network. The default setup creates a single bridge (vmbr0) on the eth0 interface, but a production-ready setup assigns specific VLANs to different traffic types.

First, edit /etc/network/interfaces to define your bridge and VLANs. Here's a clean configuration that separates management, VM, and storage traffic:

auto eth0
iface eth0 inet manual

auto vmbr0
iface vmbr0 inet static
    address 192.168.1.10/24
    gateway 192.168.1.1
    bridge-ports eth0
    bridge-stp off
    bridge-fd 0

# Management VLAN (untagged)
auto vmbr0.100
iface vmbr0.100 inet manual
    bridge-ports none
    bridge-vlan-aware yes

# VM Traffic VLAN
auto vmbr0.200
iface vmbr0.200 inet manual
    bridge-ports none
    bridge-vlan-aware yes

# Storage Traffic VLAN
auto vmbr0.300
iface vmbr0.300 inet manual
    bridge-ports none
    bridge-vlan-aware yes

The bridge-vlan-aware yes directive tells the bridge to handle VLAN tagging natively. This is critical because it allows the bridge to forward tagged frames to the correct physical port while keeping untagged frames for the management interface.

After editing the file, restart the networking service to apply the changes:

systemctl restart networking

You can verify the bridge is working by checking the VLAN table:

bridge vlan show

You should see vmbr0 with VLANs 100, 200, and 300 listed, along with the physical port eth0 tagged for all three.

One common gotcha here is forgetting to set bridge-ports none for the sub-interfaces. If you leave bridge-ports eth0 on the VLAN sub-interfaces, you'll create a loop that can bring down your network. The main bridge handles the physical port, and the sub-interfaces just act as VLAN-aware endpoints.

Applying Proxmox Firewall Rules for Network Security

The Proxmox firewall operates at the hypervisor level, which means you don't need to configure firewalls inside every guest VM. This simplifies management and ensures consistent security policies across your infrastructure.

To enable the firewall, navigate to Datacenter > Firewall > Settings in the web interface and toggle "Enable Proxmox VE Firewall." You can also enable "Log Invalid Packets" to capture dropped traffic for troubleshooting.

Once enabled, you'll see a "Firewall" option in the left-hand menu. Here, you can create rules for specific networks, VMs, or containers. A typical rule set might look like this:

Rule Direction Protocol Port Action Description
100 IN TCP 22 ACCEPT Allow SSH from management VLAN
101 IN TCP 8006 ACCEPT Allow Proxmox web UI from management VLAN
102 IN TCP 80,443 ACCEPT Allow HTTP/HTTPS from VM VLAN
103 IN UDP 53 ACCEPT Allow DNS from all VLANs
104 OUT ALL ALL ACCEPT Allow all outbound traffic
105 IN ALL ALL DROP Default deny inbound

You can apply these rules globally or to specific VMs. For example, if you're running a Plex media server, you might restrict its inbound traffic to only port 32400 from the VM VLAN.

A practical tradeoff to consider is the overhead of the Proxmox firewall versus guest-level firewalls. The hypervisor firewall uses connection tracking, which adds a small amount of CPU overhead. For most homelab and production setups, this overhead is negligible, but if you're running a high-throughput VM with thousands of connections, you might see a slight performance impact. In those cases, you can disable the Proxmox firewall for that specific VM and rely on its internal firewall instead.

For more advanced network security, consider pairing the Proxmox firewall with Cloudflare Tunnel on Proxmox for Zero-Trust Remote Access. Cloudflare Tunnel eliminates the need for open ports in your firewall, adding an extra layer of security for remote access.

Hardening SSH and Installing fail2ban

SSH is your primary gateway to the Proxmox host, so securing it is essential. The first step is to disable password authentication and use SSH keys instead. This prevents brute-force attacks from guessing your password.

Edit /etc/ssh/sshd_config to update the SSH configuration:

PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin prohibit-password
MaxAuthTries 3
LoginGraceTime 30

After making these changes, restart the SSH service:

systemctl restart ssh

Next, install fail2ban to monitor SSH login attempts and automatically block IPs that exceed the failure threshold:

apt install fail2ban

Create a custom jail configuration in /etc/fail2ban/jail.local to tune the settings for Proxmox:

[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
bantime = 3600
findtime = 600
backend = systemd

The maxretry setting determines how many failed attempts trigger a ban. Setting it to 3 means an IP is blocked after three failed logins. The bantime of 3600 seconds (1 hour) provides a good balance between security and usability.

fail2ban integrates well with the Proxmox firewall. When an IP is banned, fail2ban can add a rule to the Proxmox firewall to drop traffic from that IP, preventing it from even reaching the SSH daemon. This reduces the load on the SSH service and improves overall security.

For cluster-wide brute-force defense, check out CrowdSec on Proxmox: Cluster-Wide Brute-Force Defense. CrowdSec extends fail2ban's capabilities by sharing threat intelligence across all nodes in your cluster.

Comparing VLAN Strategies for Homelab and Production

Different workloads benefit from different VLAN strategies. Here's a comparison of three common approaches:

Strategy VLANs Used Best For Pros Cons
Flat Network 1 Small homelabs Simple setup, low overhead Limited segmentation, broadcast storms
Multi-VLAN 3-5 Medium homelabs and production Good segmentation, manageable complexity Requires VLAN-aware switch
Full Segmentation 6+ Large production environments Maximum security, isolated traffic types Higher complexity, more VLANs to manage

For most homelab users, the multi-VLAN strategy strikes the right balance. You get meaningful segmentation without the overhead of managing dozens of VLANs. If you're running a production environment with strict security requirements, full segmentation might be worth the additional complexity.

To automate your VLAN configuration and health checks, consider using Automate Proxmox VE: Essential Scripts for Homelab Backups, Health Checks & VLANs. These scripts can verify your VLAN setup and alert you to potential issues before they become problems.

Conclusion

Securing and segmenting your Proxmox network with VLANs, firewall rules, and SSH hardening creates a resilient foundation that scales with your infrastructure. By isolating traffic, applying hypervisor-level firewall rules, and locking down SSH with fail2ban, you reduce your attack surface and improve overall network performance.

The next step is to audit your current network configuration and identify any untagged traffic that could benefit from VLAN segmentation. Once you've implemented these changes, you'll have a secure, well-organized network that supports both your current workloads and future growth.

Share
Proxmox Pulse

Written by

Proxmox Pulse

Sysadmin-driven guides for getting the most out of Proxmox VE in production and homelab environments.

Related Articles

View all →