VPC and firewall
This page explains how to isolate your customers' or projects' networks with VPCs, how to expose them to the Internet (NAT, floating IP, port forwarding), and how to manage the Proxmox firewall rules of hypervisors and machines, with or without templates.
Two menus are involved: VPC and Firewall.
What is a VPC?
A VPC (Virtual Private Cloud) is an isolated private network for a tenant (a customer, a project, a test environment). Each VPC has:
- its own subnet (CIDR) and gateway;
- a Proxmox SDN virtual network (VNet) on a zone of type
simple,vlan,vxlanorevpn; - its members: the VMs and LXCs connected to this network;
- its firewall: default policies and rules;
- optionally, a dedicated IPAM pool that provides the members' addresses.
By default, a VPC is isolated: traffic flows freely inside the VPC and to the Internet, but never to another VPC.
For the full technical details, read the VPC documentation and, if you have several data centers, Multi-datacenter VPC.
Create a VPC
- Open the VPC menu.
- Click New VPC.
- Fill in the Create VPC form:
| Field | Purpose |
|---|---|
| Name | VPC name, for example customer-acme. |
| Fabric / zone type | simple, vlan, vxlan or evpn. Auto (from settings) uses the default type. |
| Description | What this network is for. |
| CIDR | Tenant subnet, for example 10.20.0.0/24 (a /30 at the smallest). Empty = automatic allocation. A subnet that overlaps another VPC's subnet is refused. |
| VLAN/VXLAN tag | Empty = automatic allocation within the configured range. |
| IPAM pool | Auto-create a matching IPAM pool for this VPC checkbox. |
| Hypervisor | A standalone hypervisor, or Cluster-wide (any node). |
| Firewall preset | A ready-to-use preset, or Custom (no preset). |
| Firewall enabled, Isolate from other VPCs | Firewall switches. |
| Inbound policy, Outbound policy | ACCEPT, DROP or REJECT for traffic that matches no rule. |
- Click Create VPC. The message "VPC created - provisioning in the background" appears: the network is created in Proxmox in the background.
The presets are displayed in English:
| Preset | Inbound / Outbound | Use |
|---|---|---|
| Isolated tenant (egress only) | DROP / ACCEPT | The safe default choice: egress only, internal traffic allowed. |
| Locked down (deny all) | DROP / DROP | Block everything, then add your own allow rules. |
| Public web tier | DROP / ACCEPT | HTTP/HTTPS from the Internet, plus internal traffic. |
| Internal only (no internet) | DROP / DROP | No Internet, traffic stays inside the VPC. |
| Open (dev / no restriction) | ACCEPT / ACCEPT | Development only, no restrictions. |
Important: the zone type, the CIDR and the tag can no longer be changed after creation. Edit only changes the name, the description, the Tenant ID and the firewall settings. For anything else, recreate the VPC.
When the IPAM pool is created automatically, it is named vpc-<nom> (or vpc-<nom>-<vnet> if another VPC with the same name already has that pool). The gateway, the network address and the broadcast address are reserved in it. If the pool cannot be created, the VPC is not created either and the error is shown. This pool is used only by the VPC members. See Network and IPAM.
The defaults (supernet from which subnets are taken, prefix, VLAN/VXLAN ranges, bridge, MTU, tenant DNS resolvers, firewall policies, EVPN) are set in Settings → VPC.
Add machines to a VPC
Open a VPC. The Members section offers three buttons:
- Attach machines: connects existing machines to the VPC.
- Create VM / Create LXC: creates a machine directly in the VPC. Its address is taken from the VPC's pool.
The member list is paginated; Search members… searches by name, IP address, NIC, hypervisor or VMID across all members of the VPC, not only on the displayed page.
To attach existing machines:
- Click Attach machines.
- Select the machines (100 at most per operation).
- Enter the NIC to move (
net0by default). - Click Attach N.
PxVault reconnects the NIC to the VPC's VNet and, if the VPC has an IPAM pool, gives the machine an address from that pool (its former IPAM address is released). For a VM, the address is written to cloud-init and, if the QEMU guest agent responds, applied immediately. Otherwise, it is applied at the next boot.
To remove a machine, use the Detach machine action on its row. Its NIC goes back to the default bridge, the floating IPs and port forwards of this VPC that targeted the machine are deleted (their NAT rule too), the VPC firewall is removed from the machine (its rules, and its options: inbound and outbound policies, and firewall activation if the machine has no rules of its own), and its VPC address is returned to the VPC's pool. Reattach it later so it gets a new address, then recreate its floating IPs and port forwards.
Warning: the detached machine keeps its VPC address in its network configuration: PxVault never switches it to DHCP behind your back, which could cut it off from the network. A warning "The guest keeps its VPC address; use "Change network configuration" to change it." appears, with a button that opens the machine's Network tab: choose Change network configuration there to give it an address on the network it is now on.
Add a firewall rule to a VPC
VPC rules are abstract: you designate zones ("this VPC", "Internet", etc.) rather than IPs. PxVault translates them into Proxmox rules applied to the members.
- Open the VPC, Firewall rules section.
- Click Add rule.
- Fill in Direction (Inbound or Outbound), Action (
ACCEPT,DROP,REJECT), Protocol (any,tcp,udp,icmp), Source, Destination, Dest. port(s) (443,8000:8100or80,443), Source port(s), Comment, Rule enabled and, if needed, logging of matches. - Click Save rule.
Source and destination types:
| Type | Designates |
|---|---|
vpc |
The subnet of this VPC. |
any-vpc |
The subnets of all managed VPCs. |
vpc-ref |
A specific other VPC, chosen from a list. |
internet |
The Internet, excluding managed local networks. |
cidr |
A network, for example 10.0.0.0/8. |
ip |
A single address, for example 10.20.0.5. |
ipset |
A named set of IPs (alias). |
any |
Anywhere. |
Rules apply in order. Use Move up / Move down to reorder them (clear the search first). Without rules, traffic follows the VPC's default policies.
Tip: to allow two isolated VPCs to communicate, add an
ACCEPTrule whose source or destination isvpc-ref.
Expose a VPC to the Internet
A VPC's page contains three cards for its network edge.
Outbound Internet access (SNAT)
In Internet access (egress), choose the Egress mode then click Save egress:
- No Internet access: no outbound Internet access;
- Shared SNAT (one public IP): members go out behind a single public IP (Service IP field);
- Via exit-node(s): egress through the specified EVPN Exit nodes.
Allocate and bind a floating IP (1:1 NAT)
A floating IP links a public IP to one VPC member, with 1:1 NAT.
- On the Public / floating IPs card, click Allocate.
- Choose From a public pool (an IPAM pool of type Public; a Private pool is refused) or Specific address (reserved for accounts without scope restrictions). If IPAM manages this address, it switches to Reserved status there (it can no longer be given to a machine) and returns to its pool when released; an address already reserved or assigned in IPAM is refused.
- Confirm: the address is reserved for the VPC, with the "free" status. No NAT is in place yet.
- On the address row, click the Bind 1:1 to a member icon, choose the Target member, then Bind.
To undo the binding: Detach from member. To return the address to its pool and delete the NAT: Release IP, then Release.
Warning: the member must have a known private IP. Otherwise, the binding is refused. The NAT is applied on the hypervisor through its SSH access: the hypervisor must be enrolled (see Add a hypervisor).
Forward a port (DNAT)
- On the Port forwards card, click Add.
- Fill in Public IP, Public Port(s), Protocol (TCP or UDP), the Target member, the Target Port and a Comment.
- Confirm.
The target member must already be part of the VPC. A given public IP + port + protocol combination can only be published once across the whole installation.
Important: if the Require 2FA to expose option is on (Settings → VPC), a 2FA code (required by policy) field asks you for a fresh code for actions that expose the VPC (public IPs and port forwards).
Resync, reconcile or delete a VPC
- Apply / re-sync: recreates the network and reapplies the firewall in Proxmox.
- Reconcile: follows live-migrated VMs and moves firewall, NAT and floating IPs to their new hypervisor (this also happens at each sync).
- Delete: deletes the VPC, its rules and its network. Members are detached, its IPAM pool is deleted and its floating IPs are released. This action cannot be undone.
The Datacenters section lists the hypervisors where the VPC's network exists. Realize on… creates it on another hypervisor. Otherwise, it is created automatically when a machine is first attached.
On the VPC page, the Rules view groups the firewall rules, Internet egress, public IPs and port forwards of all VPCs.
Manage firewall rules for hypervisors and VMs
The Firewall menu manages the Proxmox firewall directly, at two levels:
- node: the firewall of the hypervisor itself;
- machine: the firewall of a VM or LXC.
The Proxmox datacenter (cluster) level is not managed from this page.
Choose the target
- Open Firewall.
- In Select a Hypervisor, choose an online hypervisor.
- Click the VM Selection button (to the right of the hypervisor): a panel opens with search, the status filter and the list of machines on this hypervisor. The button then shows the number of selected machines; the cross next to it clears the selection.
- no machine checked = node level (label Node-level (all VMs));
- one machine checked = that machine's rules;
- several machines checked = Multi-VM Mode: rules and templates apply to all checked machines.
The Enabled / Disabled button turns the target's firewall on or off (except in multi-VM mode). Refresh rules reloads the rules.
Add a firewall rule
- Click Add rule.
- Fill in:
| Field | Example |
|---|---|
| Direction | IN (inbound) or OUT (outbound) |
| Action | ACCEPT, DROP or REJECT |
| Protocol | TCP, UDP, ICMP, SCTP or Any |
| Macro | SSH, HTTP, DNS, etc. |
| Source / Destination | IP or CIDR, empty for all |
| Src Port / Dst Port | 8080 / 80,443 |
| Interface | net0 |
| Comment | Optional description |
| Rule enabled | Checked to enable it right away |
- Click Create rule (or Apply to N VMs in multi-VM mode).
In the table, each rule can be enabled or disabled, edited or deleted.
Tip: in Proxmox, a VM's rules only filter traffic if the firewall is also enabled at the datacenter level and on the VM's NIC (
firewalloption of the interface).
Use a firewall template
Templates are ready-to-use sets of rules, grouped by category: Web & Proxy, Administration, Databases, Mail, DNS & DHCP, Telephony / VoIP, Monitoring, Network & VPN, Containers, Applications. Examples: "Web Server", "SSH Only", "PostgreSQL", "WireGuard", "Docker Host".
- Choose the target (node, one VM or several VMs).
- Click Templates (or Use template in the table).
- Choose a template in Firewall Templates.
- Review the Rules that will be added: click a rule to edit it, or Add rule to add one.
- Click Apply. A report shows the rules applied per target.
Applying a template requires the administrator permission on the firewall.
Warning: a template adds its rules to the existing rules; it does not replace them. Applying the same template twice creates duplicates.