* superseded: [PATCH access-control/cluster/container/docs/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs}/qemu-server v3 00/45] sdn: add microsegmentation support
2026-10-27 8:54 10% [PATCH access-control/cluster/container/docs/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs}/qemu-server v3 00/45] " Hannes Laimer
` (3 preceding siblings ...)
2026-10-27 8:55 14% ` [PATCH pve-docs v3 45/45] sdn: add microsegmentation section Hannes Laimer
@ 2026-11-05 11:14 8% ` Hannes Laimer
4 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-11-05 11:14 UTC (permalink / raw)
To: pve-devel
superseded-by:
https://lore.proxmox.com/pve-devel/20261105111324.706922-1-h.laimer@proxmox.com
On 2026-10-27 09:56, Hannes Laimer wrote:
> This series adds group-based microsegmentation to SDN, enforced by eBPF
> programs on the guest interfaces. Assignments put guest interfaces into
> groups, and rules between groups decide which traffic passes. Sets that
> every rule treats the same share one identity, a 16-bit value that
> travels with the frame in the low bits of the packet mark. The host
> stamps it where a frame comes off the guest interface, so a guest cannot
> forge its own. A new zone option turns on VXLAN-GBP[2] for VXLAN and
> EVPN zones, which carries the identity across nodes. On a zone without
> it, traffic from another node arrives without an identity. An identity
> whose sets are gone after a config change is retired. Its value is
> reused only after a quarantine, since a frame stamped under the old
> config can still be in flight.
>
> The config in /etc/pve/sdn/microseg.cfg, with its API under
> /cluster/sdn/microseg and the ACL path /sdn/microseg, holds groups,
> rules and assignments and takes effect with an SDN apply. Groups can
> nest, and a member of a subgroup is in every group above it. A rule
> allows or denies traffic from a source predicate to a destination
> predicate at a priority. A predicate of the kind `any`, `all` or
> `exact` lists groups and matches an interface that has one of them, all
> of them, or those and no others. An `every` predicate lists none and
> matches each interface that has a group. Beyond the pair, a rule can be
> narrowed to a protocol and ports, an ICMP type, a firewall macro or
> non-first fragments. Which groups an interface has is determined by the
> assignments, an ordered list that matches interfaces by guest, tag or
> name regex. An interface takes the groups of the first one that covers
> it.
>
> Default is deny. Only interfaces that have at least one group assigned
> are enforced. Enforcement happens when a frame arrives at an enforced
> interface, so nothing is dropped on the way out of a guest's interface.
> Traffic from interfaces that are not enforced is untagged, which
> includes guests without groups on their NICs, the host and the outside.
> Such traffic has to be allowed explicitly with the built-in untagged
> group. Rules are stateless and directional, so a reply needs its own
> allow, or the rule is marked bidirectional. Stateless also means no
> reassembly, so fragments after the first carry no transport header. A
> narrowed rule matches them only when it is narrowed to fragments.
>
> The highest priority wins. At the same priority the rule with the more
> specific `all` or `exact` predicate decides, so a rule on a subgroup
> outranks the same rule on its parent. Equally specific rules deny if one
> of them denies. Narrowed rules are checked before the rules that decide
> the whole pair at the same priority.
>
> A guest interface gets its groups the moment it comes up, from the
> assignment that matches the guest at that moment. Changing the tags or
> the name of a running guest takes effect right after the config is
> written. The NICs get the groups the assignments now give them. Once no
> assignment matches the guest, their enforcement stops. A change that
> reaches the config another way, such as a restore or a migration, takes
> effect the next time the NIC comes up or at the next SDN apply. A tag
> or name the assignments match moves a guest between groups. So adding
> or removing such a tag, or renaming into or out of such a name, needs
> SDN.Use on /sdn/microseg besides the right to change the option.
> Putting a NIC on a vnet needs SDN.Use on the vnet the same way.
>
> As long as the policy has an assignment, every node keeps the programs
> and maps loaded, about 20 MiB plus what the pairs take. Without one, the
> nodes drop them. The BPF state does not survive a reboot, so a node
> applies the policy again at boot, before any guest starts. The programs
> are compiled into libpve-rs-perl, so an upgrade of that package applies
> the policy again as well.
>
> The SDN apply checks the policy against what a node can hold before it
> writes the running config, and refuses one that exceeds it. A node that
> cannot apply the policy fails its network reload task and keeps its
> previous enforcement. A node without loaded programs, as after a failed
> load at boot, starts no guest with an assigned interface until an apply
> or a reload succeeds there. A guest also does not start when its node
> cannot read or parse the running config, or cannot set up the
> enforcement of its assigned interface.
>
> ARP and neighbor solicitations/advertisements pass wherever either
> direction of a pair allows anything, so the two ends of a one-way allow
> can resolve each other's addresses. They also pass when the host itself
> sends them without an identity. That is how the suppression replies of
> an EVPN zone reach the guest. A frame the host turns around on the
> interface it came in on passes as a whole, since only the host can make
> one. Behind a firewall bridge the host's frames cannot be told from
> other unstamped ones, so an interface there takes these frames from
> every unstamped sender. The narrowed rules of a pair run first, so a
> narrowed rule that denies neighbor discovery still holds.
>
> In patch order, the series adds
> - proxmox-ebpf, the policy subsystem with the tc programs that stamp
> and check the identities
> - proxmox-ve-rs, the types, the identity engine and the desired state
> in proxmox-ve-config, and the new proxmox-microseg crate that hands
> the desired state to the subsystem
> - pve-cluster, microseg.cfg as an observed file
> - pve-access-control, the /sdn/microseg ACL path
> - proxmox-perl-rs, the config binding and the data plane binding in
> pve-rs
> - pve-network, the config, the API, the dry-run view, the zone option
> and the enforcement on interface plug and after a library upgrade
> - pve-manager, the panel, the dry-run view and the apply on network
> reload and at boot
> - qemu-server and pve-container, the immediate update of a running
> guest's NICs on a tag or name change, and SDN.Use for a tag or name
> the policy matches
> - pve-docs, documentation
>
> - pve-network needs pve-cluster, pve-access-control, pve-rs,
> pve-guest-common and ifupdown2 with the vxlan-gbp attribute
> - pve-manager needs pve-docs to build and pve-network and
> pve-access-control at runtime
> - pve-rs needs proxmox-microseg and proxmox-ve-config
> - qemu-server and pve-container need pve-network
> - proxmox-microseg needs proxmox-ebpf[1] and proxmox-ve-config
>
> The ifupdown2 vxlan-gbp attribute[2] is sent separately, and so is the
> pve-network patch that writes a VXLAN zone's local tunnel address[3].
> This series needs both. A GBP device that ifupdown2 changes in place
> drops every GBP frame afterward[4], and without[3] that happens when a
> VXLAN zone with GBP exists next to an EVPN zone. ifupdown2 gives the
> local tunnel address of the EVPN zone's interfaces to every VXLAN
> interface without one of its own, and on a reload sets that address on
> the VXLAN zone's live device.
>
> [1] https://lore.proxmox.com/pve-devel/20261019142413.2255644-1-h.laimer@proxmox.com/
> [2] https://lore.proxmox.com/pve-devel/20260828134708.692354-1-h.laimer@proxmox.com/
> [3] https://lore.proxmox.com/pve-devel/20260925134050.754528-1-h.laimer@proxmox.com/
> [4] https://lore.kernel.org/netdev/20261023-b4-vxlan-changelink-gbp-v1-0-f0d13951c09b@proxmox.com/
>
> note: I did also have this implemented with nft instead of ebpf as a
> dataplane. Without narrowing, packets per second (small UDP packets) was
> about the same, with multiple checks nft's rate went down, nothing super
> dramatic but about a 1.5-2x compared to eBPF (~140k vs ~250k). eBPF is
> also more flexible, in case we want to expand possible actions in the
> future, but replacing the dataplane is pretty simple which also allowed
> me to do the side-by-side testing.
>
>
> changelog
> v3:
> - the data plane is a library crate in the proxmox-ve-rs workspace that
> pve-rs binds, on a policy subsystem in proxmox-ebpf, no agent binary
> and no boot unit. A node loads the programs while the policy has an
> assignment and takes new programs on a package upgrade
> - the model changed in five places:
> * groups have no numeric mark and can form a hierarchy
> * assignments are an ordered list and an interface takes the groups
> of the first that covers it instead of the union of all
> * rules can be narrowed similar to how firewall rules work,
> additionally non-first fragments can be matched and an explicit
> bidirectional flag exists
> * at a priority tie the more specific rule decides
> * new `every` predicate that matches everything that has at least
> one group assigned
> - interface group (re)assignment happens whenever an interface comes
> up, sdn apply runs or the tags or name of a running guest change.
> Adding or removing a tag covered by an assignment, or renaming into
> or out of a name a regex assignment matches, now also needs SDN.Use
> on the policy, similar to how we check if a user is allowed to assign
> a vnet
> - if a node cannot apply the policy, its network reload task fails.
> while a node has no loaded programs, as after a failed load at boot,
> guests with an assigned NIC do not start on it. a nic with groups
> only comes up enforced
> - ARP and NS/NA are automatically allowed if there exists a (src,dst)
> -> [checks ->] allow in either direction, this is so address
> resolution for allowed connections is possible. Also host-generated
> ARP and NS/NA frames are allowed, this is specifically needed for
> EVPN suppression to work, and a frame the host turns around on the
> interface it came in on passes
> - api: section types and property keys are kebab-case, the endpoints
> check /sdn/microseg (a pve-access-control patch adds the ACL path),
> and the overview reports members, evaluation order and specificity
> instead of a realized state, plus the id space usage
> - rule and assignment ids are derived from their identifying fields,
> so those cannot change on an existing object
> - ui: a panel with the rule grid by priority, the assignments in match
> order, the dry-run view, the rule editor on the firewall's selectors,
> and a guest tab with its groups and rules
> - the SRv6 carrier and its bridge object are out, the ifupdown2
> vxlan-gbp attribute is a standalone patch, the zone option stays,
> docs rewritten
>
> v2:
> - core model reworked: each interface now holds a *set* of groups
> compiled into a per-NIC wire identity, replacing the single-group
> parent/child tree
> - rules gained explicit `src`/`dst` predicates (any/all/exact) and a
> `prio`, replacing the implicit tree-distance ordering
> - `untagged` is now a nameable built-in group (mark 0)
> - assignments are additive: a NIC's set is the union of all that
> resolve to it
> - added tag-matcher and name-regex assignments
> - rule and dynamic-assignment ids are now generated
> - identity allocation is fresh-first with quarantined reclamation, so
> churn cannot exhaust the id space
> - split the SRv6 carrier support into droppable tail patches
> - updated docs
> - updated cover-letter
>
>
> proxmox-ebpf:
>
> Hannes Laimer (3):
> build: keep the build directory out of the BPF objects
> policy: add the enforcement subsystem for guest interfaces
> policy: add a check for non-first fragments
>
> Cargo.toml | 1 +
> build.rs | 4 +
> debian/control | 6 +-
> src/bpf-shim/bpf/bpf_helpers.h | 1 +
> src/bpf-shim/vmlinux.h | 1 +
> src/lib.rs | 3 +
> src/policy/bpf/mark.h | 27 +
> src/policy/bpf/policy.bpf.c | 385 ++++++++++++
> src/policy/bpf/types.h | 75 +++
> src/policy/mod.rs | 1005 ++++++++++++++++++++++++++++++++
> src/policy/types.rs | 159 +++++
> src/subsystem.rs | 35 +-
> tests/common/mod.rs | 40 ++
> tests/policy.rs | 837 ++++++++++++++++++++++++++
> 14 files changed, 2573 insertions(+), 6 deletions(-)
> create mode 100644 src/policy/bpf/mark.h
> create mode 100644 src/policy/bpf/policy.bpf.c
> create mode 100644 src/policy/bpf/types.h
> create mode 100644 src/policy/mod.rs
> create mode 100644 src/policy/types.rs
> create mode 100644 tests/policy.rs
>
>
> proxmox-ve-rs:
>
> Hannes Laimer (11):
> ve-config: firewall: add a constructor for sctp matches
> ve-config: sdn: microseg: add identity allocation for group sets
> ve-config: sdn: microseg: add config types
> ve-config: sdn: microseg: add tag matcher
> ve-config: sdn: microseg: add name regex matcher
> ve-config: sdn: microseg: narrow rules by protocol and ports
> ve-config: sdn: microseg: add group hierarchy
> ve-config: firewall: expose protocol, icmp type and code numbers
> ve-config: sdn: microseg: add the desired state
> microseg: add a crate that applies the policy to a node's guest NICs
> microseg: add a rule option that matches non-first fragments
>
> Cargo.toml | 2 +
> proxmox-microseg/Cargo.toml | 20 +
> proxmox-microseg/debian/changelog | 5 +
> proxmox-microseg/debian/control | 46 +
> proxmox-microseg/debian/copyright | 18 +
> proxmox-microseg/debian/debcargo.toml | 7 +
> proxmox-microseg/debian/source/format | 1 +
> proxmox-microseg/src/ebpf.rs | 247 +++
> proxmox-microseg/src/lib.rs | 66 +
> proxmox-microseg/src/nic.rs | 120 ++
> proxmox-microseg/src/running_config.rs | 26 +
> proxmox-ve-config/src/firewall/fw_macros.rs | 7 +
> proxmox-ve-config/src/firewall/ports.rs | 65 +
> .../src/firewall/types/rule_match.rs | 63 +
> proxmox-ve-config/src/sdn/microseg/api.rs | 710 +++++++++
> .../src/sdn/microseg/identity.rs | 475 ++++++
> proxmox-ve-config/src/sdn/microseg/mod.rs | 1394 +++++++++++++++++
> proxmox-ve-config/src/sdn/microseg/state.rs | 616 ++++++++
> proxmox-ve-config/src/sdn/microseg/types.rs | 549 +++++++
> proxmox-ve-config/src/sdn/mod.rs | 1 +
> 20 files changed, 4438 insertions(+)
> create mode 100644 proxmox-microseg/Cargo.toml
> create mode 100644 proxmox-microseg/debian/changelog
> create mode 100644 proxmox-microseg/debian/control
> create mode 100644 proxmox-microseg/debian/copyright
> create mode 100644 proxmox-microseg/debian/debcargo.toml
> create mode 100644 proxmox-microseg/debian/source/format
> create mode 100644 proxmox-microseg/src/ebpf.rs
> create mode 100644 proxmox-microseg/src/lib.rs
> create mode 100644 proxmox-microseg/src/nic.rs
> create mode 100644 proxmox-microseg/src/running_config.rs
> create mode 100644 proxmox-ve-config/src/sdn/microseg/api.rs
> create mode 100644 proxmox-ve-config/src/sdn/microseg/identity.rs
> create mode 100644 proxmox-ve-config/src/sdn/microseg/mod.rs
> create mode 100644 proxmox-ve-config/src/sdn/microseg/state.rs
> create mode 100644 proxmox-ve-config/src/sdn/microseg/types.rs
>
>
> pve-cluster:
>
> Hannes Laimer (1):
> cfs: add 'sdn/microseg.cfg' to observed files
>
> src/PVE/Cluster.pm | 1 +
> src/pmxcfs/status.c | 1 +
> 2 files changed, 2 insertions(+)
>
>
> pve-access-control:
>
> Hannes Laimer (1):
> permissions: add ACL path for SDN microsegmentation
>
> src/PVE/AccessControl.pm | 1 +
> 1 file changed, 1 insertion(+)
>
>
> proxmox-perl-rs:
>
> Hannes Laimer (4):
> pve-rs: sdn: add microseg config binding
> pve-rs: sdn: microseg: bind the data plane
> pve-rs: sdn: microseg: check the data plane limits on render
> pve-rs: debian: fire the pve-microseg-update trigger on upgrade
>
> pve-rs/Cargo.toml | 2 +
> pve-rs/Makefile | 3 +
> pve-rs/debian/control | 1 +
> pve-rs/debian/triggers | 1 +
> pve-rs/src/bindings/sdn/microseg.rs | 350 ++++++++++++++++++++++++++++
> pve-rs/src/bindings/sdn/mod.rs | 1 +
> 6 files changed, 358 insertions(+)
> create mode 100644 pve-rs/src/bindings/sdn/microseg.rs
>
>
> pve-network:
>
> Hannes Laimer (10):
> sdn: zones: add vxlan-gbp option to vxlan and evpn zones
> sdn: microseg: add config, API and guest inventory
> sdn: dry-run: show pending microseg changes
> sdn: microseg: enforce the policy on guest NICs
> sdn: microseg: add tag matcher
> sdn: microseg: add name regex matcher
> sdn: microseg: add an update for a running NIC
> sdn: microseg: expose protocol, port and macro rule options
> sdn: microseg: allow nesting groups under a parent
> sdn: microseg: expose the fragments rule option
>
> debian/control | 1 +
> debian/libpve-network-perl.postinst | 21 +
> debian/triggers | 1 +
> src/PVE/API2/Network/SDN.pm | 47 +-
> src/PVE/API2/Network/SDN/Makefile | 2 +
> src/PVE/API2/Network/SDN/Microseg.pm | 236 +++++++++
> .../API2/Network/SDN/Microseg/Assignment.pm | 23 +
> src/PVE/API2/Network/SDN/Microseg/Base.pm | 382 ++++++++++++++
> src/PVE/API2/Network/SDN/Microseg/Group.pm | 17 +
> src/PVE/API2/Network/SDN/Microseg/Makefile | 11 +
> src/PVE/API2/Network/SDN/Microseg/Rule.pm | 22 +
> src/PVE/API2/Network/SDN/Zones.pm | 8 +
> src/PVE/Network/SDN.pm | 25 +
> src/PVE/Network/SDN/Makefile | 1 +
> src/PVE/Network/SDN/Microseg.pm | 494 ++++++++++++++++++
> src/PVE/Network/SDN/Zones.pm | 32 ++
> src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 8 +
> src/PVE/Network/SDN/Zones/VxlanPlugin.pm | 12 +
> .../zones/evpn/gbp/expected_controller_config | 77 +++
> .../zones/evpn/gbp/expected_sdn_interfaces | 45 ++
> src/test/zones/evpn/gbp/interfaces | 7 +
> src/test/zones/evpn/gbp/sdn_config | 26 +
> .../zones/vxlan/gbp/expected_sdn_interfaces | 17 +
> src/test/zones/vxlan/gbp/interfaces | 7 +
> src/test/zones/vxlan/gbp/sdn_config | 11 +
> 25 files changed, 1531 insertions(+), 2 deletions(-)
> create mode 100644 src/PVE/API2/Network/SDN/Microseg.pm
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Assignment.pm
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Base.pm
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Group.pm
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Makefile
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Rule.pm
> create mode 100644 src/PVE/Network/SDN/Microseg.pm
> create mode 100644 src/test/zones/evpn/gbp/expected_controller_config
> create mode 100644 src/test/zones/evpn/gbp/expected_sdn_interfaces
> create mode 100644 src/test/zones/evpn/gbp/interfaces
> create mode 100644 src/test/zones/evpn/gbp/sdn_config
> create mode 100644 src/test/zones/vxlan/gbp/expected_sdn_interfaces
> create mode 100644 src/test/zones/vxlan/gbp/interfaces
> create mode 100644 src/test/zones/vxlan/gbp/sdn_config
>
>
> pve-manager:
>
> Hannes Laimer (11):
> network: apply the microseg policy on reload
> pve-sdn-commit: apply the microseg policy at boot
> ui: sdn: zones: add vxlan-gbp checkbox to vxlan and evpn
> ui: sdn: add microsegmentation panel
> ui: sdn: dry-run: show pending microseg diff
> ui: sdn: microseg: add tag matcher
> ui: sdn: microseg: add name regex matcher
> ui: sdn: microseg: add narrowing to the rule form
> ui: sdn: microseg: show and edit the group hierarchy
> ui: sdn: microseg: add fragments option to the rule form
> ui: sdn: microseg: add a guest tab with its groups and rules
>
> PVE/API2/Network.pm | 31 +-
> bin/pve-sdn-commit | 47 ++-
> services/pve-sdn-commit.service | 1 +
> www/css/ext6-pve.css | 23 ++
> www/manager6/Makefile | 10 +
> www/manager6/Utils.js | 98 +++++
> www/manager6/data/PermPathStore.js | 1 +
> www/manager6/dc/Config.js | 8 +
> www/manager6/form/SDNMicrosegGroupSelector.js | 105 ++++++
> www/manager6/grid/FirewallRules.js | 2 +
> www/manager6/lxc/Config.js | 10 +
> www/manager6/qemu/Config.js | 10 +
> www/manager6/sdn/MicrosegView.js | 98 +++++
> www/manager6/sdn/SdnDiffView.js | 29 ++
> www/manager6/sdn/microseg/AssignmentEdit.js | 148 ++++++++
> www/manager6/sdn/microseg/AssignmentView.js | 195 ++++++++++
> www/manager6/sdn/microseg/Base.js | 262 ++++++++++++++
> www/manager6/sdn/microseg/GroupEdit.js | 40 +++
> www/manager6/sdn/microseg/GuestPanel.js | 117 ++++++
> www/manager6/sdn/microseg/RuleEdit.js | 285 +++++++++++++++
> www/manager6/sdn/microseg/RuleView.js | 338 ++++++++++++++++++
> www/manager6/sdn/microseg/Tree.js | 278 ++++++++++++++
> www/manager6/sdn/zones/EvpnEdit.js | 8 +
> www/manager6/sdn/zones/VxlanEdit.js | 11 +
> 24 files changed, 2126 insertions(+), 29 deletions(-)
> create mode 100644 www/manager6/form/SDNMicrosegGroupSelector.js
> create mode 100644 www/manager6/sdn/MicrosegView.js
> create mode 100644 www/manager6/sdn/microseg/AssignmentEdit.js
> create mode 100644 www/manager6/sdn/microseg/AssignmentView.js
> create mode 100644 www/manager6/sdn/microseg/Base.js
> create mode 100644 www/manager6/sdn/microseg/GroupEdit.js
> create mode 100644 www/manager6/sdn/microseg/GuestPanel.js
> create mode 100644 www/manager6/sdn/microseg/RuleEdit.js
> create mode 100644 www/manager6/sdn/microseg/RuleView.js
> create mode 100644 www/manager6/sdn/microseg/Tree.js
>
>
> qemu-server:
>
> Hannes Laimer (1):
> network: update the microseg enforcement on a tag or name change
>
> src/PVE/API2/Qemu.pm | 26 ++++++++++++++++++++++++++
> src/PVE/QemuServer.pm | 12 +++++++++++-
> src/PVE/QemuServer/Network.pm | 14 ++++++++++++++
> 3 files changed, 51 insertions(+), 1 deletion(-)
>
>
> pve-container:
>
> Hannes Laimer (1):
> lxc: update the microseg enforcement on a tag or hostname change
>
> src/PVE/API2/LXC/Config.pm | 3 +++
> src/PVE/LXC.pm | 28 ++++++++++++++++++++++++++++
> 2 files changed, 31 insertions(+)
>
>
> pve-docs:
>
> Hannes Laimer (2):
> sdn: zones: document the VXLAN-GBP option
> sdn: add microsegmentation section
>
> pvesdn.adoc | 403 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 403 insertions(+)
>
>
> Summary over all repositories:
> 98 files changed, 11514 insertions(+), 38 deletions(-)
>
^ permalink raw reply [relevance 8%]
* [PATCH pve-docs v4 45/45] sdn: add microsegmentation section
2026-11-05 11:12 9% [PATCH access-control/cluster/container/docs/manager/network/proxmox{,-ve-rs,-perl-rs}/qemu-server v4 " Hannes Laimer
` (2 preceding siblings ...)
2026-11-05 11:13 23% ` [PATCH pve-network v4 25/45] sdn: microseg: add tag matcher Hannes Laimer
@ 2026-11-05 11:13 14% ` Hannes Laimer
3 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-11-05 11:13 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
pvesdn.adoc | 411 ++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 399 insertions(+), 12 deletions(-)
diff --git a/pvesdn.adoc b/pvesdn.adoc
index ab1b2cd23c2f..af30c3903bab 100644
--- a/pvesdn.adoc
+++ b/pvesdn.adoc
@@ -147,6 +147,9 @@ following sections:
* xref:pvesdn_config_vnet[VNets]: Create virtual network bridges and
manage subnets
+* xref:pvesdn_config_microseg[Microsegmentation]: Segment traffic between
+ guests with group-based policies
+
The Options category allows adding and managing additional services to be used
in your SDN setup.
@@ -189,6 +192,83 @@ files located in '/etc/pve/sdn'.
// TODO: extend implementation and technology details.
+[[pvesdn_microseg_background]]
+Microsegmentation Enforcement
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The node enforces the xref:pvesdn_config_microseg[microsegmentation] policy in
+the kernel, at the network interface of the receiving guest. It checks each
+packet on its own, without connection tracking, and drops a denied packet
+without an answer. Nothing runs in the guest, so a guest cannot turn it off or
+get around it.
+
+Each set of groups that an assignment lists gets a 16-bit number, its group
+identity, and sets that every rule treats alike share one. The node marks every
+packet an assigned interface sends with the identity of that interface. When a
+packet reaches an assigned interface, the node checks the identity of the
+sender against the identity of the receiver. Addresses play no part in this.
+
+A guest cannot forge its identity, since the node sets it. The network between
+the nodes is trusted to carry the identity unchanged, as it is trusted with
+VLAN tags.
+
+On the node, the identity lives in the low 16 bits of the packet mark and stays
+there when the node routes a packet. Other uses of the mark, such as policy
+routing by fwmark or firewall mark rules, must leave these bits alone. A rule
+that matches on the mark masks them out, for example
+`fwmark 0x10000/0xffff0000`. A packet the node itself sends with a value in
+these bits counts as that identity.
+
+Between nodes, only VXLAN and EVPN zones with the *VXLAN-GBP* option carry the
+identity, in the VXLAN header (see xref:pvesdn_zone_plugin_vxlan[VXLAN Zones]
+and xref:pvesdn_zone_plugin_evpn[EVPN Zones]). On every other zone, traffic
+from another node arrives without an identity and counts as untagged. The
+policy is bound to the guest interface, not to the zone. An interface on a
+bridge outside the SDN, such as `vmbr0`, is enforced like one on a VNet.
+
+For each pair of a sending and a receiving identity that a rule allows or
+narrows, the node keeps a verdict and the checks of the narrowed rules. A
+narrowed rule needs one check per protocol and per combination of a source and a
+destination port range, so a destination port list of `80,443` needs two checks.
+There is room for 65535 identities, 1048576 pairs and 512 checks per pair. A
+pair with more than 7 checks keeps the rest in a list shared with the pairs that
+have the same ones, and there is room for 16384 such lists.
+
+An SDN apply refuses a policy over one of these limits and names the limit, so
+such a policy never reaches a node. An identity that is no longer needed stays
+reserved for an hour, and the overview counts it as retired.
+
+A guest starts on a node only if all of its assigned interfaces can be enforced
+there, and a migration fails on the target node where a start would fail. If a
+node cannot read the applied SDN configuration, no guest with a connected
+network interface starts on it, since the node cannot tell which interfaces are
+assigned.
+
+If a node cannot apply the policy during an SDN apply, its network reload task
+fails and the node keeps its previous enforcement. On a node without loaded
+programs, for example after a failed apply at boot, no guest with an assigned
+interface starts until a reload succeeds. If the node cannot load a new
+package's programs, the previous package's programs stay in place.
+
+NOTE: Nodes with and without microsegmentation support can run in the same
+cluster during an upgrade, but the SDN apply should only be run on the nodes
+that support it. An apply from a node without support leaves the assigned
+guests that start after it unenforced.
+
+The guest firewall still applies, so a packet has to pass both. A packet that
+microsegmentation drops gets no answer, even if the firewall is set to reject.
+
+With the guest firewall enabled, an interface usually sits behind its own
+firewall bridge, only the nftables firewall on a Linux bridge needs none. Behind
+a firewall bridge, the node cannot tell its own ARP and neighbor discovery
+replies from those of other senders. Such an interface therefore accepts both
+from every sender without an identity. Other interfaces accept them without an
+identity only from the node itself, or where a rule allows untagged traffic.
+
+WARNING: Behind a firewall bridge, an unassigned guest on the same VNet can
+answer ARP and neighbor discovery for addresses that are not its own. Only that
+guest's own firewall, filtering its IP and MAC addresses, prevents it.
+
[[pvesdn_config_zone]]
Zones
-----
@@ -311,12 +391,13 @@ MTU:: Because VXLAN encapsulation uses 50 bytes, the MTU needs to be 50 bytes
lower than the outgoing physical interface.
VXLAN-GBP:: Enable VXLAN Group Based Policy (GBP) on the zone's VXLAN
- interfaces. GBP carries a 16-bit group ID in the VXLAN header, taken from
- the packet mark on the sending node and restored on the receiving one.
- Every VTEP in the zone must have it enabled, since one without it drops
- GBP-tagged traffic. Zones that use the same VXLAN port on a node must agree
- on this option, an SDN apply refuses a configuration where they do not.
- Optional.
+ interfaces. xref:pvesdn_config_microseg[Microsegmentation] uses it to carry
+ an interface's group identity between nodes. GBP carries a 16-bit group ID
+ in the VXLAN header, taken from the packet mark on the sending node and
+ restored on the receiving one. Every VTEP in the zone must have it enabled,
+ since one without it drops GBP-tagged traffic. Zones that use the same
+ VXLAN port on a node must agree on this option, and an SDN apply refuses a
+ configuration where they do not. Optional.
NOTE: The kernel sets GBP only when it creates a VXLAN interface. Changing the
option on an existing zone therefore recreates the zone's VXLAN interfaces on
@@ -384,12 +465,13 @@ MTU:: Because VXLAN encapsulation uses 50 bytes, the MTU needs to be 50 bytes
defaults to 1450.
VXLAN-GBP:: Enable VXLAN Group Based Policy (GBP) on the zone's VXLAN
- interfaces. GBP carries a 16-bit group ID in the VXLAN header, taken from
- the packet mark on the sending node and restored on the receiving one.
- Every VTEP in the zone must have it enabled, since one without it drops
- GBP-tagged traffic. Zones that use the same VXLAN port on a node must agree
- on this option, an SDN apply refuses a configuration where they do not.
- Optional.
+ interfaces. xref:pvesdn_config_microseg[Microsegmentation] uses it to carry
+ an interface's group identity between nodes. GBP carries a 16-bit group ID
+ in the VXLAN header, taken from the packet mark on the sending node and
+ restored on the receiving one. Every VTEP in the zone must have it enabled,
+ since one without it drops GBP-tagged traffic. Zones that use the same
+ VXLAN port on a node must agree on this option, and an SDN apply refuses a
+ configuration where they do not. Optional.
NOTE: The kernel sets GBP only when it creates a VXLAN interface. Changing the
option on an existing zone therefore recreates the zone's VXLAN interfaces on
@@ -467,6 +549,311 @@ DNS Zone Prefix:: Add a prefix to the domain registration, like
<hostname>.prefix.<domain> Optional.
+[[pvesdn_config_microseg]]
+Microsegmentation
+-----------------
+
+Microsegmentation allows or denies traffic between groups of guests at their
+network interfaces, independent of their addresses. The node enforces it in the
+kernel, so a guest cannot turn it off, and a guest keeps its rules when it
+moves to another node.
+
+The policy consists of three kinds of objects. *Groups* are labels.
+*Assignments* put guest network interfaces into groups, by guest, by tag or by
+name. *Rules* allow or deny traffic from one set of groups to another. An
+interface that an assignment covers receives only what a rule allows, apart from
+address resolution.
+
+Microsegmentation is managed under `Datacenter -> SDN -> Microsegmentation`.
+The *Microsegmentation* tab of a guest shows the groups of its interfaces and
+the rules that apply to them. Changes to the policy take effect with the next
+SDN apply.
+
+Rules are stateless and apply to one direction, so a connection needs a rule
+for each direction, or one rule with *Both Directions* set. Traffic that does
+not come from a guest in a group, such as the replies of a gateway or a DHCP
+server, is untagged. It needs a rule with the built-in `untagged` group as the
+source.
+
+Between nodes, only VXLAN and EVPN zones with the *VXLAN-GBP* option carry the
+groups of a guest. On every other zone, traffic from another node arrives
+untagged. The guest firewall still applies, so a packet has to pass both. See
+xref:pvesdn_microseg_background[Microsegmentation Enforcement] for how the
+enforcement works and for its limits.
+
+Viewing the configuration needs `SDN.Audit` on the `/sdn/microseg` ACL path,
+changing it needs `SDN.Allocate` there. The guests an assignment covers are
+shown only where you have `VM.Audit` on the guest, as in the resource tree.
+
+[[pvesdn_microseg_group]]
+Groups
+~~~~~~
+
+A group is a label for guest interfaces. An interface gets its groups from the
+one assignment that covers it (see
+xref:pvesdn_microseg_assignment[Assignments]). Rules match the groups of an
+interface, never the interface itself.
+
+Groups can be nested. An interface in a subgroup is also in every group above
+it. With `database` a subgroup of `production`, an interface assigned
+`database` has both groups. An `any` or `all` match over `production` covers
+it, an `exact` match over `production` does not, and rules on `database` cover
+databases only.
+
+The groups that an `all` or `exact` match lists include the groups above them,
+so an `exact` match over `database` means `production` and `database`. A rule
+with such a match on a subgroup is therefore more specific than the same rule
+on the parent. Specificity decides a tie between rules of the same priority
+(see xref:pvesdn_microseg_rule[Rules]). An `any` match counts no groups.
+
+Group configuration options:
+
+Name:: 2 to 32 letters, digits, `-` and `_`, starting and ending with a letter
+ or digit. The name `untagged` and names shaped like a generated ID, such as
+ `vm100`, are reserved.
+
+Parent:: The group this one is a subgroup of. Optional.
+
+Comment:: A descriptive comment. Optional.
+
+NOTE: A group cannot be deleted while a rule names it, an assignment lists it,
+or it has subgroups.
+
+[[pvesdn_microseg_rule]]
+Rules
+~~~~~
+
+A rule allows or denies traffic from a source to a destination. Each side lists
+groups and a match kind, checked against the groups of the sending and of the
+receiving interface. The default is deny, so rules allow traffic, or deny part
+of what a broader rule allows. Traffic within one group needs a rule like any
+other.
+
+A rule applies to one direction. A TCP connection from `web` to `app` needs an
+allow from `web` to `app`, and one from `app` to `web` for the replies. A rule
+with *Both Directions* set is exactly that pair, the rule and its mirror with
+source and destination swapped.
+
+Two guests can only talk once they have resolved each other's addresses. ARP
+and the neighbor solicitations and advertisements of IPv6 therefore pass
+between a sender and a receiver in both directions as soon as a rule allows
+any traffic between them in one direction.
+
+They also pass when the node sends them itself. That is how the ARP replies of
+a gateway on the node and the suppression replies of an EVPN zone reach a
+guest. Nothing else passes without a rule.
+
+A rule can be narrowed to a protocol, ports or an ICMP type, like a firewall
+rule. A narrowed rule decides only the IP traffic it names. Anything that is
+not IP, ARP, LLDP or spanning tree for example, gets the verdict of the rules
+without narrowing.
+
+Narrowed rules are checked from the highest priority down to the priority of
+the highest rule without narrowing. At the same priority the more specific
+rule comes first, and of two equally specific rules the deny. The first
+narrowed rule that matches a packet decides it. Traffic that no narrowed rule
+matches gets the verdict of the rules without narrowing, or is denied if there
+are none.
+
+To allow SSH from `web` to `app`, allow `tcp` with destination port `22` from
+`web` to `app`, and `tcp` with source port `22` from `app` to `web` for the
+replies. One rule with *Both Directions* set and destination port `22` does the
+same, since the mirror swaps the ports. Either way the reply rule allows every
+segment from port `22`, not only replies, so `app` can also open connections to
+`web` from that port.
+
+NOTE: Neighbor discovery is ICMPv6, so a narrowed deny of ICMPv6 blocks it even
+where the reverse direction allows traffic.
+
+IP fragments after the first one carry no transport header. A rule narrowed by
+ports or an ICMP type never matches them, and neither does a rule narrowed to
+just a protocol. If only narrowed allows let traffic pass between a sender and a
+receiver, the later fragments are dropped and fragmented packets never arrive.
+
+An allow with *Fragments Only* set lets them pass. It also passes the later
+fragments of other datagrams, but those cannot be reassembled without their
+first fragment, which the other rules decide.
+
+An IPv6 fragment counts as the protocol its fragment header names. If that is
+an extension header instead of the transport protocol, a rule narrowed to the
+transport protocol does not match it, but a rule without a protocol does.
+
+An IPv6 packet with an authentication header counts both as AH and as the
+protocol behind the header, so a rule narrowed to either matches it.
+
+Where narrowed rules apply to a sender and a receiver, a packet whose transport
+header cannot be read is dropped, since the rules cannot be checked against it.
+Examples are a first fragment that ends before the transport header, an IPv6
+packet with more than 12 extension headers, and a packet with more than two
+VLAN tags. Where no narrowed rule applies, such a packet gets the same verdict
+as any other.
+
+The built-in `untagged` group stands for traffic without a group. It comes from
+an interface that no assignment covers, from a host outside the policy, or from
+another node over a zone without the *VXLAN-GBP* option. To allow such traffic,
+list `untagged` in the source of a rule, on its own or next to other groups
+with the `any` match. This is how the replies of a gateway, of a DHCP server or
+of any other host outside the policy reach a guest.
+
+NOTE: In a source with the `all` or `exact` match, `untagged` must be the only
+listed group, and an `every` source never includes it. A destination never
+matches `untagged`, since every enforced interface has a group. It can list
+`untagged` only next to other groups with the `any` match, where it has no
+effect. Assignments cannot use it.
+
+Rule configuration options:
+
+Source Groups/Dest. Groups:: The groups the sending or the receiving interface
+ is checked against. Not set with the `every` match.
+
+Source Match/Dest. Match:: How the listed groups compare with the groups of an
+ interface. `any` matches an interface that has at least one of them, `all`
+ one that has all of them, and `exact` one that has exactly the listed
+ groups. For `all` and `exact`, the listed groups include the groups above
+ them. `every` lists no groups and matches every assigned interface.
+ Optional, defaults to `any`.
+
+Priority:: A number from 0 to 65535. Among the rules without narrowing that
+ match a sender and a receiver, the highest priority decides, and among those
+ the most specific. The specificity of a rule is the number of groups its
+ `all` and `exact` matches list, the groups above them included, and an `any`
+ or `every` match counts none. Equally specific rules deny if one of them
+ denies. Optional, defaults to 0.
+
+Action:: Allow or deny.
+
+Protocol/Source port/Dest. port/ICMP type:: Narrow the rule, with the syntax of
+ firewall rules. Ports need a protocol that has ports, and an ICMP type needs
+ an ICMP protocol. Optional.
+
+Macro:: A firewall macro, for example `HTTPS` or `Ceph`, in place of the
+ protocol, ports and ICMP type. Not combined with them. Optional.
+
+Fragments Only:: Narrow the rule to the IP fragments after the first one, of
+ the given protocol or of every protocol. Not combined with ports, an ICMP
+ type or a macro. Optional.
+
+Both Directions:: Also apply the rule with source and destination swapped,
+ ports included. Not with the `untagged` group or an ICMP type, whether set
+ directly or through a macro such as `Ping`. Optional.
+
+Comment:: A descriptive comment. Optional.
+
+The source, the destination, the direction and the narrowing identify a rule,
+so they cannot be changed on an existing rule. Delete the rule and create it
+again instead. The priority, the action and the comment can be changed.
+
+[[pvesdn_microseg_assignment]]
+Assignments
+~~~~~~~~~~~
+
+An assignment puts guest network interfaces into a set of groups. Its matcher
+selects one guest, the guests with certain tags, or the guests whose name
+matches a regular expression. You choose the matcher when you add the
+assignment, with *Guest Assignment*, *Tag Assignment* or *Regex Assignment* in
+the *Add* menu.
+
+Assignments are an ordered list, checked from first to last. An interface gets
+exactly the groups of the first assignment that covers it, and later ones have
+no effect on it. A new assignment goes to the top unless you give it a
+position, and you can move an existing one. Place an assignment for a single
+guest above the tag or regex assignments that also cover that guest.
+Destroying a guest with `--purge` removes the assignments for that single
+guest, tag and regex assignments stay. The removal is pending like any other
+change to the assignments.
+
+An interface that no assignment covers is not enforced. All traffic reaches
+it, and its own traffic reaches enforced guests as untagged.
+
+A combination of groups needs one assignment that lists all of them, since an
+interface gets the groups of a single assignment. For guests tagged both `prod`
+and `web`, add a tag assignment with the `all` match over both tags that lists
+both groups. Place it above the assignments that match only one of the tags.
+
+Tag and regex matchers use the current tags and name of a guest. They are
+matched each time an interface of the guest comes up, so a new guest or a
+hot-plugged interface is enforced from the start. A change of a running guest's
+tags or name made with `qm set` or `pct set`, through the API or the web
+interface, takes effect immediately.
+
+Changes to the assignments themselves, their order included, are pending until
+the next SDN apply.
+
+NOTE: Moving an assignment usually changes only its own place, so only that
+assignment shows up as a pending change. After many moves to the same spot, all
+assignments are renumbered once and show up together.
+
+A tag or a name can put a guest into a group. Setting one that an assignment
+of the applied policy matches, at creation or later, therefore needs
+`SDN.Use` on `/sdn/microseg` besides the right to change the option. This
+applies to a tag change that moves the guest into or out of a tag
+assignment, and to a rename into or out of the names a regex assignment
+matches.
+
+Assignment configuration options:
+
+Guest:: (guest matcher) The VM or container.
+
+Tags:: (tag matcher) The guest tags to match. They are normalized like guest
+ tags, so their case matters only with a case-sensitive datacenter tag style.
+
+Tag Match:: (tag matcher) `any` matches a guest with at least one of the
+ listed tags, `all` one with all of them, and `exact` one with exactly these
+ tags. Optional, defaults to `any`.
+
+Name Regex:: (regex matcher) A regular expression in Rust syntax, ASCII only,
+ without backreferences or lookaround. It is matched anywhere in the VM name
+ or the container hostname, so anchor it with `^` and `$` for the whole name.
+ A VM without a name is never matched, not even by `.*`, since the `VM 100`
+ shown for it is not its name. A container created without a hostname gets
+ one like `CT100`, which is matched like any other name.
+
+Network Interface:: The number of a guest interface, from 0 to 31, `0` for
+ `net0`. Left empty, the assignment covers all interfaces of the guest.
+ Optional.
+
+Groups:: The groups that the covered interfaces get.
+
+Position:: The place in the list, 0 being the first. A position past the end
+ puts the assignment last. Left empty on an existing assignment, it keeps its
+ place. Optional, defaults to 0 for a new assignment.
+
+Comment:: A descriptive comment. Optional.
+
+The matcher fields and the network interface identify an assignment, so they
+cannot be changed on an existing one. Delete the assignment and create it
+again instead. The groups, the position and the comment can be changed.
+
+[[pvesdn_microseg_example]]
+Example
+~~~~~~~
+
+Web, application and database guests share one VNet and are tagged `web`,
+`app` and `db`. The web guests should reach the application guests, and those
+the databases, and nothing else.
+
+. Create the groups `web`, `app` and `db`.
+. For each tag, add a tag assignment that puts the guests with that tag into
+ the group of the same name.
+. Add a rule that allows `web` to `app` with *Both Directions* set, and one
+ that allows `app` to `db` the same way.
+. Add a rule that allows `untagged` to `web`, `app` and `db`, for the replies
+ of the gateway and the DHCP server.
+. Apply the SDN configuration.
+
+Web guests now reach the application guests, and those reach the databases.
+Traffic from web to database and traffic within a tier is dropped.
+
+NOTE: The rule for `untagged` also admits every guest on the VNet that no
+assignment covers. Either assign every guest, or narrow that rule to the
+protocols the outside traffic needs.
+
+To keep a staging environment apart from production, tag each guest with its
+environment as well and add the groups `prod` and `staging`. Then add one tag
+assignment per combination, such as `all` over `prod` and `web`, that lists
+both groups. In the rules, use the `all` match over the tier and the
+environment, for example `all` over `web` and `prod`.
+
[[pvesdn_config_controllers]]
Controllers
-----------
--
2.47.3
^ permalink raw reply related [relevance 14%]
* [PATCH pve-network v4 25/45] sdn: microseg: add tag matcher
2026-11-05 11:12 9% [PATCH access-control/cluster/container/docs/manager/network/proxmox{,-ve-rs,-perl-rs}/qemu-server v4 " Hannes Laimer
2026-11-05 11:12 10% ` [PATCH proxmox-ve-rs v4 13/45] microseg: add a crate that applies the policy to a node's guest NICs Hannes Laimer
2026-11-05 11:13 22% ` [PATCH pve-network v4 24/45] sdn: microseg: enforce the policy on " Hannes Laimer
@ 2026-11-05 11:13 23% ` Hannes Laimer
2026-11-05 11:13 14% ` [PATCH pve-docs v4 45/45] sdn: add microsegmentation section Hannes Laimer
3 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-11-05 11:13 UTC (permalink / raw)
To: pve-devel
A tag matcher binds every guest with the given tags to a set of
groups, guests created later included.
A tag the matchers name moves a guest between groups, an SDN change
like putting a NIC on a vnet. So a new permission check requires
SDN.Use on /sdn/microseg when a guest gains or loses such a tag.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
debian/control | 1 +
src/PVE/API2/Network/SDN/Microseg/Base.pm | 7 ++-
src/PVE/Network/SDN.pm | 1 +
src/PVE/Network/SDN/Microseg.pm | 59 ++++++++++++++++++-----
4 files changed, 56 insertions(+), 12 deletions(-)
diff --git a/debian/control b/debian/control
index 268f40186b6b..c8842ab3d37d 100644
--- a/debian/control
+++ b/debian/control
@@ -42,6 +42,7 @@ Description: Proxmox VE's SDN (Software Defined Network) stack
Package: libpve-network-api-perl
Architecture: all
Depends: libpve-common-perl (>= 9.0.2),
+ libpve-guest-common-perl,
pve-firewall (>= 5.1.0~),
pve-cluster (>= 9.0.1),
libpve-network-perl (= ${binary:Version}),
diff --git a/src/PVE/API2/Network/SDN/Microseg/Base.pm b/src/PVE/API2/Network/SDN/Microseg/Base.pm
index dde88d10c7b1..58ec75c6fb12 100644
--- a/src/PVE/API2/Network/SDN/Microseg/Base.pm
+++ b/src/PVE/API2/Network/SDN/Microseg/Base.pm
@@ -5,6 +5,7 @@ use warnings;
use PVE::Cluster;
use PVE::Exception qw(raise_param_exc);
+use PVE::GuestHelpers;
use PVE::JSONSchema qw(get_standard_option);
use PVE::Tools qw(extract_param);
@@ -85,7 +86,7 @@ my sub assert_non_empty_lists {
my ($param) = @_;
my $errors = {};
- for my $property (qw(src dst groups)) {
+ for my $property (qw(src dst groups tags)) {
my $value = $param->{$property};
$errors->{$property} = "must not be empty" if $value && !@$value;
}
@@ -108,6 +109,10 @@ my sub create_object {
my $lock_token = extract_param($param, 'lock-token');
$param->{type} = $type;
+ if ($param->{tags}) {
+ $param->{tags} = PVE::GuestHelpers::get_unique_tags($param->{tags}, 1);
+ }
+
PVE::Cluster::check_cfs_quorum();
mkdir("/etc/pve/sdn");
diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
index 0996de05794b..210553de685f 100644
--- a/src/PVE/Network/SDN.pm
+++ b/src/PVE/Network/SDN.pm
@@ -661,6 +661,7 @@ sub encode_value {
|| $key eq 'secondary-controllers'
|| $key eq 'redistribute'
|| $key eq 'groups'
+ || $key eq 'tags'
|| $key eq 'src'
|| $key eq 'dst'
) {
diff --git a/src/PVE/Network/SDN/Microseg.pm b/src/PVE/Network/SDN/Microseg.pm
index 9cfaf6b746ff..4b322dede8be 100644
--- a/src/PVE/Network/SDN/Microseg.pm
+++ b/src/PVE/Network/SDN/Microseg.pm
@@ -35,7 +35,7 @@ PVE::JSONSchema::register_standard_option(
cfs_register_file('sdn/microseg.cfg', \&parse_microseg_config, \&write_microseg_config);
-our $ASSIGNMENT_TYPES = ['guest-assignment'];
+our $ASSIGNMENT_TYPES = ['guest-assignment', 'tag-assignment'];
sub parse_microseg_config {
my ($filename, $raw) = @_;
@@ -223,7 +223,8 @@ sub assignment_properties {
$properties->{type} = {
type => 'string',
enum => $ASSIGNMENT_TYPES,
- description => "The matcher kind. 'guest-assignment' binds a specific guest.",
+ description => "The matcher kind. 'guest-assignment' binds a specific guest,"
+ . " 'tag-assignment' every guest carrying the matched tags.",
};
$properties->{vmid} = get_standard_option(
'pve-vmid',
@@ -233,6 +234,27 @@ sub assignment_properties {
description => "The guest whose NICs to bind.",
},
);
+ $properties->{tags} = {
+ type => 'array',
+ items => {
+ type => 'string',
+ format => 'pve-tag',
+ },
+ 'type-property' => 'type',
+ 'instance-types' => ['tag-assignment'],
+ description => "The guest tags to match. They are normalized like the tags on a"
+ . " guest, so case only matters with a case-sensitive datacenter tag style.",
+ };
+ $properties->{'tag-match'} = {
+ type => 'string',
+ enum => [@MATCH_KINDS],
+ optional => 1,
+ default => 'any',
+ 'type-property' => 'type',
+ 'instance-types' => ['tag-assignment'],
+ description => "How tags match. 'any' shares a listed tag, 'all' carries every"
+ . " listed tag, 'exact' equals the listed set.",
+ };
$properties->{iface} = {
type => 'integer',
minimum => 0,
@@ -268,10 +290,21 @@ sub optional_properties {
return { map { $_ => { $properties->{$_}->%*, optional => 1 } } keys $properties->%* };
}
+sub check_tag_access {
+ my ($rpcenv, $authuser, $old, $new) = @_;
+
+ my $old_tags = [PVE::Tools::split_list($old // '')];
+ my $new_tags = [PVE::Tools::split_list($new // '')];
+ my $policy = running_policy(PVE::Network::SDN::running_config());
+ return if !$policy->tag_match_changed($old_tags, $new_tags);
+ $rpcenv->check($authuser, '/sdn/microseg', ['SDN.Use']);
+}
+
sub guest_inventory {
my (%opts) = @_;
- my @props = map { "net$_" } 0 .. $MAX_NIC_INDEX;
+ # the data plane takes a guest's NICs from the node, so an apply leaves them out
+ my @props = ('tags', $opts{skip_nics} ? () : map { "net$_" } 0 .. $MAX_NIC_INDEX);
my $by_vmid = PVE::Cluster::get_guest_config_properties(\@props, $opts{vmid});
@@ -279,11 +312,14 @@ sub guest_inventory {
for my $vmid (sort { $a <=> $b } keys %$by_vmid) {
my $guest = $by_vmid->{$vmid};
+ my @tags = PVE::Tools::split_list($guest->{tags});
+
my @nics = grep { defined $guest->{"net$_"} } 0 .. $MAX_NIC_INDEX;
push @$inventory,
{
vmid => $vmid,
+ tags => \@tags,
nics => \@nics,
};
}
@@ -311,13 +347,13 @@ my sub parse_guest_nic {
return $iface =~ m/^(?:tap|veth)(\d+)i(\d+)$/;
}
-# the guest as the inventory lists it, with nothing but its vmid when it has no NICs
+# the guest as the inventory lists it, with nothing but its vmid when it has no tags
my sub guest_info {
my ($vmid) = @_;
- my ($guest) = guest_inventory(vmid => $vmid)->@*;
+ my ($guest) = guest_inventory(vmid => $vmid, skip_nics => 1)->@*;
- return $guest // { vmid => int($vmid), nics => [] };
+ return $guest // { vmid => int($vmid), tags => [], nics => [] };
}
# an unmounted pmxcfs reads like a config that was never committed, and enforcement would be dropped
@@ -358,11 +394,12 @@ sub apply_all {
eval {
my $lock = PVE::RS::SDN::Microseg::ExclusiveLock->new();
my $raw = read_running_config();
- $lock->apply($raw, guest_inventory())
- or !is_configured()
- or log_warn("microseg: the running config carries no microseg block, as written"
- . " before the upgrade or by a node without microsegmentation support, leaving"
- . " enforcement unchanged");
+ if (!$lock->apply($raw, guest_inventory(skip_nics => 1))) {
+ log_warn("microseg: the running config carries no microseg block, as written"
+ . " before the upgrade or by a node without microsegmentation support, leaving"
+ . " enforcement unchanged")
+ if is_configured();
+ }
};
die "microseg: failed to apply running config: $@" if $@;
}
--
2.47.3
^ permalink raw reply related [relevance 23%]
* [PATCH pve-network v4 24/45] sdn: microseg: enforce the policy on guest NICs
2026-11-05 11:12 9% [PATCH access-control/cluster/container/docs/manager/network/proxmox{,-ve-rs,-perl-rs}/qemu-server v4 " Hannes Laimer
2026-11-05 11:12 10% ` [PATCH proxmox-ve-rs v4 13/45] microseg: add a crate that applies the policy to a node's guest NICs Hannes Laimer
@ 2026-11-05 11:13 22% ` Hannes Laimer
2026-11-05 11:13 23% ` [PATCH pve-network v4 25/45] sdn: microseg: add tag matcher Hannes Laimer
2026-11-05 11:13 14% ` [PATCH pve-docs v4 45/45] sdn: add microsegmentation section Hannes Laimer
3 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-11-05 11:13 UTC (permalink / raw)
To: pve-devel
A guest NIC is enforced when it is plugged, and if attaching the
enforcement fails, so does the guest start. A full pass enforces
every guest NIC of the node. The package runs one when it is
configured and when libpve-rs-perl is upgraded, since the BPF
programs are compiled into that library.
A running config without a microseg block, as a version without
microseg support writes it, says nothing about the policy. A pass and
a plug leave enforcement as it is and warn where a policy is
configured.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
debian/libpve-network-perl.postinst | 21 +++++++++
debian/triggers | 1 +
src/PVE/Network/SDN/Microseg.pm | 70 ++++++++++++++++++++++++++++-
src/PVE/Network/SDN/Zones.pm | 5 +++
4 files changed, 96 insertions(+), 1 deletion(-)
diff --git a/debian/libpve-network-perl.postinst b/debian/libpve-network-perl.postinst
index 99faedf48f56..88e9675b6928 100644
--- a/debian/libpve-network-perl.postinst
+++ b/debian/libpve-network-perl.postinst
@@ -22,6 +22,18 @@ migrate_mac_cache() {
fi
}
+# The BPF programs are compiled into libpve-rs-perl, whose upgrade fires the
+# pve-microseg-update trigger so a full pass installs the new build. When both
+# packages are upgraded in one run, this package is only unpacked when the
+# library is set up, so dpkg drops the trigger and the configure runs the pass.
+apply_microseg() {
+ test -f /etc/pve/local/pve-ssl.pem || return 0
+ test -e /proxmox_install_mode && return 0
+
+ perl -MPVE::Network::SDN::Microseg -e 'PVE::Network::SDN::Microseg::apply_all()' \
+ || echo "applying the microsegmentation policy failed, run an SDN apply or a network reload"
+}
+
case "$1" in
configure)
# TODO: remove with PVE 9+
@@ -29,6 +41,15 @@ case "$1" in
migrate_ipam_db
migrate_mac_cache
fi
+ apply_microseg
+ ;;
+
+ triggered)
+ case " $2 " in
+ *" pve-microseg-update "*)
+ apply_microseg
+ ;;
+ esac
;;
esac
diff --git a/debian/triggers b/debian/triggers
index 59dd6885a5f9..30113fe73944 100644
--- a/debian/triggers
+++ b/debian/triggers
@@ -1 +1,2 @@
activate-noawait pve-api-updates
+interest-noawait pve-microseg-update
diff --git a/src/PVE/Network/SDN/Microseg.pm b/src/PVE/Network/SDN/Microseg.pm
index 152551db713c..9cfaf6b746ff 100644
--- a/src/PVE/Network/SDN/Microseg.pm
+++ b/src/PVE/Network/SDN/Microseg.pm
@@ -5,10 +5,14 @@ use warnings;
use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_write_file);
use PVE::JSONSchema qw(get_standard_option);
+use PVE::Network::SDN;
+use PVE::RESTEnvironment qw(log_warn);
use PVE::RPCEnvironment;
use PVE::Tools;
use PVE::RS::SDN::Microseg;
+use PVE::RS::SDN::Microseg::ExclusiveLock;
+use PVE::RS::SDN::Microseg::SharedLock;
PVE::JSONSchema::register_format(
'pve-sdn-microseg-id',
@@ -265,9 +269,11 @@ sub optional_properties {
}
sub guest_inventory {
+ my (%opts) = @_;
+
my @props = map { "net$_" } 0 .. $MAX_NIC_INDEX;
- my $by_vmid = PVE::Cluster::get_guest_config_properties(\@props);
+ my $by_vmid = PVE::Cluster::get_guest_config_properties(\@props, $opts{vmid});
my $inventory = [];
for my $vmid (sort { $a <=> $b } keys %$by_vmid) {
@@ -299,4 +305,66 @@ sub type_matches {
return (grep { $_ eq $got } @$want) ? 1 : 0;
}
+my sub parse_guest_nic {
+ my ($iface) = @_;
+
+ return $iface =~ m/^(?:tap|veth)(\d+)i(\d+)$/;
+}
+
+# the guest as the inventory lists it, with nothing but its vmid when it has no NICs
+my sub guest_info {
+ my ($vmid) = @_;
+
+ my ($guest) = guest_inventory(vmid => $vmid)->@*;
+
+ return $guest // { vmid => int($vmid), nics => [] };
+}
+
+# an unmounted pmxcfs reads like a config that was never committed, and enforcement would be dropped
+my sub read_running_config {
+ PVE::Cluster::check_cfs_is_mounted();
+ return PVE::Cluster::get_config('sdn/.running-config');
+}
+
+# a config that cannot be read may still hold a policy
+my sub is_configured {
+ my $sections = eval { config()->to_sections() };
+ return !defined($sections) || scalar(%$sections);
+}
+
+sub apply_interface {
+ my ($iface, $firewall_bridge) = @_;
+
+ my ($vmid) = parse_guest_nic($iface);
+ return if !defined($vmid);
+
+ $firewall_bridge = $firewall_bridge ? 1 : 0;
+
+ my $lock = PVE::RS::SDN::Microseg::SharedLock->new();
+ my $raw = read_running_config();
+ my $guest = guest_info($vmid);
+ # without the block the plug cannot tell an assigned interface from any other. Refusing by the
+ # pending config would act on a policy nobody applied, and refusing every interface would stop
+ # every guest start while an older node's apply stands, so the guest comes up with a warning
+ if (!$lock->apply_iface($raw, $guest, $iface, $firewall_bridge)) {
+ log_warn("microseg: the running config carries no microseg block, as written before the"
+ . " upgrade or by a node without microsegmentation support, leaving '$iface' as"
+ . " it is")
+ if is_configured();
+ }
+}
+
+sub apply_all {
+ eval {
+ my $lock = PVE::RS::SDN::Microseg::ExclusiveLock->new();
+ my $raw = read_running_config();
+ $lock->apply($raw, guest_inventory())
+ or !is_configured()
+ or log_warn("microseg: the running config carries no microseg block, as written"
+ . " before the upgrade or by a node without microsegmentation support, leaving"
+ . " enforcement unchanged");
+ };
+ die "microseg: failed to apply running config: $@" if $@;
+}
+
1;
diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
index c7345907c67c..d7905a71ac21 100644
--- a/src/PVE/Network/SDN/Zones.pm
+++ b/src/PVE/Network/SDN/Zones.pm
@@ -17,6 +17,7 @@ use PVE::Network::SDN::Dns;
use PVE::Network::SDN::Fabrics;
use PVE::Network::SDN::Ipams;
use PVE::Network::SDN::Vnets;
+use PVE::Network::SDN::Microseg;
use PVE::Network::SDN::Zones::VlanPlugin;
use PVE::Network::SDN::Zones::QinQPlugin;
use PVE::Network::SDN::Zones::VxlanPlugin;
@@ -380,6 +381,10 @@ sub veth_create {
sub tap_plug {
my ($iface, $bridge, $tag, $firewall, $trunks, $rate) = @_;
+ # attach enforcement before bridging, so an assigned NIC never passes traffic unenforced
+ eval { PVE::Network::SDN::Microseg::apply_interface($iface, $firewall) };
+ die "microseg: refusing to bring up '$iface' unenforced: $@" if $@;
+
my $vnet = PVE::Network::SDN::Vnets::get_vnet($bridge, 1);
if (!$vnet) { # fallback for classic bridge
my $interfaces_config = PVE::INotify::read_file('interfaces');
--
2.47.3
^ permalink raw reply related [relevance 22%]
* [PATCH proxmox-ve-rs v4 13/45] microseg: add a crate that applies the policy to a node's guest NICs
2026-11-05 11:12 9% [PATCH access-control/cluster/container/docs/manager/network/proxmox{,-ve-rs,-perl-rs}/qemu-server v4 " Hannes Laimer
@ 2026-11-05 11:12 10% ` Hannes Laimer
2026-11-05 11:13 22% ` [PATCH pve-network v4 24/45] sdn: microseg: enforce the policy on " Hannes Laimer
` (2 subsequent siblings)
3 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-11-05 11:12 UTC (permalink / raw)
To: pve-devel
The crate hands the microseg policy of the SDN running config to the
policy subsystem of proxmox-ebpf. A full pass applies it to every
guest NIC on the node, a plug to a single NIC that is about to come
up. A validation needs only the config and tells whether the data
plane can hold it.
Only the microseg block of the running config is parsed. A plug runs
for every guest NIC, so a zone or DHCP type that this node's
proxmox-ve-config does not know yet must not keep guests from
starting. The SDN apply on such a node fails either way.
A guest's NICs come from the interfaces on the node and not from its
config, since the config names a hot-plugged NIC only after the
hotplug.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
Cargo.toml | 2 +
proxmox-microseg/Cargo.toml | 20 +++
proxmox-microseg/debian/changelog | 5 +
proxmox-microseg/debian/control | 46 +++++
proxmox-microseg/debian/copyright | 18 ++
proxmox-microseg/debian/debcargo.toml | 7 +
proxmox-microseg/debian/source/format | 1 +
proxmox-microseg/src/ebpf.rs | 237 +++++++++++++++++++++++++
proxmox-microseg/src/lib.rs | 66 +++++++
proxmox-microseg/src/nic.rs | 120 +++++++++++++
proxmox-microseg/src/running_config.rs | 26 +++
11 files changed, 548 insertions(+)
create mode 100644 proxmox-microseg/Cargo.toml
create mode 100644 proxmox-microseg/debian/changelog
create mode 100644 proxmox-microseg/debian/control
create mode 100644 proxmox-microseg/debian/copyright
create mode 100644 proxmox-microseg/debian/debcargo.toml
create mode 100644 proxmox-microseg/debian/source/format
create mode 100644 proxmox-microseg/src/ebpf.rs
create mode 100644 proxmox-microseg/src/lib.rs
create mode 100644 proxmox-microseg/src/nic.rs
create mode 100644 proxmox-microseg/src/running_config.rs
diff --git a/Cargo.toml b/Cargo.toml
index 72d4cb6812e7..8d484d1d3301 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,6 +3,7 @@ members = [
"proxmox-ve-config",
"proxmox-frr",
"proxmox-sdn-types",
+ "proxmox-microseg",
]
exclude = [
"build",
@@ -30,3 +31,4 @@ proxmox-network-types = { version = "1.1.2" }
proxmox-schema = { version = "5.6" }
proxmox-sdn-types = { version = "0.2.5", path = "proxmox-sdn-types" }
proxmox-serde = { version = "1.0.0" }
+proxmox-ve-config = { version = "0.11", path = "proxmox-ve-config" }
diff --git a/proxmox-microseg/Cargo.toml b/proxmox-microseg/Cargo.toml
new file mode 100644
index 000000000000..067b0f593990
--- /dev/null
+++ b/proxmox-microseg/Cargo.toml
@@ -0,0 +1,20 @@
+[package]
+name = "proxmox-microseg"
+description = "Proxmox VE SDN microsegmentation data plane"
+version = "0.1.0"
+authors.workspace = true
+edition.workspace = true
+license.workspace = true
+homepage.workspace = true
+exclude.workspace = true
+# proxmox-ebpf needs it
+rust-version = "1.88"
+
+[dependencies]
+anyhow = { workspace = true }
+log = "0.4"
+serde = { workspace = true, features = [ "derive" ] }
+serde_json = "1"
+
+proxmox-ebpf = { version = "0.1", features = [ "policy" ] }
+proxmox-ve-config = { workspace = true }
diff --git a/proxmox-microseg/debian/changelog b/proxmox-microseg/debian/changelog
new file mode 100644
index 000000000000..e8f8ee14dcf9
--- /dev/null
+++ b/proxmox-microseg/debian/changelog
@@ -0,0 +1,5 @@
+rust-proxmox-microseg (0.1.0) trixie; urgency=medium
+
+ * Initial release.
+
+ -- Proxmox Support Team <support@proxmox.com> Tue, 22 Sep 2026 16:02:32 +0200
diff --git a/proxmox-microseg/debian/control b/proxmox-microseg/debian/control
new file mode 100644
index 000000000000..69ba35b2b37b
--- /dev/null
+++ b/proxmox-microseg/debian/control
@@ -0,0 +1,46 @@
+Source: rust-proxmox-microseg
+Section: rust
+Priority: optional
+Build-Depends: debhelper-compat (= 13),
+ dh-sequence-cargo
+Build-Depends-Arch: cargo:native <!nocheck>,
+ rustc:native (>= 1.88) <!nocheck>,
+ libstd-rust-dev <!nocheck>,
+ librust-anyhow-1+default-dev <!nocheck>,
+ librust-log-0.4+default-dev <!nocheck>,
+ librust-proxmox-ebpf-0.1+default-dev <!nocheck>,
+ librust-proxmox-ebpf-0.1+policy-dev <!nocheck>,
+ librust-proxmox-ve-config-0.11+default-dev <!nocheck>,
+ librust-serde-1+default-dev <!nocheck>,
+ librust-serde-1+derive-dev <!nocheck>,
+ librust-serde-json-1+default-dev <!nocheck>
+Maintainer: Proxmox Support Team <support@proxmox.com>
+Standards-Version: 4.7.2
+Vcs-Git: git://git.proxmox.com/git/proxmox-ve-rs.git
+Vcs-Browser: https://git.proxmox.com/?p=proxmox-ve-rs.git
+Homepage: https://proxmox.com
+X-Cargo-Crate: proxmox-microseg
+
+Package: librust-proxmox-microseg-dev
+Architecture: any
+Multi-Arch: same
+Depends:
+ ${misc:Depends},
+ librust-anyhow-1+default-dev,
+ librust-log-0.4+default-dev,
+ librust-proxmox-ebpf-0.1+default-dev,
+ librust-proxmox-ebpf-0.1+policy-dev,
+ librust-proxmox-ve-config-0.11+default-dev,
+ librust-serde-1+default-dev,
+ librust-serde-1+derive-dev,
+ librust-serde-json-1+default-dev
+Provides:
+ librust-proxmox-microseg+default-dev (= ${binary:Version}),
+ librust-proxmox-microseg-0-dev (= ${binary:Version}),
+ librust-proxmox-microseg-0+default-dev (= ${binary:Version}),
+ librust-proxmox-microseg-0.1-dev (= ${binary:Version}),
+ librust-proxmox-microseg-0.1+default-dev (= ${binary:Version}),
+ librust-proxmox-microseg-0.1.0-dev (= ${binary:Version}),
+ librust-proxmox-microseg-0.1.0+default-dev (= ${binary:Version})
+Description: Proxmox VE SDN microsegmentation data plane - Rust source code
+ Source code for Debianized Rust crate "proxmox-microseg"
diff --git a/proxmox-microseg/debian/copyright b/proxmox-microseg/debian/copyright
new file mode 100644
index 000000000000..77952eba571e
--- /dev/null
+++ b/proxmox-microseg/debian/copyright
@@ -0,0 +1,18 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+Files:
+ *
+Copyright: 2019 - 2026 Proxmox Server Solutions GmbH <support@proxmox.com>
+License: AGPL-3.0-or-later
+ This program is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Affero General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option) any
+ later version.
+ .
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+ details.
+ .
+ You should have received a copy of the GNU Affero General Public License along
+ with this program. If not, see <https://www.gnu.org/licenses/>.
diff --git a/proxmox-microseg/debian/debcargo.toml b/proxmox-microseg/debian/debcargo.toml
new file mode 100644
index 000000000000..87a787e6d03e
--- /dev/null
+++ b/proxmox-microseg/debian/debcargo.toml
@@ -0,0 +1,7 @@
+overlay = "."
+crate_src_path = ".."
+maintainer = "Proxmox Support Team <support@proxmox.com>"
+
+[source]
+vcs_git = "git://git.proxmox.com/git/proxmox-ve-rs.git"
+vcs_browser = "https://git.proxmox.com/?p=proxmox-ve-rs.git"
diff --git a/proxmox-microseg/debian/source/format b/proxmox-microseg/debian/source/format
new file mode 100644
index 000000000000..89ae9db8f88b
--- /dev/null
+++ b/proxmox-microseg/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/proxmox-microseg/src/ebpf.rs b/proxmox-microseg/src/ebpf.rs
new file mode 100644
index 000000000000..b057c4c51160
--- /dev/null
+++ b/proxmox-microseg/src/ebpf.rs
@@ -0,0 +1,237 @@
+use anyhow::{Context, bail};
+use proxmox_ebpf::policy::{self, Assignment, CHECK_MAX, CheckEntry, Family, Pair, Pass};
+use proxmox_ve_config::firewall::types::port::{PortEntry, PortList};
+use proxmox_ve_config::firewall::types::rule_match::{
+ IcmpCode, IcmpType, Icmpv6Code, Icmpv6Type, Ports, Protocol,
+};
+use proxmox_ve_config::sdn::microseg::MicrosegRunningConfig;
+use proxmox_ve_config::sdn::microseg::state::{self, DesiredState};
+
+use crate::nic::{self, LocalNics};
+
+pub use proxmox_ebpf::policy::{ExclusiveLock, PAIRS_MAX, SharedLock, lock_exclusive, lock_shared};
+
+fn port_bounds(list: Option<&PortList>) -> Vec<Option<(u16, u16)>> {
+ let Some(list) = list else {
+ // without a port list every port matches
+ return vec![None];
+ };
+ list.iter()
+ .map(|entry| {
+ Some(match entry {
+ PortEntry::Port(port) => (*port, *port),
+ PortEntry::Range(from, to) => (*from, *to),
+ })
+ })
+ .collect()
+}
+
+/// One entry per combination of source and destination range, since an entry carries a single range
+/// of each and both have to match.
+fn port_entries(ip_proto: u8, ports: &Ports, allow: bool) -> Vec<CheckEntry> {
+ let dports = port_bounds(ports.dport());
+ let mut entries = Vec::new();
+ for sport in port_bounds(ports.sport()) {
+ for &dport in &dports {
+ entries.push(CheckEntry {
+ ip_proto: Some(ip_proto),
+ sport,
+ dport,
+ allow,
+ ..Default::default()
+ });
+ }
+ }
+ entries
+}
+
+fn protocol_entries(protocol: &Protocol, allow: bool) -> anyhow::Result<Vec<CheckEntry>> {
+ let Some(ip_proto) = protocol.number() else {
+ bail!("protocol {protocol:?} was not resolved to a number");
+ };
+ Ok(match protocol {
+ Protocol::Tcp(tcp) => port_entries(ip_proto, tcp.ports(), allow),
+ Protocol::Udp(udp) => port_entries(ip_proto, udp.ports(), allow),
+ Protocol::Sctp(sctp) => port_entries(ip_proto, sctp.ports(), allow),
+ Protocol::Dccp(ports) | Protocol::UdpLite(ports) => port_entries(ip_proto, ports, allow),
+ // an icmp match covers IPv4 frames and an icmpv6 match IPv6 frames, which the protocol
+ // number alone does not say
+ Protocol::Icmp(icmp) => vec![CheckEntry {
+ ip_proto: Some(ip_proto),
+ family: Family::V4,
+ icmp_type: icmp.ty().and_then(IcmpType::number),
+ icmp_code: icmp.code().map(IcmpCode::number),
+ allow,
+ ..Default::default()
+ }],
+ Protocol::Icmpv6(icmpv6) => vec![CheckEntry {
+ ip_proto: Some(ip_proto),
+ family: Family::V6,
+ icmp_type: icmpv6.ty().and_then(Icmpv6Type::number),
+ icmp_code: icmpv6.code().map(Icmpv6Code::number),
+ allow,
+ ..Default::default()
+ }],
+ Protocol::Named(_) | Protocol::Numeric(_) => vec![CheckEntry {
+ ip_proto: Some(ip_proto),
+ allow,
+ ..Default::default()
+ }],
+ })
+}
+
+/// Pairs share checks, so translate each check once up front instead of once per pair.
+fn check_entries(state: &DesiredState) -> anyhow::Result<Vec<Vec<CheckEntry>>> {
+ let mut checks = Vec::with_capacity(state.checks.len());
+ for check in &state.checks {
+ let mut entries = Vec::new();
+ for protocol in &check.protocols {
+ entries.extend(protocol_entries(protocol, check.allow)?);
+ }
+ checks.push(entries);
+ }
+ Ok(checks)
+}
+
+fn pair_entries(
+ checks: &[Vec<CheckEntry>],
+ list: &[usize],
+ pair: &state::Pair,
+ cfg: &MicrosegRunningConfig,
+) -> anyhow::Result<Vec<CheckEntry>> {
+ let mut entries = Vec::new();
+ for &check in list {
+ entries.extend_from_slice(&checks[check]);
+ }
+ // proxmox-ebpf refuses such a pair as well, but cannot name the classes by their groups
+ if entries.len() > CHECK_MAX {
+ bail!(
+ "pair {} -> {} needs {} checks, a pair holds at most {CHECK_MAX}",
+ cfg.describe_class(pair.src_id),
+ cfg.describe_class(pair.dst_id),
+ entries.len(),
+ );
+ }
+ Ok(entries)
+}
+
+fn pairs(state: &DesiredState, cfg: &MicrosegRunningConfig) -> anyhow::Result<Vec<Pair>> {
+ let checks = check_entries(state)?;
+ let mut pairs = Vec::with_capacity(state.pairs.len());
+ for pair in &state.pairs {
+ pairs.push(Pair {
+ src_id: pair.src_id,
+ dst_id: pair.dst_id,
+ checks: pair_entries(&checks, &state.lists[pair.list], pair, cfg)?,
+ allow: pair.allow,
+ });
+ }
+ Ok(pairs)
+}
+
+pub struct FullPass {
+ configured: bool,
+ assignments: Vec<Assignment>,
+ pairs: Vec<Pair>,
+}
+
+pub fn full_pass(
+ nics: &LocalNics,
+ state: &DesiredState,
+ cfg: &MicrosegRunningConfig,
+) -> anyhow::Result<FullPass> {
+ let assignments = state
+ .nics
+ .iter()
+ .map(|resolved| {
+ let Some(name) = nics.name(resolved.vmid, resolved.iface) else {
+ bail!(
+ "NIC vm{} net{} has no interface on this node",
+ resolved.vmid,
+ resolved.iface
+ );
+ };
+ Ok(Assignment {
+ iface: name.to_owned(),
+ id: resolved.id,
+ firewall_bridge: nic::behind_firewall_bridge(name),
+ })
+ })
+ .collect::<anyhow::Result<Vec<_>>>()?;
+ Ok(FullPass {
+ configured: state.configured,
+ assignments,
+ pairs: pairs(state, cfg)?,
+ })
+}
+
+pub fn check(state: &DesiredState, cfg: &MicrosegRunningConfig) -> anyhow::Result<()> {
+ policy::check(&pairs(state, cfg)?).context("the data plane cannot take the microseg policy")
+}
+
+pub fn apply(lock: &mut ExclusiveLock, pass: &FullPass) -> anyhow::Result<()> {
+ let applied = lock.apply(pass.configured, &pass.assignments, &pass.pairs)?;
+ if applied != Pass::Applied {
+ return Ok(());
+ }
+ let level = if pass.assignments.is_empty() {
+ log::Level::Debug
+ } else {
+ log::Level::Info
+ };
+ log::log!(
+ level,
+ "microseg: applied {} assigned NICs on this node, {} pairs",
+ pass.assignments.len(),
+ pass.pairs.len()
+ );
+ Ok(())
+}
+
+#[cfg(test)]
+mod tests {
+ use proxmox_ve_config::firewall::types::rule_match::Tcp;
+ use proxmox_ve_config::sdn::microseg::state::Check;
+
+ use super::*;
+
+ fn ports(list: &str) -> PortList {
+ list.parse().expect("valid port list")
+ }
+
+ /// The entries depend on nothing but the one check.
+ fn state(protocols: Vec<Protocol>) -> DesiredState {
+ DesiredState {
+ configured: true,
+ pairs: vec![state::Pair {
+ src_id: 1,
+ dst_id: 2,
+ list: 0,
+ allow: false,
+ }],
+ checks: vec![Check {
+ protocols,
+ allow: true,
+ }],
+ lists: vec![vec![0]],
+ nics: Vec::new(),
+ }
+ }
+
+ #[test]
+ fn check_rejects_what_the_apply_would() {
+ let elements: Vec<String> = (1..=CHECK_MAX + 1).map(|port| port.to_string()).collect();
+ let tcp = Tcp::new(Ports::new(None, ports(&elements.join(","))));
+ let over = state(vec![Protocol::Tcp(tcp)]);
+ let cfg: MicrosegRunningConfig = serde_json::from_str(
+ r#"{"ids":{},"identities":{"next":3,"classes":{"1":["web"],"2":["db"]}}}"#,
+ )
+ .expect("parse running config");
+ let error = check(&over, &cfg).expect_err("past the bound");
+ let message = format!("{error:#}");
+ assert!(message.contains("pair 1 (web) -> 2 (db)"), "{message}");
+
+ let tcp = Tcp::new(Ports::new(None, ports("22")));
+ check(&state(vec![Protocol::Tcp(tcp)]), &cfg).expect("an ordinary pair");
+ }
+}
diff --git a/proxmox-microseg/src/lib.rs b/proxmox-microseg/src/lib.rs
new file mode 100644
index 000000000000..b6c0fd251a70
--- /dev/null
+++ b/proxmox-microseg/src/lib.rs
@@ -0,0 +1,66 @@
+mod ebpf;
+mod nic;
+mod running_config;
+
+use anyhow::{Context, bail};
+use proxmox_ve_config::sdn::microseg::state::{DesiredState, resolve_iface};
+use proxmox_ve_config::sdn::microseg::{GuestInfo, MicrosegRunningConfig};
+
+pub use crate::ebpf::{ExclusiveLock, SharedLock, lock_exclusive, lock_shared};
+pub use crate::running_config::parse as parse_running_config;
+
+fn full_pass(
+ cfg: &MicrosegRunningConfig,
+ inventory: &[GuestInfo],
+) -> anyhow::Result<ebpf::FullPass> {
+ let nics = nic::LocalNics::list()?;
+ let state = DesiredState::build(cfg, &nics.guests(inventory), ebpf::PAIRS_MAX)
+ .context("desired state")?;
+ ebpf::full_pass(&nics, &state, cfg)
+}
+
+pub fn apply(
+ lock: &mut ExclusiveLock,
+ cfg: &MicrosegRunningConfig,
+ inventory: &[GuestInfo],
+) -> anyhow::Result<()> {
+ ebpf::apply(lock, &full_pass(cfg, inventory)?)
+}
+
+/// Fails for a config the data plane could not install. The pairs alone decide that, and they
+/// cover every allocated class whatever the guests match, so no inventory is needed.
+pub fn check(cfg: &MicrosegRunningConfig) -> anyhow::Result<()> {
+ let state = DesiredState::build(cfg, &[], ebpf::PAIRS_MAX).context("desired state")?;
+ ebpf::check(&state, cfg)
+}
+
+/// Enforce the policy on a guest NIC that is about to come up. An assigned NIC gets its class. A
+/// NIC no assignment covers loses what an earlier plug or pass placed for its index, so one that
+/// comes up again in place drops its old identity. A failure in either case is an error rather
+/// than a skip, since the NIC would come up unenforced or as a class it left. `guest` is the
+/// plugged guest as the inventory lists it. `firewall_bridge` says the NIC is about to be put
+/// behind a firewall bridge.
+pub fn apply_iface(
+ lock: &SharedLock,
+ cfg: &MicrosegRunningConfig,
+ guest: &GuestInfo,
+ ifname: &str,
+ firewall_bridge: bool,
+) -> anyhow::Result<()> {
+ let Some((vmid, iface)) = nic::parse(ifname) else {
+ log::warn!("microseg: {ifname} is not a guest NIC name, skipping");
+ return Ok(());
+ };
+ if vmid != guest.vmid {
+ bail!(
+ "{ifname} is a NIC of guest {vmid}, not of guest {}",
+ guest.vmid
+ );
+ }
+ let Some(id) = resolve_iface(cfg, guest, iface)? else {
+ log::debug!("microseg: {ifname} is unassigned");
+ lock.release_iface(ifname)?;
+ return Ok(());
+ };
+ lock.apply_iface(ifname, id, firewall_bridge)
+}
diff --git a/proxmox-microseg/src/nic.rs b/proxmox-microseg/src/nic.rs
new file mode 100644
index 000000000000..6a0b974b0f49
--- /dev/null
+++ b/proxmox-microseg/src/nic.rs
@@ -0,0 +1,120 @@
+use std::collections::{BTreeMap, BTreeSet, HashMap};
+
+use anyhow::Context;
+use proxmox_ve_config::sdn::microseg::GuestInfo;
+
+/// The guest and the NIC index a host interface name stands for.
+pub fn parse(name: &str) -> Option<(u32, u32)> {
+ let rest = name
+ .strip_prefix("tap")
+ .or_else(|| name.strip_prefix("veth"))?;
+ let (vmid, iface) = rest.split_once('i')?;
+ // the integer parser alone would also take a sign
+ let number = |digits: &str| -> Option<u32> {
+ digits
+ .bytes()
+ .all(|byte| byte.is_ascii_digit())
+ .then(|| digits.parse().ok())
+ .flatten()
+ };
+ Some((number(vmid)?, number(iface)?))
+}
+
+/// A guest without a name or tags may be missing from the inventory. An assignment by VMID covers
+/// it all the same, so it is known by its VMID alone.
+fn guest(known: Option<&GuestInfo>, vmid: u32) -> GuestInfo {
+ known.cloned().unwrap_or(GuestInfo {
+ vmid,
+ ..Default::default()
+ })
+}
+
+pub fn behind_firewall_bridge(name: &str) -> bool {
+ let Some((vmid, iface)) = parse(name) else {
+ return false;
+ };
+ std::fs::read_link(format!("/sys/class/net/{name}/master")).is_ok_and(|bridge| {
+ bridge
+ .file_name()
+ .is_some_and(|master| master.to_string_lossy() == format!("fwbr{vmid}i{iface}"))
+ })
+}
+
+/// The node says which NICs a guest has, since its config does not name a hot-plugged NIC until the
+/// plug is through.
+pub struct LocalNics(BTreeMap<(u32, u32), String>);
+
+impl LocalNics {
+ pub fn list() -> anyhow::Result<Self> {
+ // a failure must not read as a node without guest NICs, a full pass would then take
+ // enforcement off every one of them
+ let names = std::fs::read_dir("/sys/class/net")
+ .and_then(|entries| {
+ entries
+ .map(|entry| Ok(entry?.file_name().to_string_lossy().into_owned()))
+ .collect::<std::io::Result<Vec<_>>>()
+ })
+ .context("list the interfaces of this node")?;
+ Ok(Self::from_names(names))
+ }
+
+ fn from_names(names: impl IntoIterator<Item = String>) -> Self {
+ let nics = names
+ .into_iter()
+ .filter_map(|name| Some((parse(&name)?, name)));
+ Self(nics.collect())
+ }
+
+ pub fn name(&self, vmid: u32, iface: u32) -> Option<&str> {
+ self.0.get(&(vmid, iface)).map(String::as_str)
+ }
+
+ pub fn guests(&self, inventory: &[GuestInfo]) -> Vec<GuestInfo> {
+ let mut nics: BTreeMap<u32, BTreeSet<u32>> = BTreeMap::new();
+ for &(vmid, iface) in self.0.keys() {
+ nics.entry(vmid).or_default().insert(iface);
+ }
+ let known: HashMap<u32, &GuestInfo> = inventory.iter().map(|g| (g.vmid, g)).collect();
+ nics.into_iter()
+ .map(|(vmid, nics)| GuestInfo {
+ nics: nics.into_iter().collect(),
+ ..guest(known.get(&vmid).copied(), vmid)
+ })
+ .collect()
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn a_guest_has_the_nics_the_node_has() {
+ let inventory = [
+ GuestInfo {
+ vmid: 100,
+ name: Some("web".to_string()),
+ nics: vec![0, 5],
+ ..Default::default()
+ },
+ GuestInfo {
+ vmid: 300,
+ nics: vec![0],
+ ..Default::default()
+ },
+ ];
+ let names = ["lo", "tap100i1", "fwln100i0", "veth200i0", "tap100i0"];
+ let nics = LocalNics::from_names(names.map(str::to_string));
+ let guests = nics.guests(&inventory);
+ assert_eq!(nics.name(200, 0), Some("veth200i0"));
+
+ // net1 is not in the config of vm100 yet and net5 is not plugged, vm300 runs elsewhere
+ assert_eq!(guests.len(), 2);
+ assert_eq!(guests[0].vmid, 100);
+ assert_eq!(guests[0].name.as_deref(), Some("web"));
+ assert_eq!(guests[0].nics, [0, 1]);
+ assert_eq!(guests[1].vmid, 200);
+ assert_eq!(guests[1].name, None);
+ assert_eq!(guests[1].nics, [0]);
+ }
+}
diff --git a/proxmox-microseg/src/running_config.rs b/proxmox-microseg/src/running_config.rs
new file mode 100644
index 000000000000..dbf8160de196
--- /dev/null
+++ b/proxmox-microseg/src/running_config.rs
@@ -0,0 +1,26 @@
+use proxmox_ve_config::sdn::microseg::MicrosegRunningConfig;
+use serde::Deserialize;
+
+#[derive(Deserialize)]
+struct Sections {
+ microseg: Option<MicrosegRunningConfig>,
+}
+
+/// `None` for a running config without a microseg block. Every apply writes the block, even an
+/// empty one, so only a node without microseg support leaves it out. Such a document says nothing
+/// about the policy, it does not declare an empty one.
+pub fn parse(raw: &str) -> anyhow::Result<Option<MicrosegRunningConfig>> {
+ let sections: Sections = serde_json::from_str(raw)?;
+ Ok(sections.microseg)
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn a_missing_block_is_absent() {
+ let cfg = parse(r#"{"zones": {"ids": {}}}"#).expect("parse running config");
+ assert_eq!(cfg, None);
+ }
+}
--
2.47.3
^ permalink raw reply related [relevance 10%]
* [PATCH access-control/cluster/container/docs/manager/network/proxmox{,-ve-rs,-perl-rs}/qemu-server v4 00/45] sdn: add microsegmentation support
@ 2026-11-05 11:12 9% Hannes Laimer
2026-11-05 11:12 10% ` [PATCH proxmox-ve-rs v4 13/45] microseg: add a crate that applies the policy to a node's guest NICs Hannes Laimer
` (3 more replies)
0 siblings, 4 replies; 26+ results
From: Hannes Laimer @ 2026-11-05 11:12 UTC (permalink / raw)
To: pve-devel
This series adds group-based microsegmentation to SDN, enforced by eBPF
programs on the guest interfaces. Assignments put guest interfaces into
groups, and rules between groups decide which traffic passes. Sets that
every rule treats the same share one identity, a 16-bit value that
travels with the frame in the low bits of the packet mark. The host
stamps it where a frame comes off the guest interface, so a guest cannot
forge its own. A new zone option turns on VXLAN-GBP[2] for VXLAN and
EVPN zones, which carries the identity across nodes. On a zone without
it, traffic from another node arrives without an identity. An identity
that loses one of its sets after a config change is retired. Its value
is reused only after a quarantine, since a frame stamped under the old
config can still be in flight.
The config in /etc/pve/sdn/microseg.cfg, with its API under
/cluster/sdn/microseg and the ACL path /sdn/microseg, holds groups,
rules and assignments and takes effect with an SDN apply. Groups can
nest, and a member of a subgroup is in every group above it. A rule
allows or denies traffic from a source predicate to a destination
predicate at a priority. A predicate of the kind `any`, `all` or
`exact` lists groups and matches an interface that has one of them, all
of them, or those and no others. An `every` predicate lists none and
matches each interface that has a group. Beyond the pair, a rule can be
narrowed to a protocol and ports, an ICMP type, a firewall macro or
non-first fragments. Which groups an interface has is determined by the
assignments, an ordered list that matches interfaces by guest, tag or
name regex. An interface takes the groups of the first one that covers
it.
Default is deny. Only interfaces that have at least one group assigned
are enforced. Enforcement happens when a frame arrives at an enforced
interface, so nothing is dropped on the way out of a guest's interface.
Traffic from interfaces that are not enforced is untagged, which
includes guests without groups on their NICs, the host and the outside.
Such traffic has to be allowed explicitly with the built-in untagged
group. Rules are stateless and directional, so a reply needs its own
allow, or the rule is marked bidirectional. Stateless also means no
reassembly, so fragments after the first carry no transport header. A
narrowed rule matches them only when it is narrowed to fragments.
The highest priority wins. At the same priority the rule with the more
specific `all` or `exact` predicate decides, so an `all` or `exact` rule
on a subgroup outranks the same rule on its parent. Equally specific
rules deny if one of them denies. Narrowed rules are checked before the
rules that decide the whole pair at the same priority.
A guest interface gets its groups the moment it comes up, from the
assignment that matches the guest at that moment. Changing the tags or
the name of a running guest takes effect right after the config is
written. The NICs get the groups the assignments now give them. Once no
assignment matches the guest, their enforcement stops. A change that
reaches the config another way, such as a restore or a migration, takes
effect the next time the NIC comes up or at the next SDN apply. A tag
or name the assignments match moves a guest between groups. So a tag
change or a rename that moves a guest into or out of an assignment
needs SDN.Use on /sdn/microseg besides the right to change the option.
Putting a NIC on a vnet needs SDN.Use on the vnet the same way.
As long as the policy has an assignment, every node keeps the programs
and maps loaded, about 20 MiB plus what the pairs take. Without one, the
nodes drop them. The BPF state does not survive a reboot, so a node
applies the policy again at boot, before any guest starts. The programs
are compiled into libpve-rs-perl, so an upgrade of that package applies
the policy again as well.
The SDN apply checks the policy against what a node can hold before it
writes the running config, and refuses one that exceeds it. A node that
cannot apply the policy fails its network reload task and keeps its
previous enforcement. A node without loaded programs, as after a failed
load at boot, starts no guest with an assigned interface until an apply
or a reload succeeds there. A guest also does not start when its node
cannot read or parse the running config, or cannot set up the
enforcement of its assigned interface.
ARP and neighbor solicitations/advertisements pass wherever either
direction of a pair allows anything, so the two ends of a one-way allow
can resolve each other's addresses. They also pass when the host itself
sends them without an identity. That is how the suppression replies of
an EVPN zone reach the guest. A frame the host turns around on the
interface it came in on passes as a whole, since only the host can make
one. Behind a firewall bridge the host's frames cannot be told from
other unstamped ones, so an interface there takes these frames from
every unstamped sender. The narrowed rules of a pair run first, so a
narrowed rule that denies neighbor discovery still holds.
In patch order, the series adds
- proxmox, the policy subsystem of the proxmox-ebpf crate, with the tc
programs that stamp and check the identities
- proxmox-ve-rs, the types, the identity engine and the desired state
in proxmox-ve-config, and the new proxmox-microseg crate that hands
the desired state to the subsystem
- pve-cluster, microseg.cfg as an observed file
- pve-access-control, the /sdn/microseg ACL path
- proxmox-perl-rs, the config binding and the data plane binding in
pve-rs
- pve-network, the config, the API, the dry-run view, the zone option
and the enforcement on interface plug and after a library upgrade
- pve-manager, the panel, the dry-run view and the apply on network
reload and at boot
- qemu-server and pve-container, the immediate update of a running
guest's NICs on a tag or name change, and SDN.Use for a tag or name
the policy matches
- pve-docs, documentation
- pve-network needs pve-cluster, pve-access-control, pve-rs,
pve-guest-common and ifupdown2 3.3.0-1+pmx13 for the vxlan-gbp
attribute
- pve-manager needs pve-docs to build and pve-network and
pve-access-control at runtime
- pve-rs needs proxmox-microseg and proxmox-ve-config
- qemu-server and pve-container need pve-network
- proxmox-microseg needs proxmox-ve-config and the proxmox-ebpf crate
- the proxmox patches apply on top of the eBPF library series[1], which
adds the proxmox-ebpf crate there
The series is independent of the eBPF DHCP series[3]. Both add a
subsystem to the proxmox-ebpf crate behind a feature of its own. The
run order is the one place that needs an order when both are applied,
dhcp goes ahead of policy so its replies pass the policy as the host's
answers.
[1] https://lore.proxmox.com/pve-devel/20261104172918.2643810-1-h.laimer@proxmox.com/
[2] https://lore.proxmox.com/pve-devel/20260828134708.692354-1-h.laimer@proxmox.com/
[3] https://lore.proxmox.com/pve-devel/20261105100316.449163-1-h.laimer@proxmox.com/
note: I did also have this implemented with nft instead of ebpf as a
dataplane. Without narrowing, packets per second (small UDP packets) was
about the same, with multiple checks nft's rate went down, nothing super
dramatic but about a 1.5-2x compared to eBPF (~140k vs ~250k). eBPF is
also more flexible, in case we want to expand possible actions in the
future, but replacing the dataplane is pretty simple which also allowed
me to do the side-by-side testing.
changelog
v4:
- the SDN.Use checks for a tag or name change read the applied policy
instead of the pending one, and creating, cloning or restoring a
guest with such a tag or name needs SDN.Use too
- the SDN.Use check for a tag change asks the matcher whether the guest
enters or leaves a tag assignment, instead of looking for a changed
tag the assignments name. A tag none of them names still moves a
guest out of an exact match, which the old check let pass
- an identity is retired as soon as it loses one of its sets, not only
once all are gone. A node on the new config then never takes a stamp
from a node still on the old one for the shrunken class
- a destroy with purge removes the guest's own assignments, tag and
regex assignments stay
- only zones that share a VXLAN port on the same node must agree on
vxlan-gbp
- a boot commit of pending sdn changes leaves the policy pending, since
it reloads only that node
- a check for AH matches an IPv6 frame whose AH was walked past as well
- ui: the panel shows for SDN.Audit on the policy without Sys.Audit,
like the storage panel, and the dry-run lists the groups with their
parents
- a pass writes the policy into fresh maps and switches programs and
maps together, so a failed apply leaves the node on the policy it
had, and the desired state is folded one pair at a time, pairs with
the same checks sharing one list
v3:
- the data plane is a library crate in the proxmox-ve-rs workspace that
pve-rs binds, on a policy subsystem in proxmox-ebpf, no agent binary
and no boot unit. A node loads the programs while the policy has an
assignment and takes new programs on a package upgrade
- the model changed in five places:
* groups have no numeric mark and can form a hierarchy
* assignments are an ordered list and an interface takes the groups
of the first that covers it instead of the union of all
* rules can be narrowed similar to how firewall rules work,
additionally non-first fragments can be matched and an explicit
bidirectional flag exists
* at a priority tie the more specific rule decides
* new `every` predicate that matches everything that has at least
one group assigned
- interface group (re)assignment happens whenever an interface comes
up, sdn apply runs or the tags or name of a running guest change. A
tag change or a rename that moves a guest into or out of an
assignment now also needs SDN.Use on the policy, similar to how we
check if a user is allowed to assign a vnet
- if a node cannot apply the policy, its network reload task fails.
while a node has no loaded programs, as after a failed load at boot,
guests with an assigned NIC do not start on it. a nic with groups
only comes up enforced
- ARP and NS/NA are automatically allowed if there exists a (src,dst)
-> [checks ->] allow in either direction, this is so address
resolution for allowed connections is possible. Also host-generated
ARP and NS/NA frames are allowed, this is specifically needed for
EVPN suppression to work, and a frame the host turns around on the
interface it came in on passes
- api: section types and property keys are kebab-case, the endpoints
check /sdn/microseg (a pve-access-control patch adds the ACL path),
and the overview reports members, evaluation order and specificity
instead of a realized state, plus the id space usage
- rule and assignment ids are derived from their identifying fields,
so those cannot change on an existing object
- ui: a panel with the rule grid by priority, the assignments in match
order, the dry-run view, the rule editor on the firewall's selectors,
and a guest tab with its groups and rules
- the SRv6 carrier and its bridge object are out, the ifupdown2
vxlan-gbp attribute is a standalone patch, the zone option stays,
docs rewritten
v2:
- core model reworked: each interface now holds a *set* of groups
compiled into a per-NIC wire identity, replacing the single-group
parent/child tree
- rules gained explicit `src`/`dst` predicates (any/all/exact) and a
`prio`, replacing the implicit tree-distance ordering
- `untagged` is now a nameable built-in group (mark 0)
- assignments are additive: a NIC's set is the union of all that
resolve to it
- added tag-matcher and name-regex assignments
- rule and dynamic-assignment ids are now generated
- identity allocation is fresh-first with quarantined reclamation, so
churn cannot exhaust the id space
- split the SRv6 carrier support into droppable tail patches
- updated docs
- updated cover-letter
proxmox:
Hannes Laimer (3):
ebpf: build: keep the build directory out of the BPF objects
ebpf: policy: add the enforcement subsystem for guest interfaces
ebpf: policy: add a check for non-first fragments
proxmox-ebpf/Cargo.toml | 1 +
proxmox-ebpf/build.rs | 4 +
proxmox-ebpf/debian/control | 18 +
proxmox-ebpf/src/bpf-shim/bpf/bpf_helpers.h | 1 +
proxmox-ebpf/src/bpf-shim/linux/bpf.h | 1 +
proxmox-ebpf/src/lib.rs | 3 +
proxmox-ebpf/src/policy/bpf/mark.h | 27 +
proxmox-ebpf/src/policy/bpf/policy.bpf.c | 383 +++++++++
proxmox-ebpf/src/policy/bpf/types.h | 75 ++
proxmox-ebpf/src/policy/mod.rs | 820 +++++++++++++++++++
proxmox-ebpf/src/policy/types.rs | 159 ++++
proxmox-ebpf/src/subsystem.rs | 23 +-
proxmox-ebpf/tests/common/mod.rs | 36 +
proxmox-ebpf/tests/policy.rs | 857 ++++++++++++++++++++
14 files changed, 2407 insertions(+), 1 deletion(-)
create mode 100644 proxmox-ebpf/src/policy/bpf/mark.h
create mode 100644 proxmox-ebpf/src/policy/bpf/policy.bpf.c
create mode 100644 proxmox-ebpf/src/policy/bpf/types.h
create mode 100644 proxmox-ebpf/src/policy/mod.rs
create mode 100644 proxmox-ebpf/src/policy/types.rs
create mode 100644 proxmox-ebpf/tests/policy.rs
proxmox-ve-rs:
Hannes Laimer (11):
ve-config: firewall: add a constructor for sctp matches
ve-config: sdn: microseg: add identity allocation for group sets
ve-config: sdn: microseg: add config types
ve-config: sdn: microseg: add tag matcher
ve-config: sdn: microseg: add name regex matcher
ve-config: sdn: microseg: narrow rules by protocol and ports
ve-config: sdn: microseg: add group hierarchy
ve-config: firewall: expose protocol, icmp type and code numbers
ve-config: sdn: microseg: add the desired state
microseg: add a crate that applies the policy to a node's guest NICs
microseg: add a rule option that matches non-first fragments
Cargo.toml | 2 +
proxmox-microseg/Cargo.toml | 20 +
proxmox-microseg/debian/changelog | 5 +
proxmox-microseg/debian/control | 46 +
proxmox-microseg/debian/copyright | 18 +
proxmox-microseg/debian/debcargo.toml | 7 +
proxmox-microseg/debian/source/format | 1 +
proxmox-microseg/src/ebpf.rs | 249 +++
proxmox-microseg/src/lib.rs | 66 +
proxmox-microseg/src/nic.rs | 120 ++
proxmox-microseg/src/running_config.rs | 26 +
proxmox-ve-config/src/firewall/fw_macros.rs | 7 +
proxmox-ve-config/src/firewall/ports.rs | 65 +
.../src/firewall/types/rule_match.rs | 63 +
proxmox-ve-config/src/sdn/microseg/api.rs | 719 +++++++++
.../src/sdn/microseg/identity.rs | 570 +++++++
proxmox-ve-config/src/sdn/microseg/mod.rs | 1421 +++++++++++++++++
proxmox-ve-config/src/sdn/microseg/state.rs | 650 ++++++++
proxmox-ve-config/src/sdn/microseg/types.rs | 549 +++++++
proxmox-ve-config/src/sdn/mod.rs | 1 +
20 files changed, 4605 insertions(+)
create mode 100644 proxmox-microseg/Cargo.toml
create mode 100644 proxmox-microseg/debian/changelog
create mode 100644 proxmox-microseg/debian/control
create mode 100644 proxmox-microseg/debian/copyright
create mode 100644 proxmox-microseg/debian/debcargo.toml
create mode 100644 proxmox-microseg/debian/source/format
create mode 100644 proxmox-microseg/src/ebpf.rs
create mode 100644 proxmox-microseg/src/lib.rs
create mode 100644 proxmox-microseg/src/nic.rs
create mode 100644 proxmox-microseg/src/running_config.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/api.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/identity.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/mod.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/state.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/types.rs
pve-cluster:
Hannes Laimer (1):
cfs: add 'sdn/microseg.cfg' to observed files
src/PVE/Cluster.pm | 1 +
src/pmxcfs/status.c | 1 +
2 files changed, 2 insertions(+)
pve-access-control:
Hannes Laimer (1):
permissions: add ACL path for SDN microsegmentation
src/PVE/AccessControl.pm | 1 +
1 file changed, 1 insertion(+)
proxmox-perl-rs:
Hannes Laimer (4):
pve-rs: sdn: add microseg config binding
pve-rs: sdn: microseg: bind the data plane
pve-rs: sdn: microseg: check the data plane limits on render
pve-rs: debian: fire the pve-microseg-update trigger on upgrade
pve-rs/Cargo.toml | 2 +
pve-rs/Makefile | 3 +
pve-rs/debian/control | 1 +
pve-rs/debian/triggers | 1 +
pve-rs/src/bindings/sdn/microseg.rs | 364 ++++++++++++++++++++++++++++
pve-rs/src/bindings/sdn/mod.rs | 1 +
6 files changed, 372 insertions(+)
create mode 100644 pve-rs/src/bindings/sdn/microseg.rs
pve-network:
Hannes Laimer (10):
sdn: zones: add vxlan-gbp option to vxlan and evpn zones
sdn: microseg: add config, API and guest inventory
sdn: dry-run: show pending microseg changes
sdn: microseg: enforce the policy on guest NICs
sdn: microseg: add tag matcher
sdn: microseg: add name regex matcher
sdn: microseg: add an update for a running NIC
sdn: microseg: expose protocol, port and macro rule options
sdn: microseg: allow nesting groups under a parent
sdn: microseg: expose the fragments rule option
debian/control | 1 +
debian/libpve-network-perl.postinst | 21 +
debian/triggers | 1 +
src/PVE/API2/Network/SDN.pm | 47 +-
src/PVE/API2/Network/SDN/Makefile | 2 +
src/PVE/API2/Network/SDN/Microseg.pm | 236 ++++++++
.../API2/Network/SDN/Microseg/Assignment.pm | 23 +
src/PVE/API2/Network/SDN/Microseg/Base.pm | 382 +++++++++++++
src/PVE/API2/Network/SDN/Microseg/Group.pm | 17 +
src/PVE/API2/Network/SDN/Microseg/Makefile | 11 +
src/PVE/API2/Network/SDN/Microseg/Rule.pm | 22 +
src/PVE/API2/Network/SDN/Zones.pm | 8 +
src/PVE/Network/SDN.pm | 32 +-
src/PVE/Network/SDN/Makefile | 1 +
src/PVE/Network/SDN/Microseg.pm | 502 ++++++++++++++++++
src/PVE/Network/SDN/Zones.pm | 41 ++
src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 8 +
src/PVE/Network/SDN/Zones/VxlanPlugin.pm | 12 +
.../zones/evpn/gbp/expected_controller_config | 77 +++
.../zones/evpn/gbp/expected_sdn_interfaces | 45 ++
src/test/zones/evpn/gbp/interfaces | 7 +
src/test/zones/evpn/gbp/sdn_config | 26 +
.../zones/vxlan/gbp/expected_sdn_interfaces | 17 +
src/test/zones/vxlan/gbp/interfaces | 7 +
src/test/zones/vxlan/gbp/sdn_config | 11 +
25 files changed, 1553 insertions(+), 4 deletions(-)
create mode 100644 src/PVE/API2/Network/SDN/Microseg.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Assignment.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Base.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Group.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Makefile
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Rule.pm
create mode 100644 src/PVE/Network/SDN/Microseg.pm
create mode 100644 src/test/zones/evpn/gbp/expected_controller_config
create mode 100644 src/test/zones/evpn/gbp/expected_sdn_interfaces
create mode 100644 src/test/zones/evpn/gbp/interfaces
create mode 100644 src/test/zones/evpn/gbp/sdn_config
create mode 100644 src/test/zones/vxlan/gbp/expected_sdn_interfaces
create mode 100644 src/test/zones/vxlan/gbp/interfaces
create mode 100644 src/test/zones/vxlan/gbp/sdn_config
pve-manager:
Hannes Laimer (11):
network: apply the microseg policy on reload
pve-sdn-commit: apply the microseg policy at boot
ui: sdn: zones: add vxlan-gbp checkbox to vxlan and evpn
ui: sdn: add microsegmentation panel
ui: sdn: dry-run: show pending microseg diff
ui: sdn: microseg: add tag matcher
ui: sdn: microseg: add name regex matcher
ui: sdn: microseg: add narrowing to the rule form
ui: sdn: microseg: show and edit the group hierarchy
ui: sdn: microseg: add fragments option to the rule form
ui: sdn: microseg: add a guest tab with its groups and rules
PVE/API2/Network.pm | 31 +-
bin/pve-sdn-commit | 49 ++-
services/pve-sdn-commit.service | 1 +
www/css/ext6-pve.css | 23 ++
www/manager6/Makefile | 10 +
www/manager6/Utils.js | 103 ++++++
www/manager6/data/PermPathStore.js | 1 +
www/manager6/dc/Config.js | 11 +
www/manager6/form/SDNMicrosegGroupSelector.js | 105 ++++++
www/manager6/grid/FirewallRules.js | 2 +
www/manager6/lxc/Config.js | 10 +
www/manager6/qemu/Config.js | 10 +
www/manager6/sdn/MicrosegView.js | 98 +++++
www/manager6/sdn/SdnDiffView.js | 29 ++
www/manager6/sdn/microseg/AssignmentEdit.js | 148 ++++++++
www/manager6/sdn/microseg/AssignmentView.js | 195 ++++++++++
www/manager6/sdn/microseg/Base.js | 262 ++++++++++++++
www/manager6/sdn/microseg/GroupEdit.js | 40 ++
www/manager6/sdn/microseg/GuestPanel.js | 117 ++++++
www/manager6/sdn/microseg/RuleEdit.js | 285 +++++++++++++++
www/manager6/sdn/microseg/RuleView.js | 342 ++++++++++++++++++
www/manager6/sdn/microseg/Tree.js | 278 ++++++++++++++
www/manager6/sdn/zones/EvpnEdit.js | 8 +
www/manager6/sdn/zones/VxlanEdit.js | 11 +
24 files changed, 2140 insertions(+), 29 deletions(-)
create mode 100644 www/manager6/form/SDNMicrosegGroupSelector.js
create mode 100644 www/manager6/sdn/MicrosegView.js
create mode 100644 www/manager6/sdn/microseg/AssignmentEdit.js
create mode 100644 www/manager6/sdn/microseg/AssignmentView.js
create mode 100644 www/manager6/sdn/microseg/Base.js
create mode 100644 www/manager6/sdn/microseg/GroupEdit.js
create mode 100644 www/manager6/sdn/microseg/GuestPanel.js
create mode 100644 www/manager6/sdn/microseg/RuleEdit.js
create mode 100644 www/manager6/sdn/microseg/RuleView.js
create mode 100644 www/manager6/sdn/microseg/Tree.js
qemu-server:
Hannes Laimer (1):
network: update the microseg enforcement on a tag or name change
src/PVE/API2/Qemu.pm | 39 +++++++++++++++++++++++++++++++++++
src/PVE/QemuServer.pm | 17 ++++++++++++++-
src/PVE/QemuServer/Network.pm | 14 +++++++++++++
3 files changed, 69 insertions(+), 1 deletion(-)
pve-container:
Hannes Laimer (1):
lxc: update the microseg enforcement on a tag or hostname change
src/PVE/API2/LXC.pm | 14 ++++++++++++++
src/PVE/API2/LXC/Config.pm | 3 +++
src/PVE/LXC.pm | 28 ++++++++++++++++++++++++++++
src/PVE/LXC/Create.pm | 4 ++++
4 files changed, 49 insertions(+)
pve-docs:
Hannes Laimer (2):
sdn: zones: document the VXLAN-GBP option
sdn: add microsegmentation section
pvesdn.adoc | 411 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 411 insertions(+)
Summary over all repositories:
100 files changed, 11609 insertions(+), 35 deletions(-)
--
Generated by murpp 0.12.0
^ permalink raw reply [relevance 9%]
* superseded: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] sdn: add microsegmentation support
2026-07-09 9:18 10% SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] " Hannes Laimer
` (3 preceding siblings ...)
2026-08-17 11:17 10% ` Lukas Sichert
@ 2026-10-27 8:57 8% ` Hannes Laimer
4 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-10-27 8:57 UTC (permalink / raw)
To: pve-devel
superseded-by:
https://lore.proxmox.com/pve-devel/20261027085527.702738-1-h.laimer@proxmox.com/
On 2026-07-09 11:19, Hannes Laimer wrote:
> This adds support for microsegmentation using eBPF programs attached to
> interfaces. Mostly the tap/veth interfaces on the guests directly.
>
> # Overview
> Each guest interface is assigned a *set* of groups. Rather than a hierarchy,
> group membership is treated as a signature. The agent compiles each interface's
> group set into a single per-NIC *identity*, and policies are rules between
> groups, matched against those sets with predicates.
>
> A rule is a `src` predicate and a `dst` predicate plus a verdict and a
> priority, where a predicate is a match kind over a list of groups:
> - any{...} the interface shares at least one of the listed groups
> - all{...} the interface has all of the listed groups
> - exact{...} the interface's groups are exactly the listed set
>
> For a packet, the `src` predicate is evaluated against the sender's set and the
> `dst` predicate against the receiver's. Among the rules that fire the highest
> `prio` wins, a conflicting tie (with different verdicts) denies, and if no rule
> fires the packet is denied (default-deny). For example, with the groups
> web/app/db/prod, specific allows punched through a broad deny:
>
> - any{web} -> any{app} : allow prio 10
> - any{app} -> any{db} : allow prio 10
> - all{prod} -> all{prod} : allow prio 10 # these three carve out east-west...
> - any{web,app,db} -> any{web,app,db} : deny prio 5 # ...through a broad tier-to-tier deny
> (the last is technically not needed cause the default is deny, in a larger
> context having this explicitly can be necesarry though)
>
> The allows above are one-directional. Rules are stateless and per-packet, there
> is no connection tracking. The reply needs its own allow, so for TCP between web
> and app both any{web} -> any{app} and any{app} -> any{web} have to be allowed.
>
> Groups land on an interface either directly (a guest matcher: a `vmid`,
> optionally a single `iface`), by tag (a tag matcher: every guest carrying the
> named tags, e.g. `prod`/`staging`/`web`), or by name (a regex matcher: every
> guest whose name matches a regular expression). Assignments are additive, an
> interface's set is the union of every assignment that resolves to it, so the
> matchers compose.
>
> `untagged` is a reserved built-in group (mark 0) for traffic that arrives
> unstamped (gateways, DHCP/ARP, cross-node frames without a tag). It can be
> named in a predicate and composed with real groups (e.g. `any{untagged, web}`),
> but it is not assignable.
>
> Enforcement happens on the receiving side, cause that's where we for sure know both
> - where the packet is from
> - and, its destination (us)
>
> # config and API
> The config is a single section-config, `sdn/microseg.cfg`. It holds these
> object types, keyed by section id:
> - group, a numeric `mark` (auto-assigned if omitted) and an optional comment
> - rule, a `src`/`dst` predicate pair (`*_match` is any/all/exact over a group list),
> a `prio` and `allow`
> - guestassignment, binds a guest's NIC(s) (`vmid`, optional `iface`) to a group set
> - tagassignment, binds the NICs of every guest matching `tags` (by `tag_match`) to a
> group set, expanded against the live guest inventory on render
> - regexassignment, same but for every guest whose name matches a regular
> expression
> - bridge, marks a bridge-facing interface as an SRv6 carrier (no UI yet)
> The API exposes endpoints under
> `/cluster/sdn/microseg/{group,rule,assignment,bridge}`, guarded by SDN.Audit for reads
> and SDN.Allocate for writes. The assignment endpoint discriminates the two matcher
> kinds on a `type` property (like the fabric `protocol`).
> Rule and tag/regex-assignment ids are derived from their contents (an FNV-1a hash),
> guest assignments from `vm{vmid}i{iface}`, groups and bridges take a chosen id. On
> commit the config is rendered into `.running-config`, which is what the agent reads.
> Rendering resolves each interface's group set to a wire identity and expands the
> dynamic matchers against the inventory.
>
> # identity
> An identity is not one id per group set but one id per *signature*. Two
> interfaces share an id when every rule predicate fires the same way on both, so
> no rule can tell them apart. The identities are the classes of that partition,
> each named by a 16-bit id, and that id is what rides on the wire.
>
> Editing rules reshapes the partition. A new predicate that separates two sets
> which used to look alike *splits* their class in two, and dropping the
> predicate that told two classes apart *merges* them back into one. On a split
> the subclass that still carries the old representative keeps the id and the
> other gets a fresh one, on a merge the surviving class keeps its id and the
> fused-away ones retire.
>
> New ids come fresh-first from a counter. A retired id is not reused right away,
> it sits in a time quarantine long enough that no packet stamped under its old
> meaning can still be in flight. Only once the fresh space is exhausted does
> allocation fall back to reusing a retired id whose quarantine has passed, so
> config churn alone cannot exhaust the 16-bit id space. Actually running out
> would take more than 65534 identities the policies can tell apart. So it
> doesn't scale with count of group combinations in use, but with the distinct
> semantic meaning they carry.
>
> # skb->mark
> Every packet in the kernel lives in a `sk_buff` struct, which has a 32-bit
> `mark` field you can read and write while the packet moves through the kernel.
> Nothing else in our SDN stack touches `mark` today, so microseg has it to
> itself. Worth keeping in mind if that ever changes. For now we only use the
> lower 16 bits, to carry the interface's identity (mark 0 is reserved for
> unstamped traffic), so up to 65535 identities.
>
> The catch is `mark` only lives as long as the packet stays in the kernel, and
> sooner or later it leaves. To carry the identity between hosts we have to put it
> on the wire itself. For that we support two carriers:
> - VXLAN-GBP, the 16-bit GBP field on the VXLAN encapsulation
> - SRv6, the 16-bit Tag field on the SRH
> The kernel already moves `mark` in and out of the VXLAN-GBP field for us (found
> that out way too late :P). For SRv6 we do it ourselves with a small eBPF program.
>
> # eBPF
> Both tagging (setting `mark`) and enforcement happen in an eBPF program
> directly attached to the guest's interface. The programs themselves read and
> write to/from two maps:
> - tap_to_group, the identity to stamp for a given interface
> - rules, a map of (src_id, dst_id) -> action, where src is the `mark` the
> packet carries and dst is our own interface's identity
>
> Specifically, on ingress we set the mark, and on egress we enforce.
>
> # Implementation
> We have an `agent` that reads the running sdn config, and applies that state to
> the kernel. The binary is stateless and one-shot, not a long running daemon. It
> runs on SDN apply, on tap_plug of a guest interface, and on boot after
> pve-sdn-commit but before guests start. Those triggers cover every situation
> where we have to touch kernel state.
>
> It compiles the config into what the data plane needs. It folds each
> interface's group set into a wire identity (a registry kept stable across
> renders so identities agree across hosts, allocated as described above), and
> folds the rules into the `(src_id, dst_id)` action map by priority (highest
> wins, conflicting ties deny).
>
> It keeps track of what is currently loaded in the kernel with two files under
> `/run/proxmox-ebpf`. One keeping track of the bpf program that was compiled
> into the binary, and one for keeping track of changes to the data structures
> the bpf program accesses. The distinction is useful cause for only a program
> change we can swap the currently attached program with the updated one
> atomically. In case the data structure (the maps) changed there is no other way
> than to tear-down all the current state and repopulate the maps and re-attach
> the programs. Swapping out the maps first would have old programs interact with
> a new data schema, and swapping the programs first will lead to new programs
> accessing an old data schema. Either way, not good, so we wipe the state in
> that case and re-build it. So, in case we change the structure of the data our
> bpf programs access, there will be a bunch of ms where the configured
> segmentation is not enforced. But that is the only scenario where that can
> happen.
>
> ## aya, aya-ebpf
> Aya is a rust lib that helps with working with BPF more easily. It has both a
> userspace part (`aya`) and a part (`aya-ebpf`) that compiles to bpf. I chose to
> only use the userspace part, and use C for the BPF programs themselves. The
> reasons were:
> - we don't have `aya-ebpf` packaged
> - `aya-ebpf` *requires* nightly toolchain to compile
> - the bpf programs are very small, in case this should change at some point we
> can reconsider. Also, it doesn't matter what produces the .o file, so this
> could be swapped in really easily if we decided to
>
> So we compile the bpf program written in C to a .o targeting bpf using clang
> and include it when compiling the agent binary.
>
> ## SRv6
> Besides VXLAN-GBP, the identity can also ride in the 16-bit Tag field of an SRv6
> SRH. The kernel already does this move for VXLAN-GBP but not for SRv6, so this
> adds a small eBPF program that writes the identity into the SRH on egress and
> reads it back on ingress. The `bridge` object marks the bridge-facing interface
> it runs on.
>
> This is only the tag carrier, not an SRv6 transport. Our SDN stack has no SRv6
> zone yet, so there is nothing configured to route it over, and there is no UI.
> If SDN grows an SRv6 transport later (a small L3, EVPN-lite style option), the
> carrier is already in place.
>
> It is packaged as a droppable tail. The carrier bridge section (proxmox-ve-config),
> the bridge API (pve-network) and the bridge subsystem (proxmox-ebpf) are each the
> last patch of their repo's series, so SRv6 can be deferred without touching the rest.
>
> # enabling VXLAN-GBP
> The kernel only moves the mark into the GBP field if the vxlan device was
> created with the GBP flag set, and it's create-only, the kernel won't
> toggle it on a running device. ifupdown2 had no attribute for this, so
> this series includes a small ifupdown2 patch adding `vxlan-gbp`, which
> threads the flag through to the netlink/iproute2 create path.
>
> # testing
> I have put pre-built packages on sani, these include ifupdown2 with the patch
>
> # building
> 1. proxmox-ve-rs (install)
> 2. proxmox-ebpf
> 3. pve-cluster (install)
> 4. proxmox-perl-rs (install)
> 5. pve-network
> 6. pve-manager
>
> # notes
> * everything eBPF related did not change since v1, this v2 only really changes identity semantics
> * using GENEVE would also be an option, but with this current approach we gain
> a lot of flexibility. Expanding predicate logic, or having not just
> allow/deny but also match ports or alike is possible without touching the
> underlying identity system. (limiting the per-packet overhead to just 16
> bits is also good I'd argue)
> * the enforement mechanism is not set in stone, weather this is eBPF or maybe
> nftables with a map we populate as shortly discussed with @Stefan. The
> current approach plays nicely with both since it conveys identity through
> `skb->mark` that nft can access as well
> * I did not send the first commit for `proxmox-ebpf` since it contains a
> `vmlinux.h` which is rather large but is needed for compiling. The commit is in
> my staff repo.
>
> # changelog
> v2:
> - core model reworked: each interface now holds a *set* of groups compiled
> into a per-NIC wire identity, replacing the single-group parent/child tree
> - rules gained explicit `src`/`dst` predicates (any/all/exact) and a `prio`,
> replacing the implicit tree-distance ordering
> - `untagged` is now a nameable built-in group (mark 0)
> - assignments are additive: a NIC's set is the union of all that resolve to it
> - added tag-matcher and name-regex assignments
> - rule and dynamic-assignment ids are now generated
> - identity allocation is fresh-first with quarantined reclamation, so churn
> cannot exhaust the id space
> - split the SRv6 carrier support into droppable tail patches
> - updated docs
> - updated cover-letter
>
>
> proxmox-ve-rs:
>
> Hannes Laimer (5):
> ve-config: sdn: add microseg signature-identity engine
> ve-config: sdn: add microseg config types
> ve-config: sdn: microseg: add tag matcher
> ve-config: sdn: microseg: add name regex matcher
> ve-config: sdn: microseg: add carrier bridge section
>
> proxmox-ve-config/src/sdn/config.rs | 9 +-
> .../src/sdn/microseg/identity.rs | 624 +++++
> proxmox-ve-config/src/sdn/microseg/mod.rs | 2349 +++++++++++++++++
> proxmox-ve-config/src/sdn/mod.rs | 1 +
> 4 files changed, 2982 insertions(+), 1 deletion(-)
> create mode 100644 proxmox-ve-config/src/sdn/microseg/identity.rs
> create mode 100644 proxmox-ve-config/src/sdn/microseg/mod.rs
>
>
> proxmox-ebpf:
>
> Hannes Laimer (3):
> agent: add userspace coordinator and stateless policy subsystem
> bpf: add bridge subsystem
> debian: add packaging and boot-time oneshot unit
>
> Makefile | 66 +++++++
> debian/changelog | 5 +
> debian/control | 35 ++++
> debian/copyright | 18 ++
> debian/proxmox-ebpf.install | 1 +
> debian/proxmox-ebpf.postrm | 11 ++
> debian/proxmox-ebpf.prerm | 12 ++
> debian/proxmox-ebpf.service | 15 ++
> debian/rules | 33 ++++
> debian/source/format | 1 +
> include/mark.h | 30 +++
> src/agent.rs | 99 ++++++++++
> src/bridge/bpf/srv6.bpf.c | 76 +++++++
> src/bridge/mod.rs | 76 +++++++
> src/main.rs | 69 +++++++
> src/policy/bpf/tap.bpf.c | 68 +++++++
> src/policy/bpf/types.h | 23 +++
> src/policy/mod.rs | 268 +++++++++++++++++++++++++
> src/policy/types.rs | 45 +++++
> src/running_config.rs | 38 ++++
> src/state.rs | 149 ++++++++++++++
> src/subsystem.rs | 385 ++++++++++++++++++++++++++++++++++++
> src/tc.rs | 152 ++++++++++++++
> 23 files changed, 1675 insertions(+)
> create mode 100644 Makefile
> create mode 100644 debian/changelog
> create mode 100644 debian/control
> create mode 100644 debian/copyright
> create mode 100644 debian/proxmox-ebpf.install
> create mode 100755 debian/proxmox-ebpf.postrm
> create mode 100755 debian/proxmox-ebpf.prerm
> create mode 100644 debian/proxmox-ebpf.service
> create mode 100755 debian/rules
> create mode 100644 debian/source/format
> create mode 100644 include/mark.h
> create mode 100644 src/agent.rs
> create mode 100644 src/bridge/bpf/srv6.bpf.c
> create mode 100644 src/bridge/mod.rs
> create mode 100644 src/main.rs
> create mode 100644 src/policy/bpf/tap.bpf.c
> create mode 100644 src/policy/bpf/types.h
> create mode 100644 src/policy/mod.rs
> create mode 100644 src/policy/types.rs
> create mode 100644 src/running_config.rs
> create mode 100644 src/state.rs
> create mode 100644 src/subsystem.rs
> create mode 100644 src/tc.rs
>
>
> pve-cluster:
>
> Hannes Laimer (1):
> cfs: add 'sdn/microseg.cfg' to observed files
>
> src/PVE/Cluster.pm | 1 +
> 1 file changed, 1 insertion(+)
>
>
> proxmox-perl-rs:
>
> Hannes Laimer (1):
> pve-rs: sdn: add microseg config binding
>
> pve-rs/Makefile | 1 +
> pve-rs/src/bindings/sdn/microseg.rs | 235 ++++++++++++++++++++++++++++
> pve-rs/src/bindings/sdn/mod.rs | 1 +
> 3 files changed, 237 insertions(+)
> create mode 100644 pve-rs/src/bindings/sdn/microseg.rs
>
>
> ifupdown2:
>
> Hannes Laimer (1):
> d/patches: add support for VXLAN-GBP flag
>
> ...addons-vxlan-add-vxlan-gbp-attribute.patch | 228 ++++++++++++++++++
> debian/patches/series | 1 +
> 2 files changed, 229 insertions(+)
> create mode 100644 debian/patches/pve/0016-addons-vxlan-add-vxlan-gbp-attribute.patch
>
>
> pve-network:
>
> Hannes Laimer (8):
> sdn: microseg: add config, API and guest inventory
> sdn: dry-run: surface pending microseg changes
> sdn: zones: trigger microseg apply on tap_plug
> sdn: zones: add vxlan-gbp option to vxlan and evpn zones
> evpn: disable vxlan-learning on create if GBP is enabled
> sdn: microseg: add tag matcher
> sdn: microseg: add name regex matcher
> sdn: microseg: add carrier bridge API
>
> src/PVE/API2/Network/SDN.pm | 31 ++
> src/PVE/API2/Network/SDN/Makefile | 2 +
> src/PVE/API2/Network/SDN/Microseg.pm | 204 +++++++
> .../API2/Network/SDN/Microseg/Assignment.pm | 185 +++++++
> src/PVE/API2/Network/SDN/Microseg/Bridge.pm | 179 ++++++
> src/PVE/API2/Network/SDN/Microseg/Group.pm | 179 ++++++
> src/PVE/API2/Network/SDN/Microseg/Makefile | 8 +
> src/PVE/API2/Network/SDN/Microseg/Rule.pm | 180 +++++++
> src/PVE/Network/SDN.pm | 37 ++
> src/PVE/Network/SDN/Makefile | 1 +
> src/PVE/Network/SDN/Microseg.pm | 509 ++++++++++++++++++
> src/PVE/Network/SDN/Zones.pm | 6 +
> src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 11 +
> src/PVE/Network/SDN/Zones/VxlanPlugin.pm | 9 +
> 14 files changed, 1541 insertions(+)
> create mode 100644 src/PVE/API2/Network/SDN/Microseg.pm
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Assignment.pm
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Bridge.pm
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Group.pm
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Makefile
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Rule.pm
> create mode 100644 src/PVE/Network/SDN/Microseg.pm
>
>
> pve-manager:
>
> Hannes Laimer (6):
> ui: sdn: add microsegmentation panel
> ui: sdn: dry-run: show pending microseg diff
> network: apply microseg state on reload
> ui: sdn: zones: add vxlan-gbp checkbox to vxlan and evpn
> ui: sdn: microseg: add tag matcher
> ui: sdn: microseg: add name regex matcher
>
> PVE/API2/Network.pm | 4 +
> www/manager6/Makefile | 9 +
> www/manager6/Utils.js | 34 ++
> www/manager6/dc/Config.js | 8 +
> www/manager6/form/MicrosegGroupSelector.js | 77 +++++
> www/manager6/form/MicrosegGuestSelector.js | 83 +++++
> www/manager6/sdn/MicrosegView.js | 143 ++++++++
> www/manager6/sdn/SdnDiffView.js | 24 ++
> www/manager6/sdn/microseg/AssignmentEdit.js | 245 ++++++++++++++
> www/manager6/sdn/microseg/Base.js | 137 ++++++++
> www/manager6/sdn/microseg/GroupEdit.js | 45 +++
> www/manager6/sdn/microseg/PolicyView.js | 181 ++++++++++
> www/manager6/sdn/microseg/RuleEdit.js | 104 ++++++
> www/manager6/sdn/microseg/Tree.js | 356 ++++++++++++++++++++
> www/manager6/sdn/zones/EvpnEdit.js | 8 +
> www/manager6/sdn/zones/VxlanEdit.js | 11 +
> 16 files changed, 1469 insertions(+)
> create mode 100644 www/manager6/form/MicrosegGroupSelector.js
> create mode 100644 www/manager6/form/MicrosegGuestSelector.js
> create mode 100644 www/manager6/sdn/MicrosegView.js
> create mode 100644 www/manager6/sdn/microseg/AssignmentEdit.js
> create mode 100644 www/manager6/sdn/microseg/Base.js
> create mode 100644 www/manager6/sdn/microseg/GroupEdit.js
> create mode 100644 www/manager6/sdn/microseg/PolicyView.js
> create mode 100644 www/manager6/sdn/microseg/RuleEdit.js
> create mode 100644 www/manager6/sdn/microseg/Tree.js
>
>
> pve-docs:
>
> Hannes Laimer (2):
> sdn: add microsegmentation section
> sdn: add VXLAN-GBP flag to evpn/vxlan zone sections
>
> pvesdn.adoc | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 134 insertions(+)
>
>
> Summary over all repositories:
> 64 files changed, 8268 insertions(+), 1 deletions(-)
>
^ permalink raw reply [relevance 8%]
* [PATCH pve-docs v3 45/45] sdn: add microsegmentation section
2026-10-27 8:54 10% [PATCH access-control/cluster/container/docs/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs}/qemu-server v3 00/45] " Hannes Laimer
` (2 preceding siblings ...)
2026-10-27 8:55 23% ` [PATCH pve-network v3 25/45] sdn: microseg: add tag matcher Hannes Laimer
@ 2026-10-27 8:55 14% ` Hannes Laimer
2026-11-05 11:14 8% ` superseded: [PATCH access-control/cluster/container/docs/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs}/qemu-server v3 00/45] sdn: add microsegmentation support Hannes Laimer
4 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-10-27 8:55 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
pvesdn.adoc | 403 ++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 391 insertions(+), 12 deletions(-)
diff --git a/pvesdn.adoc b/pvesdn.adoc
index 7a674597d470..84f44ab73592 100644
--- a/pvesdn.adoc
+++ b/pvesdn.adoc
@@ -147,6 +147,9 @@ following sections:
* xref:pvesdn_config_vnet[VNets]: Create virtual network bridges and
manage subnets
+* xref:pvesdn_config_microseg[Microsegmentation]: Segment traffic between
+ guests with group-based policies
+
The Options category allows adding and managing additional services to be used
in your SDN setup.
@@ -189,6 +192,83 @@ files located in '/etc/pve/sdn'.
// TODO: extend implementation and technology details.
+[[pvesdn_microseg_background]]
+Microsegmentation Enforcement
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The node enforces the xref:pvesdn_config_microseg[microsegmentation] policy in
+the kernel, at the network interface of the receiving guest. It checks each
+packet on its own, without connection tracking, and drops a denied packet
+without an answer. Nothing runs in the guest, so a guest cannot turn it off or
+get around it.
+
+Each set of groups that an assignment lists gets a 16-bit number, its group
+identity, and sets that every rule treats alike share one. The node marks every
+packet an assigned interface sends with the identity of that interface. When a
+packet reaches an assigned interface, the node checks the identity of the
+sender against the identity of the receiver. Addresses play no part in this.
+
+A guest cannot forge its identity, since the node sets it. The network between
+the nodes is trusted to carry the identity unchanged, as it is trusted with
+VLAN tags.
+
+On the node, the identity lives in the low 16 bits of the packet mark and stays
+there when the node routes a packet. Other uses of the mark, such as policy
+routing by fwmark or firewall mark rules, must leave these bits alone. A rule
+that matches on the mark masks them out, for example
+`fwmark 0x10000/0xffff0000`. A packet the node itself sends with a value in
+these bits counts as that identity.
+
+Between nodes, only VXLAN and EVPN zones with the *VXLAN-GBP* option carry the
+identity, in the VXLAN header (see xref:pvesdn_zone_plugin_vxlan[VXLAN Zones]
+and xref:pvesdn_zone_plugin_evpn[EVPN Zones]). On every other zone, traffic
+from another node arrives without an identity and counts as untagged. The
+policy is bound to the guest interface, not to the zone. An interface on a
+bridge outside the SDN, such as `vmbr0`, is enforced like one on a VNet.
+
+For each pair of a sending and a receiving identity that a rule allows, the
+node keeps a verdict and the checks of the narrowed rules. A narrowed rule
+needs one check per protocol and per combination of a source and a destination
+port range, so a destination port list of `80,443` needs two checks. There is
+room for 65535 identities, 1048576 pairs and 512 checks per pair. A pair with
+more than 7 checks keeps the rest in a list shared with the pairs that have the
+same ones, and there is room for 16384 such lists.
+
+An SDN apply refuses a policy over one of these limits and names the limit, so
+such a policy never reaches a node. An identity that is no longer needed stays
+reserved for an hour, and the overview counts it as retired.
+
+A guest starts on a node only if all of its assigned interfaces can be enforced
+there, and a migration fails on the target node where a start would fail. If a
+node cannot read the applied SDN configuration, no guest with a network
+interface starts on it, since the node cannot tell which interfaces are
+assigned.
+
+If a node cannot apply the policy during an SDN apply, its network reload task
+fails and the node keeps its previous enforcement. On a node without loaded
+programs, for example after a failed apply at boot, no guest with an assigned
+interface starts until a reload succeeds. If the node cannot load a new
+package's programs, the previous package's programs stay in place.
+
+NOTE: Nodes with and without microsegmentation support can run in the same
+cluster during an upgrade, but the SDN apply should only be run on the nodes
+that support it. An apply from a node without support leaves the assigned
+guests that start after it unenforced.
+
+The guest firewall still applies, a packet has to pass both. A packet that
+microsegmentation drops gets no answer, even if the firewall is set to reject.
+
+With the guest firewall enabled, an interface usually sits behind its own
+firewall bridge, only the nftables firewall on a Linux bridge needs none. Behind
+a firewall bridge, the node cannot tell its own ARP and neighbor discovery
+replies from those of other senders. Such an interface therefore accepts both
+from every sender without an identity. Other interfaces accept them without an
+identity only from the node itself, or where a rule allows untagged traffic.
+
+WARNING: Behind a firewall bridge, an unassigned guest on the same VNet can
+answer ARP and neighbor discovery for addresses that are not its own. Only that
+guest's own firewall, filtering its IP and MAC addresses, prevents it.
+
[[pvesdn_config_zone]]
Zones
-----
@@ -311,12 +391,13 @@ MTU:: Because VXLAN encapsulation uses 50 bytes, the MTU needs to be 50 bytes
lower than the outgoing physical interface.
VXLAN-GBP:: Enable VXLAN Group Based Policy (GBP) on the zone's VXLAN
- interfaces. GBP carries a 16-bit group ID in the VXLAN header, taken from
- the packet mark on the sending node and restored on the receiving one.
- Every VTEP in the zone must have it enabled, since one without it drops
- GBP-tagged traffic. All zones that use the same VXLAN port must agree on
- this option, an SDN apply refuses a configuration where they do not.
- Optional.
+ interfaces. xref:pvesdn_config_microseg[Microsegmentation] uses it to carry
+ an interface's group identity between nodes. GBP carries a 16-bit group ID
+ in the VXLAN header, taken from the packet mark on the sending node and
+ restored on the receiving one. Every VTEP in the zone must have it enabled,
+ since one without it drops GBP-tagged traffic. All zones that use the same
+ VXLAN port must agree on this option, an SDN apply refuses a configuration
+ where they do not. Optional.
NOTE: The kernel sets GBP only when it creates a VXLAN interface. Changing the
option on an existing zone therefore recreates the zone's VXLAN interfaces on
@@ -384,12 +465,13 @@ MTU:: Because VXLAN encapsulation uses 50 bytes, the MTU needs to be 50 bytes
defaults to 1450.
VXLAN-GBP:: Enable VXLAN Group Based Policy (GBP) on the zone's VXLAN
- interfaces. GBP carries a 16-bit group ID in the VXLAN header, taken from
- the packet mark on the sending node and restored on the receiving one.
- Every VTEP in the zone must have it enabled, since one without it drops
- GBP-tagged traffic. All zones that use the same VXLAN port must agree on
- this option, an SDN apply refuses a configuration where they do not.
- Optional.
+ interfaces. xref:pvesdn_config_microseg[Microsegmentation] uses it to carry
+ an interface's group identity between nodes. GBP carries a 16-bit group ID
+ in the VXLAN header, taken from the packet mark on the sending node and
+ restored on the receiving one. Every VTEP in the zone must have it enabled,
+ since one without it drops GBP-tagged traffic. All zones that use the same
+ VXLAN port must agree on this option, an SDN apply refuses a configuration
+ where they do not. Optional.
NOTE: The kernel sets GBP only when it creates a VXLAN interface. Changing the
option on an existing zone therefore recreates the zone's VXLAN interfaces on
@@ -467,6 +549,303 @@ DNS Zone Prefix:: Add a prefix to the domain registration, like
<hostname>.prefix.<domain> Optional.
+[[pvesdn_config_microseg]]
+Microsegmentation
+-----------------
+
+Microsegmentation allows or denies traffic between groups of guests at their
+network interfaces, independent of their addresses. The node enforces it in the
+kernel, so a guest cannot turn it off, and a guest keeps its rules when it
+moves to another node.
+
+The policy consists of three kinds of objects. *Groups* are labels.
+*Assignments* put guest network interfaces into groups, by guest, by tag or by
+name. *Rules* allow or deny traffic from one set of groups to another. An
+interface that an assignment covers receives only what a rule allows.
+
+Microsegmentation is managed under `Datacenter -> SDN -> Microsegmentation`.
+The *Microsegmentation* tab of a guest shows the groups of its interfaces and
+the rules that apply to them. Changes to the policy take effect with the next
+SDN apply.
+
+Rules are stateless and apply to one direction, so a connection needs a rule
+for each direction, or one rule with *Both Directions* set. Traffic that does
+not come from a guest in a group, such as the replies of a gateway or a DHCP
+server, is untagged. It needs a rule with the built-in `untagged` group as the
+source.
+
+Between nodes, only VXLAN and EVPN zones with the *VXLAN-GBP* option carry the
+groups of a guest. On every other zone, traffic from another node arrives
+untagged. The guest firewall still applies, a packet has to pass both. See
+xref:pvesdn_microseg_background[Microsegmentation Enforcement] for how the
+enforcement works and for its limits.
+
+Viewing the configuration needs `SDN.Audit` on the `/sdn/microseg` ACL path,
+changing it needs `SDN.Allocate` there. The guests an assignment covers are
+shown only where you have `VM.Audit` on the guest, as in the resource tree.
+
+[[pvesdn_microseg_group]]
+Groups
+~~~~~~
+
+A group is a label for guest interfaces. An interface gets its groups from the
+one assignment that covers it (see
+xref:pvesdn_microseg_assignment[Assignments]). Rules match the groups of an
+interface, never the interface itself.
+
+Groups can be nested. An interface in a subgroup is also in every group above
+it. With `database` a subgroup of `production`, an interface assigned
+`database` has both groups. An `any` or `all` match over `production` covers
+it, an `exact` match over `production` does not, and rules on `database` cover
+databases only.
+
+The groups that an `all` or `exact` match lists include the groups above them,
+so an `exact` match over `database` means `production` and `database`. A rule
+with such a match on a subgroup is therefore more specific than the same rule
+on the parent. Specificity decides a tie between rules of the same priority
+(see xref:pvesdn_microseg_rule[Rules]). An `any` match counts no groups.
+
+Group configuration options:
+
+Name:: 2 to 32 letters, digits, `-` and `_`, starting and ending with a letter
+ or digit. The name `untagged` and names shaped like a generated ID, such as
+ `vm100`, are reserved.
+
+Parent:: The group this one is a subgroup of. Optional.
+
+Comment:: A descriptive comment. Optional.
+
+NOTE: A group cannot be deleted while a rule names it, an assignment lists it,
+or it has subgroups.
+
+[[pvesdn_microseg_rule]]
+Rules
+~~~~~
+
+A rule allows or denies traffic from a source to a destination. Each side lists
+groups and a match kind, checked against the groups of the sending and of the
+receiving interface. The default is deny, so rules allow traffic, or deny part
+of what a broader rule allows. Traffic within one group needs a rule like any
+other.
+
+A rule applies to one direction. A TCP connection from `web` to `app` needs an
+allow from `web` to `app`, and one from `app` to `web` for the replies. A rule
+with *Both Directions* set is exactly that pair, the rule and its mirror with
+source and destination swapped.
+
+Two guests can only talk once they have resolved each other's addresses. ARP
+and the neighbor solicitations and advertisements of IPv6 therefore pass
+between a sender and a receiver in both directions as soon as a rule allows
+any traffic between them in one direction.
+
+They also pass when the node sends them itself. That is how the ARP replies of
+a gateway on the node and the suppression replies of an EVPN zone reach a
+guest. Nothing else passes without a rule.
+
+A rule can be narrowed to a protocol, ports or an ICMP type, like a firewall
+rule. A narrowed rule decides only the IP traffic it names. Anything that is
+not IP, ARP, LLDP or spanning tree for example, gets the verdict of the rules
+without narrowing.
+
+Narrowed rules are checked from the highest priority down to the priority of
+the highest rule without narrowing. At the same priority the more specific
+rule comes first, and of two equally specific rules the deny. The first
+narrowed rule that matches a packet decides it. Traffic that no narrowed rule
+matches gets the verdict of the rules without narrowing, or is denied if there
+are none.
+
+To allow SSH from `web` to `app`, allow `tcp` with destination port `22` from
+`web` to `app`, and `tcp` with source port `22` from `app` to `web` for the
+replies. One rule with *Both Directions* set and destination port `22` does the
+same, since the mirror swaps the ports. Either way the reply rule allows every
+segment from port `22`, not only replies, so `app` can also open connections to
+`web` from that port.
+
+NOTE: Neighbor discovery is ICMPv6, so a narrowed deny of ICMPv6 blocks it even
+where the reverse direction allows traffic.
+
+IP fragments after the first one carry no transport header. A rule narrowed by
+ports or an ICMP type never matches them, and neither does a rule narrowed to
+just a protocol. If only narrowed allows let traffic pass between a sender and a
+receiver, the later fragments are dropped and fragmented packets never arrive.
+
+An allow with *Fragments Only* set lets them pass. It also passes the later
+fragments of other datagrams, but those cannot be reassembled without their
+first fragment, which the other rules decide.
+
+An IPv6 fragment counts as the protocol its fragment header names. If that is
+an extension header instead of the transport protocol, a rule narrowed to the
+transport protocol does not match it, but a rule without a protocol does.
+
+Where narrowed rules apply to a sender and a receiver, a packet whose transport
+header cannot be read is dropped, since the rules cannot be checked against it.
+Examples are a first fragment that ends before the transport header, an IPv6
+packet with more than 12 extension headers, and a packet with more than two
+VLAN tags. Where no narrowed rule applies, such a packet gets the same verdict
+as any other.
+
+The built-in `untagged` group stands for traffic without a group. It comes from
+an interface that no assignment covers, from a host outside the policy, or from
+another node over a zone without the *VXLAN-GBP* option. To allow such traffic,
+list `untagged` in the source of a rule, on its own or next to other groups
+with the `any` match. This is how the replies of a gateway, of a DHCP server or
+of any other host outside the policy reach a guest.
+
+NOTE: In a source with the `all` or `exact` match, `untagged` must be the only
+listed group, and an `every` source never includes it. A destination never
+matches `untagged`, since every enforced interface has a group. It can list
+`untagged` only next to other groups with the `any` match, where it has no
+effect. Assignments cannot use it.
+
+Rule configuration options:
+
+Source Groups/Dest. Groups:: The groups the sending or the receiving interface
+ is checked against. Not set with the `every` match.
+
+Source Match/Dest. Match:: How the listed groups compare with the groups of an
+ interface. `any` matches an interface that has at least one of them, `all`
+ one that has all of them, and `exact` one that has exactly the listed
+ groups. For `all` and `exact`, the listed groups include the groups above
+ them. `every` lists no groups and matches every assigned interface.
+ Optional, defaults to `any`.
+
+Priority:: A number from 0 to 65535. Among the rules without narrowing that
+ match a sender and a receiver, the highest priority decides, and among those
+ the most specific. The specificity of a rule is the number of groups its
+ `all` and `exact` matches list, the groups above them included, and an `any`
+ or `every` match counts none. Equally specific rules deny if one of them
+ denies. Optional, defaults to 0.
+
+Action:: Allow or deny.
+
+Protocol/Source port/Dest. port/ICMP type:: Narrow the rule, with the syntax of
+ firewall rules. Ports need a protocol that has ports, and an ICMP type needs
+ an ICMP protocol. Optional.
+
+Macro:: A firewall macro, for example `HTTPS` or `Ceph`, in place of the
+ protocol, ports and ICMP type. Not combined with them. Optional.
+
+Fragments Only:: Narrow the rule to the IP fragments after the first one, of
+ the given protocol or of every protocol. Not combined with ports, an ICMP
+ type or a macro. Optional.
+
+Both Directions:: Also apply the rule with source and destination swapped,
+ ports included. Not with the `untagged` group or an ICMP type, whether set
+ directly or through a macro such as `Ping`. Optional.
+
+Comment:: A descriptive comment. Optional.
+
+The source, the destination, the direction and the narrowing identify a rule,
+so they cannot be changed on an existing rule. Delete the rule and create it
+again instead. The priority, the action and the comment can be changed.
+
+[[pvesdn_microseg_assignment]]
+Assignments
+~~~~~~~~~~~
+
+An assignment puts guest network interfaces into a set of groups. Its matcher
+selects one guest, the guests with certain tags, or the guests whose name
+matches a regular expression. You choose the matcher when you add the
+assignment, with *Guest Assignment*, *Tag Assignment* or *Regex Assignment* in
+the *Add* menu.
+
+Assignments are an ordered list, checked from first to last. An interface gets
+exactly the groups of the first assignment that covers it, and later ones have
+no effect on it. A new assignment goes to the top unless you give it a
+position, and you can move an existing one. Place an assignment for a single
+guest above the tag or regex assignments that also cover that guest.
+
+An interface that no assignment covers is not enforced. All traffic reaches
+it, and its own traffic reaches enforced guests as untagged.
+
+A combination of groups needs one assignment that lists all of them, since an
+interface gets the groups of a single assignment. For guests tagged both `prod`
+and `web`, add a tag assignment with the `all` match over both tags that lists
+both groups. Place it above the assignments that match only one of the tags.
+
+Tag and regex matchers use the current tags and name of a guest. They are
+matched each time an interface of the guest comes up, so a new guest or a
+hot-plugged interface is enforced from the start. A change of a running guest's
+tags or name made with `qm set` or `pct set`, through the API or the web
+interface, takes effect immediately.
+
+Changes to the assignments themselves, their order included, are pending until
+the next SDN apply.
+
+NOTE: Moving an assignment usually changes only its own place, so only that
+assignment shows up as a pending change. After many moves to the same spot, all
+assignments are renumbered once and show up together.
+
+A tag or a name can put a guest into a group. Setting one that an assignment
+matches, at creation or later, therefore needs `SDN.Use` on `/sdn/microseg`
+besides the right to change the option. This applies to a tag that a tag
+assignment matches, and to a rename into or out of the names a regex
+assignment matches.
+
+Assignment configuration options:
+
+Guest:: (guest matcher) The VM or container.
+
+Tags:: (tag matcher) The guest tags to match. They are normalized like guest
+ tags, so their case matters only with a case-sensitive datacenter tag style.
+
+Tag Match:: (tag matcher) `any` matches a guest with at least one of the
+ listed tags, `all` one with all of them, and `exact` one with exactly these
+ tags. Optional, defaults to `any`.
+
+Name Regex:: (regex matcher) A regular expression in Rust syntax, ASCII only,
+ without backreferences or lookaround. It is matched anywhere in the VM name
+ or the container hostname, so anchor it with `^` and `$` for the whole name.
+ A VM without a name is never matched, not even by `.*`, since the `VM 100`
+ shown for it is not its name. A container created without a hostname gets
+ one like `CT100`, which is matched like any other name.
+
+Network Interface:: The number of a guest interface, from 0 to 31, `0` for
+ `net0`. Left empty, the assignment covers all interfaces of the guest.
+ Optional.
+
+Groups:: The groups that the covered interfaces get.
+
+Position:: The place in the list, 0 being the first. A position past the end
+ puts the assignment last. Left empty on an existing assignment, it keeps its
+ place. Optional, defaults to 0 for a new assignment.
+
+Comment:: A descriptive comment. Optional.
+
+The matcher fields and the network interface identify an assignment, so they
+cannot be changed on an existing one. Delete the assignment and create it
+again instead. The groups, the position and the comment can be changed.
+
+[[pvesdn_microseg_example]]
+Example
+~~~~~~~
+
+Web, application and database guests share one VNet and are tagged `web`,
+`app` and `db`. The web guests should reach the application guests, and those
+the databases, and nothing else.
+
+. Create the groups `web`, `app` and `db`.
+. For each tag, add a tag assignment that puts the guests with that tag into
+ the group of the same name.
+. Add a rule that allows `web` to `app` with *Both Directions* set, and one
+ that allows `app` to `db` the same way.
+. Add a rule that allows `untagged` to `web`, `app` and `db`, for the replies
+ of the gateway and the DHCP server.
+. Apply the SDN configuration.
+
+Web guests now reach the application guests, and those reach the databases.
+Traffic from web to database and traffic within a tier is dropped.
+
+NOTE: The rule for `untagged` also admits every guest on the VNet that no
+assignment covers. Either assign every guest, or narrow that rule to the
+protocols the outside traffic needs.
+
+To keep a staging environment apart from production, tag each guest with its
+environment as well and add the groups `prod` and `staging`. Then add one tag
+assignment per combination, such as `all` over `prod` and `web`, that lists
+both groups. In the rules, use the `all` match over the tier and the
+environment, for example `all` over `web` and `prod`.
+
[[pvesdn_config_controllers]]
Controllers
-----------
--
2.47.3
^ permalink raw reply related [relevance 14%]
* [PATCH pve-network v3 25/45] sdn: microseg: add tag matcher
2026-10-27 8:54 10% [PATCH access-control/cluster/container/docs/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs}/qemu-server v3 00/45] " Hannes Laimer
2026-10-27 8:54 10% ` [PATCH proxmox-ve-rs v3 13/45] microseg: add a crate that applies the policy to a node's guest NICs Hannes Laimer
2026-10-27 8:55 19% ` [PATCH pve-network v3 24/45] sdn: microseg: enforce the policy on " Hannes Laimer
@ 2026-10-27 8:55 23% ` Hannes Laimer
2026-10-27 8:55 14% ` [PATCH pve-docs v3 45/45] sdn: add microsegmentation section Hannes Laimer
2026-11-05 11:14 8% ` superseded: [PATCH access-control/cluster/container/docs/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs}/qemu-server v3 00/45] sdn: add microsegmentation support Hannes Laimer
4 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-10-27 8:55 UTC (permalink / raw)
To: pve-devel
A tag matcher binds every guest with the given tags to a set of
groups, guests created later included.
A tag the matchers name moves a guest between groups, an SDN change
like putting a NIC on a vnet. So a new permission check requires
SDN.Use on /sdn/microseg when a guest gains or loses such a tag.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
debian/control | 1 +
src/PVE/API2/Network/SDN/Microseg/Base.pm | 7 ++-
src/PVE/Network/SDN.pm | 1 +
src/PVE/Network/SDN/Microseg.pm | 74 +++++++++++++++++++----
4 files changed, 71 insertions(+), 12 deletions(-)
diff --git a/debian/control b/debian/control
index 86a6694d3a5f..f25e2ccfdf2a 100644
--- a/debian/control
+++ b/debian/control
@@ -41,6 +41,7 @@ Description: Proxmox VE's SDN (Software Defined Network) stack
Package: libpve-network-api-perl
Architecture: all
Depends: libpve-common-perl (>= 9.0.2),
+ libpve-guest-common-perl,
pve-firewall (>= 5.1.0~),
pve-cluster (>= 9.0.1),
libpve-network-perl (= ${binary:Version}),
diff --git a/src/PVE/API2/Network/SDN/Microseg/Base.pm b/src/PVE/API2/Network/SDN/Microseg/Base.pm
index dde88d10c7b1..58ec75c6fb12 100644
--- a/src/PVE/API2/Network/SDN/Microseg/Base.pm
+++ b/src/PVE/API2/Network/SDN/Microseg/Base.pm
@@ -5,6 +5,7 @@ use warnings;
use PVE::Cluster;
use PVE::Exception qw(raise_param_exc);
+use PVE::GuestHelpers;
use PVE::JSONSchema qw(get_standard_option);
use PVE::Tools qw(extract_param);
@@ -85,7 +86,7 @@ my sub assert_non_empty_lists {
my ($param) = @_;
my $errors = {};
- for my $property (qw(src dst groups)) {
+ for my $property (qw(src dst groups tags)) {
my $value = $param->{$property};
$errors->{$property} = "must not be empty" if $value && !@$value;
}
@@ -108,6 +109,10 @@ my sub create_object {
my $lock_token = extract_param($param, 'lock-token');
$param->{type} = $type;
+ if ($param->{tags}) {
+ $param->{tags} = PVE::GuestHelpers::get_unique_tags($param->{tags}, 1);
+ }
+
PVE::Cluster::check_cfs_quorum();
mkdir("/etc/pve/sdn");
diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
index 107095e3ca71..0aef192c2815 100644
--- a/src/PVE/Network/SDN.pm
+++ b/src/PVE/Network/SDN.pm
@@ -543,6 +543,7 @@ sub encode_value {
|| $key eq 'secondary-controllers'
|| $key eq 'redistribute'
|| $key eq 'groups'
+ || $key eq 'tags'
|| $key eq 'src'
|| $key eq 'dst'
) {
diff --git a/src/PVE/Network/SDN/Microseg.pm b/src/PVE/Network/SDN/Microseg.pm
index 3cd9c3a8ed35..8090043268a7 100644
--- a/src/PVE/Network/SDN/Microseg.pm
+++ b/src/PVE/Network/SDN/Microseg.pm
@@ -34,7 +34,7 @@ PVE::JSONSchema::register_standard_option(
cfs_register_file('sdn/microseg.cfg', \&parse_microseg_config, \&write_microseg_config);
-our $ASSIGNMENT_TYPES = ['guest-assignment'];
+our $ASSIGNMENT_TYPES = ['guest-assignment', 'tag-assignment'];
sub parse_microseg_config {
my ($filename, $raw) = @_;
@@ -202,7 +202,8 @@ sub assignment_properties {
$properties->{type} = {
type => 'string',
enum => $ASSIGNMENT_TYPES,
- description => "The matcher kind. 'guest-assignment' binds a specific guest.",
+ description => "The matcher kind. 'guest-assignment' binds a specific guest,"
+ . " 'tag-assignment' every guest carrying the matched tags.",
};
$properties->{vmid} = get_standard_option(
'pve-vmid',
@@ -212,6 +213,27 @@ sub assignment_properties {
description => "The guest whose NICs to bind.",
},
);
+ $properties->{tags} = {
+ type => 'array',
+ items => {
+ type => 'string',
+ format => 'pve-tag',
+ },
+ 'type-property' => 'type',
+ 'instance-types' => ['tag-assignment'],
+ description => "The guest tags to match. They are normalized like the tags on a"
+ . " guest, so case only matters with a case-sensitive datacenter tag style.",
+ };
+ $properties->{'tag-match'} = {
+ type => 'string',
+ enum => [@MATCH_KINDS],
+ optional => 1,
+ default => 'any',
+ 'type-property' => 'type',
+ 'instance-types' => ['tag-assignment'],
+ description => "How tags match. 'any' shares a listed tag, 'all' carries every"
+ . " listed tag, 'exact' equals the listed set.",
+ };
$properties->{iface} = {
type => 'integer',
minimum => 0,
@@ -247,10 +269,36 @@ sub optional_properties {
return { map { $_ => { $properties->{$_}->%*, optional => 1 } } keys $properties->%* };
}
+sub policy_tags {
+ my $tags = {};
+ for my $entry (values config()->to_sections()->%*) {
+ next if ($entry->{type} // '') ne 'tag-assignment';
+ $tags->{$_} = 1 for ($entry->{tags} // [])->@*;
+ }
+ return $tags;
+}
+
+# adding or removing a tag the assignments name can move the guest between groups, an SDN action
+# like putting a NIC on a vnet, so it needs SDN.Use on the policy. Both lists are tags as stored
+# in the guest config.
+sub check_tag_access {
+ my ($rpcenv, $authuser, $old, $new) = @_;
+
+ my %old = map { $_ => 1 } PVE::Tools::split_list($old // '');
+ my %new = map { $_ => 1 } PVE::Tools::split_list($new // '');
+ my $policy_tags = policy_tags();
+ for my $tag (keys %old, keys %new) {
+ next if ($old{$tag} // 0) == ($new{$tag} // 0) || !$policy_tags->{$tag};
+ $rpcenv->check($authuser, '/sdn/microseg', ['SDN.Use']);
+ return;
+ }
+}
+
sub guest_inventory {
my (%opts) = @_;
- my @props = map { "net$_" } 0 .. $MAX_NIC_INDEX;
+ # the data plane takes a guest's NICs from the node, so an apply leaves them out
+ my @props = ('tags', $opts{skip_nics} ? () : map { "net$_" } 0 .. $MAX_NIC_INDEX);
my $by_vmid = PVE::Cluster::get_guest_config_properties(\@props, $opts{vmid});
@@ -258,11 +306,14 @@ sub guest_inventory {
for my $vmid (sort { $a <=> $b } keys %$by_vmid) {
my $guest = $by_vmid->{$vmid};
+ my @tags = PVE::Tools::split_list($guest->{tags});
+
my @nics = grep { defined $guest->{"net$_"} } 0 .. $MAX_NIC_INDEX;
push @$inventory,
{
vmid => $vmid,
+ tags => \@tags,
nics => \@nics,
};
}
@@ -290,13 +341,13 @@ my sub parse_guest_nic {
return $iface =~ m/^(?:tap|veth)(\d+)i(\d+)$/;
}
-# the guest as the inventory lists it, with nothing but its vmid when it has no NICs
+# the guest as the inventory lists it, with nothing but its vmid when it has no tags
my sub guest_info {
my ($vmid) = @_;
- my ($guest) = guest_inventory(vmid => $vmid)->@*;
+ my ($guest) = guest_inventory(vmid => $vmid, skip_nics => 1)->@*;
- return $guest // { vmid => int($vmid), nics => [] };
+ return $guest // { vmid => int($vmid), tags => [], nics => [] };
}
# an unmounted pmxcfs reads like a config that was never committed, and enforcement would be dropped
@@ -333,11 +384,12 @@ sub apply_all {
eval {
my $lock = PVE::RS::SDN::Microseg::ExclusiveLock->new();
my $raw = read_running_config();
- $lock->apply($raw, guest_inventory())
- or !is_configured()
- or log_warn("microseg: the running config carries no microseg block, as written"
- . " before the upgrade or by a node without microsegmentation support, leaving"
- . " enforcement unchanged");
+ if (!$lock->apply($raw, guest_inventory(skip_nics => 1))) {
+ log_warn("microseg: the running config carries no microseg block, as written"
+ . " before the upgrade or by a node without microsegmentation support, leaving"
+ . " enforcement unchanged")
+ if is_configured();
+ }
};
die "microseg: failed to apply running config: $@" if $@;
}
--
2.47.3
^ permalink raw reply related [relevance 23%]
* [PATCH pve-network v3 24/45] sdn: microseg: enforce the policy on guest NICs
2026-10-27 8:54 10% [PATCH access-control/cluster/container/docs/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs}/qemu-server v3 00/45] " Hannes Laimer
2026-10-27 8:54 10% ` [PATCH proxmox-ve-rs v3 13/45] microseg: add a crate that applies the policy to a node's guest NICs Hannes Laimer
@ 2026-10-27 8:55 19% ` Hannes Laimer
2026-10-27 8:55 23% ` [PATCH pve-network v3 25/45] sdn: microseg: add tag matcher Hannes Laimer
` (2 subsequent siblings)
4 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-10-27 8:55 UTC (permalink / raw)
To: pve-devel
A guest NIC is enforced when it is plugged, and if attaching the
enforcement fails, so does the guest start. A full pass enforces
every guest NIC of the node. The package runs one when it is
configured and when libpve-rs-perl is upgraded, since the BPF
programs are compiled into that library.
A running config without a microseg block, as a version without
microseg support writes it, says nothing about the policy. A pass and
a plug leave enforcement as it is and warn where a policy is
configured.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
debian/libpve-network-perl.postinst | 21 ++++++++++
debian/triggers | 1 +
src/PVE/Network/SDN/Microseg.pm | 65 ++++++++++++++++++++++++++++-
src/PVE/Network/SDN/Zones.pm | 5 +++
4 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/debian/libpve-network-perl.postinst b/debian/libpve-network-perl.postinst
index 99faedf48f56..88e9675b6928 100644
--- a/debian/libpve-network-perl.postinst
+++ b/debian/libpve-network-perl.postinst
@@ -22,6 +22,18 @@ migrate_mac_cache() {
fi
}
+# The BPF programs are compiled into libpve-rs-perl, whose upgrade fires the
+# pve-microseg-update trigger so a full pass installs the new build. When both
+# packages are upgraded in one run, this package is only unpacked when the
+# library is set up, so dpkg drops the trigger and the configure runs the pass.
+apply_microseg() {
+ test -f /etc/pve/local/pve-ssl.pem || return 0
+ test -e /proxmox_install_mode && return 0
+
+ perl -MPVE::Network::SDN::Microseg -e 'PVE::Network::SDN::Microseg::apply_all()' \
+ || echo "applying the microsegmentation policy failed, run an SDN apply or a network reload"
+}
+
case "$1" in
configure)
# TODO: remove with PVE 9+
@@ -29,6 +41,15 @@ case "$1" in
migrate_ipam_db
migrate_mac_cache
fi
+ apply_microseg
+ ;;
+
+ triggered)
+ case " $2 " in
+ *" pve-microseg-update "*)
+ apply_microseg
+ ;;
+ esac
;;
esac
diff --git a/debian/triggers b/debian/triggers
index 59dd6885a5f9..30113fe73944 100644
--- a/debian/triggers
+++ b/debian/triggers
@@ -1 +1,2 @@
activate-noawait pve-api-updates
+interest-noawait pve-microseg-update
diff --git a/src/PVE/Network/SDN/Microseg.pm b/src/PVE/Network/SDN/Microseg.pm
index 05c432d4eec7..3cd9c3a8ed35 100644
--- a/src/PVE/Network/SDN/Microseg.pm
+++ b/src/PVE/Network/SDN/Microseg.pm
@@ -5,10 +5,13 @@ use warnings;
use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_write_file);
use PVE::JSONSchema qw(get_standard_option);
+use PVE::RESTEnvironment qw(log_warn);
use PVE::RPCEnvironment;
use PVE::Tools;
use PVE::RS::SDN::Microseg;
+use PVE::RS::SDN::Microseg::ExclusiveLock;
+use PVE::RS::SDN::Microseg::SharedLock;
PVE::JSONSchema::register_format(
'pve-sdn-microseg-id',
@@ -245,9 +248,11 @@ sub optional_properties {
}
sub guest_inventory {
+ my (%opts) = @_;
+
my @props = map { "net$_" } 0 .. $MAX_NIC_INDEX;
- my $by_vmid = PVE::Cluster::get_guest_config_properties(\@props);
+ my $by_vmid = PVE::Cluster::get_guest_config_properties(\@props, $opts{vmid});
my $inventory = [];
for my $vmid (sort { $a <=> $b } keys %$by_vmid) {
@@ -279,4 +284,62 @@ sub type_matches {
return (grep { $_ eq $got } @$want) ? 1 : 0;
}
+my sub parse_guest_nic {
+ my ($iface) = @_;
+
+ return $iface =~ m/^(?:tap|veth)(\d+)i(\d+)$/;
+}
+
+# the guest as the inventory lists it, with nothing but its vmid when it has no NICs
+my sub guest_info {
+ my ($vmid) = @_;
+
+ my ($guest) = guest_inventory(vmid => $vmid)->@*;
+
+ return $guest // { vmid => int($vmid), nics => [] };
+}
+
+# an unmounted pmxcfs reads like a config that was never committed, and enforcement would be dropped
+my sub read_running_config {
+ PVE::Cluster::check_cfs_is_mounted();
+ return PVE::Cluster::get_config('sdn/.running-config');
+}
+
+# a config that cannot be read may still hold a policy
+my sub is_configured {
+ my $sections = eval { config()->to_sections() };
+ return !defined($sections) || scalar(%$sections);
+}
+
+sub apply_interface {
+ my ($iface, $firewall_bridge) = @_;
+
+ my ($vmid) = parse_guest_nic($iface);
+ return if !defined($vmid);
+
+ $firewall_bridge = $firewall_bridge ? 1 : 0;
+
+ my $lock = PVE::RS::SDN::Microseg::SharedLock->new();
+ my $raw = read_running_config();
+ my $guest = guest_info($vmid);
+ if (!$lock->apply_iface($raw, $guest, $iface, $firewall_bridge)) {
+ log_warn("microseg: the running config carries no microseg block,"
+ . " '$iface' stays unenforced. looks like a node is running an older version")
+ if is_configured();
+ }
+}
+
+sub apply_all {
+ eval {
+ my $lock = PVE::RS::SDN::Microseg::ExclusiveLock->new();
+ my $raw = read_running_config();
+ $lock->apply($raw, guest_inventory())
+ or !is_configured()
+ or log_warn("microseg: the running config carries no microseg block, as written"
+ . " before the upgrade or by a node without microsegmentation support, leaving"
+ . " enforcement unchanged");
+ };
+ die "microseg: failed to apply running config: $@" if $@;
+}
+
1;
diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
index efcbeb3c1444..da24ef16dddb 100644
--- a/src/PVE/Network/SDN/Zones.pm
+++ b/src/PVE/Network/SDN/Zones.pm
@@ -11,6 +11,7 @@ use PVE::IPRoute2;
use PVE::Network;
use PVE::Network::SDN::Vnets;
+use PVE::Network::SDN::Microseg;
use PVE::Network::SDN::Zones::VlanPlugin;
use PVE::Network::SDN::Zones::QinQPlugin;
use PVE::Network::SDN::Zones::VxlanPlugin;
@@ -364,6 +365,10 @@ sub veth_create {
sub tap_plug {
my ($iface, $bridge, $tag, $firewall, $trunks, $rate) = @_;
+ # attach enforcement before bridging, so an assigned NIC never passes traffic unenforced
+ eval { PVE::Network::SDN::Microseg::apply_interface($iface, $firewall) };
+ die "microseg: refusing to bring up '$iface' unenforced: $@" if $@;
+
my $vnet = PVE::Network::SDN::Vnets::get_vnet($bridge, 1);
if (!$vnet) { # fallback for classic bridge
my $interfaces_config = PVE::INotify::read_file('interfaces');
--
2.47.3
^ permalink raw reply related [relevance 19%]
* [PATCH proxmox-ve-rs v3 13/45] microseg: add a crate that applies the policy to a node's guest NICs
2026-10-27 8:54 10% [PATCH access-control/cluster/container/docs/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs}/qemu-server v3 00/45] " Hannes Laimer
@ 2026-10-27 8:54 10% ` Hannes Laimer
2026-10-27 8:55 19% ` [PATCH pve-network v3 24/45] sdn: microseg: enforce the policy on " Hannes Laimer
` (3 subsequent siblings)
4 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-10-27 8:54 UTC (permalink / raw)
To: pve-devel
The crate hands the microseg policy of the SDN running config to the
policy subsystem of proxmox-ebpf. A full pass applies it to every
guest NIC on the node, a plug to a single NIC that is about to come
up. A validation needs only the config and tells whether the data
plane can hold it.
Only the microseg block of the running config is parsed. A plug runs
for every guest NIC, so a zone or DHCP type that this node's
proxmox-ve-config does not know yet must not keep guests from
starting. The SDN apply on such a node fails either way.
A guest's NICs come from the interfaces on the node and not from its
config, since the config names a hot-plugged NIC only after the
hotplug.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
Cargo.toml | 2 +
proxmox-microseg/Cargo.toml | 20 +++
proxmox-microseg/debian/changelog | 5 +
proxmox-microseg/debian/control | 46 +++++
proxmox-microseg/debian/copyright | 18 ++
proxmox-microseg/debian/debcargo.toml | 7 +
proxmox-microseg/debian/source/format | 1 +
proxmox-microseg/src/ebpf.rs | 235 +++++++++++++++++++++++++
proxmox-microseg/src/lib.rs | 66 +++++++
proxmox-microseg/src/nic.rs | 120 +++++++++++++
proxmox-microseg/src/running_config.rs | 26 +++
11 files changed, 546 insertions(+)
create mode 100644 proxmox-microseg/Cargo.toml
create mode 100644 proxmox-microseg/debian/changelog
create mode 100644 proxmox-microseg/debian/control
create mode 100644 proxmox-microseg/debian/copyright
create mode 100644 proxmox-microseg/debian/debcargo.toml
create mode 100644 proxmox-microseg/debian/source/format
create mode 100644 proxmox-microseg/src/ebpf.rs
create mode 100644 proxmox-microseg/src/lib.rs
create mode 100644 proxmox-microseg/src/nic.rs
create mode 100644 proxmox-microseg/src/running_config.rs
diff --git a/Cargo.toml b/Cargo.toml
index 4655b178b47a..d38e48897216 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,6 +3,7 @@ members = [
"proxmox-ve-config",
"proxmox-frr",
"proxmox-sdn-types",
+ "proxmox-microseg",
]
exclude = [
"build",
@@ -29,3 +30,4 @@ proxmox-network-types = { version = "1.1.2" }
proxmox-schema = { version = "5" }
proxmox-sdn-types = { version = "0.2", path = "proxmox-sdn-types" }
proxmox-serde = { version = "1.0.0" }
+proxmox-ve-config = { version = "0.10", path = "proxmox-ve-config" }
diff --git a/proxmox-microseg/Cargo.toml b/proxmox-microseg/Cargo.toml
new file mode 100644
index 000000000000..067b0f593990
--- /dev/null
+++ b/proxmox-microseg/Cargo.toml
@@ -0,0 +1,20 @@
+[package]
+name = "proxmox-microseg"
+description = "Proxmox VE SDN microsegmentation data plane"
+version = "0.1.0"
+authors.workspace = true
+edition.workspace = true
+license.workspace = true
+homepage.workspace = true
+exclude.workspace = true
+# proxmox-ebpf needs it
+rust-version = "1.88"
+
+[dependencies]
+anyhow = { workspace = true }
+log = "0.4"
+serde = { workspace = true, features = [ "derive" ] }
+serde_json = "1"
+
+proxmox-ebpf = { version = "0.1", features = [ "policy" ] }
+proxmox-ve-config = { workspace = true }
diff --git a/proxmox-microseg/debian/changelog b/proxmox-microseg/debian/changelog
new file mode 100644
index 000000000000..e8f8ee14dcf9
--- /dev/null
+++ b/proxmox-microseg/debian/changelog
@@ -0,0 +1,5 @@
+rust-proxmox-microseg (0.1.0) trixie; urgency=medium
+
+ * Initial release.
+
+ -- Proxmox Support Team <support@proxmox.com> Tue, 22 Sep 2026 16:02:32 +0200
diff --git a/proxmox-microseg/debian/control b/proxmox-microseg/debian/control
new file mode 100644
index 000000000000..35487025c2b7
--- /dev/null
+++ b/proxmox-microseg/debian/control
@@ -0,0 +1,46 @@
+Source: rust-proxmox-microseg
+Section: rust
+Priority: optional
+Build-Depends: debhelper-compat (= 13),
+ dh-sequence-cargo
+Build-Depends-Arch: cargo:native <!nocheck>,
+ rustc:native (>= 1.88) <!nocheck>,
+ libstd-rust-dev <!nocheck>,
+ librust-anyhow-1+default-dev <!nocheck>,
+ librust-log-0.4+default-dev <!nocheck>,
+ librust-proxmox-ebpf-0.1+default-dev <!nocheck>,
+ librust-proxmox-ebpf-0.1+policy-dev <!nocheck>,
+ librust-proxmox-ve-config-0.10+default-dev <!nocheck>,
+ librust-serde-1+default-dev <!nocheck>,
+ librust-serde-1+derive-dev <!nocheck>,
+ librust-serde-json-1+default-dev <!nocheck>
+Maintainer: Proxmox Support Team <support@proxmox.com>
+Standards-Version: 4.7.2
+Vcs-Git: git://git.proxmox.com/git/proxmox-ve-rs.git
+Vcs-Browser: https://git.proxmox.com/?p=proxmox-ve-rs.git
+Homepage: https://proxmox.com
+X-Cargo-Crate: proxmox-microseg
+
+Package: librust-proxmox-microseg-dev
+Architecture: any
+Multi-Arch: same
+Depends:
+ ${misc:Depends},
+ librust-anyhow-1+default-dev,
+ librust-log-0.4+default-dev,
+ librust-proxmox-ebpf-0.1+default-dev,
+ librust-proxmox-ebpf-0.1+policy-dev,
+ librust-proxmox-ve-config-0.10+default-dev,
+ librust-serde-1+default-dev,
+ librust-serde-1+derive-dev,
+ librust-serde-json-1+default-dev
+Provides:
+ librust-proxmox-microseg+default-dev (= ${binary:Version}),
+ librust-proxmox-microseg-0-dev (= ${binary:Version}),
+ librust-proxmox-microseg-0+default-dev (= ${binary:Version}),
+ librust-proxmox-microseg-0.1-dev (= ${binary:Version}),
+ librust-proxmox-microseg-0.1+default-dev (= ${binary:Version}),
+ librust-proxmox-microseg-0.1.0-dev (= ${binary:Version}),
+ librust-proxmox-microseg-0.1.0+default-dev (= ${binary:Version})
+Description: Proxmox VE SDN microsegmentation data plane - Rust source code
+ Source code for Debianized Rust crate "proxmox-microseg"
diff --git a/proxmox-microseg/debian/copyright b/proxmox-microseg/debian/copyright
new file mode 100644
index 000000000000..77952eba571e
--- /dev/null
+++ b/proxmox-microseg/debian/copyright
@@ -0,0 +1,18 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+Files:
+ *
+Copyright: 2019 - 2026 Proxmox Server Solutions GmbH <support@proxmox.com>
+License: AGPL-3.0-or-later
+ This program is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Affero General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option) any
+ later version.
+ .
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+ details.
+ .
+ You should have received a copy of the GNU Affero General Public License along
+ with this program. If not, see <https://www.gnu.org/licenses/>.
diff --git a/proxmox-microseg/debian/debcargo.toml b/proxmox-microseg/debian/debcargo.toml
new file mode 100644
index 000000000000..87a787e6d03e
--- /dev/null
+++ b/proxmox-microseg/debian/debcargo.toml
@@ -0,0 +1,7 @@
+overlay = "."
+crate_src_path = ".."
+maintainer = "Proxmox Support Team <support@proxmox.com>"
+
+[source]
+vcs_git = "git://git.proxmox.com/git/proxmox-ve-rs.git"
+vcs_browser = "https://git.proxmox.com/?p=proxmox-ve-rs.git"
diff --git a/proxmox-microseg/debian/source/format b/proxmox-microseg/debian/source/format
new file mode 100644
index 000000000000..89ae9db8f88b
--- /dev/null
+++ b/proxmox-microseg/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/proxmox-microseg/src/ebpf.rs b/proxmox-microseg/src/ebpf.rs
new file mode 100644
index 000000000000..02ea16d5a2ef
--- /dev/null
+++ b/proxmox-microseg/src/ebpf.rs
@@ -0,0 +1,235 @@
+use anyhow::{Context, bail};
+use proxmox_ebpf::policy::{self, Assignment, CHECK_MAX, CheckEntry, Family, Pair, Pass};
+use proxmox_ve_config::firewall::types::port::{PortEntry, PortList};
+use proxmox_ve_config::firewall::types::rule_match::{
+ IcmpCode, IcmpType, Icmpv6Code, Icmpv6Type, Ports, Protocol,
+};
+use proxmox_ve_config::sdn::microseg::MicrosegRunningConfig;
+use proxmox_ve_config::sdn::microseg::state::{self, DesiredState};
+
+use crate::nic::{self, LocalNics};
+
+pub use proxmox_ebpf::policy::{ExclusiveLock, PAIRS_MAX, SharedLock, lock_exclusive, lock_shared};
+
+fn port_bounds(list: Option<&PortList>) -> Vec<Option<(u16, u16)>> {
+ let Some(list) = list else {
+ // without a port list every port matches
+ return vec![None];
+ };
+ list.iter()
+ .map(|entry| {
+ Some(match entry {
+ PortEntry::Port(port) => (*port, *port),
+ PortEntry::Range(from, to) => (*from, *to),
+ })
+ })
+ .collect()
+}
+
+/// One entry per combination of source and destination range, since an entry carries a single range
+/// of each and both have to match.
+fn port_entries(ip_proto: u8, ports: &Ports, allow: bool) -> Vec<CheckEntry> {
+ let dports = port_bounds(ports.dport());
+ let mut entries = Vec::new();
+ for sport in port_bounds(ports.sport()) {
+ for &dport in &dports {
+ entries.push(CheckEntry {
+ ip_proto: Some(ip_proto),
+ sport,
+ dport,
+ allow,
+ ..Default::default()
+ });
+ }
+ }
+ entries
+}
+
+fn protocol_entries(protocol: &Protocol, allow: bool) -> anyhow::Result<Vec<CheckEntry>> {
+ let Some(ip_proto) = protocol.number() else {
+ bail!("protocol {protocol:?} was not resolved to a number");
+ };
+ Ok(match protocol {
+ Protocol::Tcp(tcp) => port_entries(ip_proto, tcp.ports(), allow),
+ Protocol::Udp(udp) => port_entries(ip_proto, udp.ports(), allow),
+ Protocol::Sctp(sctp) => port_entries(ip_proto, sctp.ports(), allow),
+ Protocol::Dccp(ports) | Protocol::UdpLite(ports) => port_entries(ip_proto, ports, allow),
+ // an icmp match covers IPv4 frames and an icmpv6 match IPv6 frames, which the protocol
+ // number alone does not say
+ Protocol::Icmp(icmp) => vec![CheckEntry {
+ ip_proto: Some(ip_proto),
+ family: Family::V4,
+ icmp_type: icmp.ty().and_then(IcmpType::number),
+ icmp_code: icmp.code().map(IcmpCode::number),
+ allow,
+ ..Default::default()
+ }],
+ Protocol::Icmpv6(icmpv6) => vec![CheckEntry {
+ ip_proto: Some(ip_proto),
+ family: Family::V6,
+ icmp_type: icmpv6.ty().and_then(Icmpv6Type::number),
+ icmp_code: icmpv6.code().map(Icmpv6Code::number),
+ allow,
+ ..Default::default()
+ }],
+ Protocol::Named(_) | Protocol::Numeric(_) => vec![CheckEntry {
+ ip_proto: Some(ip_proto),
+ allow,
+ ..Default::default()
+ }],
+ })
+}
+
+/// Pairs share checks, so translate each check once up front instead of once per pair.
+fn check_entries(state: &DesiredState) -> anyhow::Result<Vec<Vec<CheckEntry>>> {
+ let mut checks = Vec::with_capacity(state.checks.len());
+ for check in &state.checks {
+ let mut entries = Vec::new();
+ for protocol in &check.protocols {
+ entries.extend(protocol_entries(protocol, check.allow)?);
+ }
+ checks.push(entries);
+ }
+ Ok(checks)
+}
+
+fn pair_entries(
+ checks: &[Vec<CheckEntry>],
+ pair: &state::Pair,
+ cfg: &MicrosegRunningConfig,
+) -> anyhow::Result<Vec<CheckEntry>> {
+ let mut entries = Vec::new();
+ for &check in &pair.checks {
+ entries.extend_from_slice(&checks[check]);
+ }
+ // proxmox-ebpf refuses such a pair as well, but cannot name the classes by their groups
+ if entries.len() > CHECK_MAX {
+ bail!(
+ "pair {} -> {} needs {} checks, a pair holds at most {CHECK_MAX}",
+ cfg.describe_class(pair.src_id),
+ cfg.describe_class(pair.dst_id),
+ entries.len(),
+ );
+ }
+ Ok(entries)
+}
+
+fn pairs(state: &DesiredState, cfg: &MicrosegRunningConfig) -> anyhow::Result<Vec<Pair>> {
+ let checks = check_entries(state)?;
+ let mut pairs = Vec::with_capacity(state.pairs.len());
+ for pair in &state.pairs {
+ pairs.push(Pair {
+ src_id: pair.src_id,
+ dst_id: pair.dst_id,
+ checks: pair_entries(&checks, pair, cfg)?,
+ allow: pair.allow,
+ });
+ }
+ Ok(pairs)
+}
+
+pub struct FullPass {
+ configured: bool,
+ assignments: Vec<Assignment>,
+ pairs: Vec<Pair>,
+}
+
+pub fn full_pass(
+ nics: &LocalNics,
+ state: &DesiredState,
+ cfg: &MicrosegRunningConfig,
+) -> anyhow::Result<FullPass> {
+ let assignments = state
+ .nics
+ .iter()
+ .map(|resolved| {
+ let Some(name) = nics.name(resolved.vmid, resolved.iface) else {
+ bail!(
+ "NIC vm{} net{} has no interface on this node",
+ resolved.vmid,
+ resolved.iface
+ );
+ };
+ Ok(Assignment {
+ iface: name.to_owned(),
+ id: resolved.id,
+ firewall_bridge: nic::behind_firewall_bridge(name),
+ })
+ })
+ .collect::<anyhow::Result<Vec<_>>>()?;
+ Ok(FullPass {
+ configured: state.configured,
+ assignments,
+ pairs: pairs(state, cfg)?,
+ })
+}
+
+pub fn check(state: &DesiredState, cfg: &MicrosegRunningConfig) -> anyhow::Result<()> {
+ policy::check(&pairs(state, cfg)?).context("the data plane cannot take the microseg policy")
+}
+
+pub fn apply(lock: &ExclusiveLock, pass: &FullPass) -> anyhow::Result<()> {
+ let applied = lock.apply(pass.configured, &pass.assignments, &pass.pairs)?;
+ if applied != Pass::Applied {
+ return Ok(());
+ }
+ let level = if pass.assignments.is_empty() {
+ log::Level::Debug
+ } else {
+ log::Level::Info
+ };
+ log::log!(
+ level,
+ "microseg: applied {} assigned NICs on this node, {} pairs",
+ pass.assignments.len(),
+ pass.pairs.len()
+ );
+ Ok(())
+}
+
+#[cfg(test)]
+mod tests {
+ use proxmox_ve_config::firewall::types::rule_match::Tcp;
+ use proxmox_ve_config::sdn::microseg::state::Check;
+
+ use super::*;
+
+ fn ports(list: &str) -> PortList {
+ list.parse().expect("valid port list")
+ }
+
+ /// The entries depend on nothing but the one check.
+ fn state(protocols: Vec<Protocol>) -> DesiredState {
+ DesiredState {
+ configured: true,
+ pairs: vec![state::Pair {
+ src_id: 1,
+ dst_id: 2,
+ checks: vec![0],
+ allow: false,
+ }],
+ checks: vec![Check {
+ protocols,
+ allow: true,
+ }],
+ nics: Vec::new(),
+ }
+ }
+
+ #[test]
+ fn check_rejects_what_the_apply_would() {
+ let elements: Vec<String> = (1..=CHECK_MAX + 1).map(|port| port.to_string()).collect();
+ let tcp = Tcp::new(Ports::new(None, ports(&elements.join(","))));
+ let over = state(vec![Protocol::Tcp(tcp)]);
+ let cfg: MicrosegRunningConfig = serde_json::from_str(
+ r#"{"ids":{},"identities":{"next":3,"classes":{"1":["web"],"2":["db"]}}}"#,
+ )
+ .expect("parse running config");
+ let error = check(&over, &cfg).expect_err("past the bound");
+ let message = format!("{error:#}");
+ assert!(message.contains("pair 1 (web) -> 2 (db)"), "{message}");
+
+ let tcp = Tcp::new(Ports::new(None, ports("22")));
+ check(&state(vec![Protocol::Tcp(tcp)]), &cfg).expect("an ordinary pair");
+ }
+}
diff --git a/proxmox-microseg/src/lib.rs b/proxmox-microseg/src/lib.rs
new file mode 100644
index 000000000000..4646d70982d1
--- /dev/null
+++ b/proxmox-microseg/src/lib.rs
@@ -0,0 +1,66 @@
+mod ebpf;
+mod nic;
+mod running_config;
+
+use anyhow::{Context, bail};
+use proxmox_ve_config::sdn::microseg::state::{DesiredState, resolve_iface};
+use proxmox_ve_config::sdn::microseg::{GuestInfo, MicrosegRunningConfig};
+
+pub use crate::ebpf::{ExclusiveLock, SharedLock, lock_exclusive, lock_shared};
+pub use crate::running_config::parse as parse_running_config;
+
+fn full_pass(
+ cfg: &MicrosegRunningConfig,
+ inventory: &[GuestInfo],
+) -> anyhow::Result<ebpf::FullPass> {
+ let nics = nic::LocalNics::list()?;
+ let state = DesiredState::build(cfg, &nics.guests(inventory), ebpf::PAIRS_MAX)
+ .context("desired state")?;
+ ebpf::full_pass(&nics, &state, cfg)
+}
+
+pub fn apply(
+ lock: &ExclusiveLock,
+ cfg: &MicrosegRunningConfig,
+ inventory: &[GuestInfo],
+) -> anyhow::Result<()> {
+ ebpf::apply(lock, &full_pass(cfg, inventory)?)
+}
+
+/// Fails for a config the data plane could not install. The pairs alone decide that, and they
+/// cover every allocated class whatever the guests match, so no inventory is needed.
+pub fn check(cfg: &MicrosegRunningConfig) -> anyhow::Result<()> {
+ let state = DesiredState::build(cfg, &[], ebpf::PAIRS_MAX).context("desired state")?;
+ ebpf::check(&state, cfg)
+}
+
+/// Enforce the policy on a guest NIC that is about to come up. An assigned NIC gets its class. A
+/// NIC no assignment covers loses what an earlier plug or pass placed for its index, so one that
+/// comes up again in place drops its old identity. A failure in either case is an error rather
+/// than a skip, since the NIC would come up unenforced or as a class it left. `guest` is the
+/// plugged guest as the inventory lists it. `firewall_bridge` says the NIC is about to be put
+/// behind a firewall bridge.
+pub fn apply_iface(
+ lock: &SharedLock,
+ cfg: &MicrosegRunningConfig,
+ guest: &GuestInfo,
+ ifname: &str,
+ firewall_bridge: bool,
+) -> anyhow::Result<()> {
+ let Some((vmid, iface)) = nic::parse(ifname) else {
+ log::warn!("microseg: {ifname} is not a guest NIC name, skipping");
+ return Ok(());
+ };
+ if vmid != guest.vmid {
+ bail!(
+ "{ifname} is a NIC of guest {vmid}, not of guest {}",
+ guest.vmid
+ );
+ }
+ let Some(id) = resolve_iface(cfg, guest, iface)? else {
+ log::debug!("microseg: {ifname} is unassigned");
+ lock.release_iface(ifname)?;
+ return Ok(());
+ };
+ lock.apply_iface(ifname, id, firewall_bridge)
+}
diff --git a/proxmox-microseg/src/nic.rs b/proxmox-microseg/src/nic.rs
new file mode 100644
index 000000000000..6a0b974b0f49
--- /dev/null
+++ b/proxmox-microseg/src/nic.rs
@@ -0,0 +1,120 @@
+use std::collections::{BTreeMap, BTreeSet, HashMap};
+
+use anyhow::Context;
+use proxmox_ve_config::sdn::microseg::GuestInfo;
+
+/// The guest and the NIC index a host interface name stands for.
+pub fn parse(name: &str) -> Option<(u32, u32)> {
+ let rest = name
+ .strip_prefix("tap")
+ .or_else(|| name.strip_prefix("veth"))?;
+ let (vmid, iface) = rest.split_once('i')?;
+ // the integer parser alone would also take a sign
+ let number = |digits: &str| -> Option<u32> {
+ digits
+ .bytes()
+ .all(|byte| byte.is_ascii_digit())
+ .then(|| digits.parse().ok())
+ .flatten()
+ };
+ Some((number(vmid)?, number(iface)?))
+}
+
+/// A guest without a name or tags may be missing from the inventory. An assignment by VMID covers
+/// it all the same, so it is known by its VMID alone.
+fn guest(known: Option<&GuestInfo>, vmid: u32) -> GuestInfo {
+ known.cloned().unwrap_or(GuestInfo {
+ vmid,
+ ..Default::default()
+ })
+}
+
+pub fn behind_firewall_bridge(name: &str) -> bool {
+ let Some((vmid, iface)) = parse(name) else {
+ return false;
+ };
+ std::fs::read_link(format!("/sys/class/net/{name}/master")).is_ok_and(|bridge| {
+ bridge
+ .file_name()
+ .is_some_and(|master| master.to_string_lossy() == format!("fwbr{vmid}i{iface}"))
+ })
+}
+
+/// The node says which NICs a guest has, since its config does not name a hot-plugged NIC until the
+/// plug is through.
+pub struct LocalNics(BTreeMap<(u32, u32), String>);
+
+impl LocalNics {
+ pub fn list() -> anyhow::Result<Self> {
+ // a failure must not read as a node without guest NICs, a full pass would then take
+ // enforcement off every one of them
+ let names = std::fs::read_dir("/sys/class/net")
+ .and_then(|entries| {
+ entries
+ .map(|entry| Ok(entry?.file_name().to_string_lossy().into_owned()))
+ .collect::<std::io::Result<Vec<_>>>()
+ })
+ .context("list the interfaces of this node")?;
+ Ok(Self::from_names(names))
+ }
+
+ fn from_names(names: impl IntoIterator<Item = String>) -> Self {
+ let nics = names
+ .into_iter()
+ .filter_map(|name| Some((parse(&name)?, name)));
+ Self(nics.collect())
+ }
+
+ pub fn name(&self, vmid: u32, iface: u32) -> Option<&str> {
+ self.0.get(&(vmid, iface)).map(String::as_str)
+ }
+
+ pub fn guests(&self, inventory: &[GuestInfo]) -> Vec<GuestInfo> {
+ let mut nics: BTreeMap<u32, BTreeSet<u32>> = BTreeMap::new();
+ for &(vmid, iface) in self.0.keys() {
+ nics.entry(vmid).or_default().insert(iface);
+ }
+ let known: HashMap<u32, &GuestInfo> = inventory.iter().map(|g| (g.vmid, g)).collect();
+ nics.into_iter()
+ .map(|(vmid, nics)| GuestInfo {
+ nics: nics.into_iter().collect(),
+ ..guest(known.get(&vmid).copied(), vmid)
+ })
+ .collect()
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn a_guest_has_the_nics_the_node_has() {
+ let inventory = [
+ GuestInfo {
+ vmid: 100,
+ name: Some("web".to_string()),
+ nics: vec![0, 5],
+ ..Default::default()
+ },
+ GuestInfo {
+ vmid: 300,
+ nics: vec![0],
+ ..Default::default()
+ },
+ ];
+ let names = ["lo", "tap100i1", "fwln100i0", "veth200i0", "tap100i0"];
+ let nics = LocalNics::from_names(names.map(str::to_string));
+ let guests = nics.guests(&inventory);
+ assert_eq!(nics.name(200, 0), Some("veth200i0"));
+
+ // net1 is not in the config of vm100 yet and net5 is not plugged, vm300 runs elsewhere
+ assert_eq!(guests.len(), 2);
+ assert_eq!(guests[0].vmid, 100);
+ assert_eq!(guests[0].name.as_deref(), Some("web"));
+ assert_eq!(guests[0].nics, [0, 1]);
+ assert_eq!(guests[1].vmid, 200);
+ assert_eq!(guests[1].name, None);
+ assert_eq!(guests[1].nics, [0]);
+ }
+}
diff --git a/proxmox-microseg/src/running_config.rs b/proxmox-microseg/src/running_config.rs
new file mode 100644
index 000000000000..dbf8160de196
--- /dev/null
+++ b/proxmox-microseg/src/running_config.rs
@@ -0,0 +1,26 @@
+use proxmox_ve_config::sdn::microseg::MicrosegRunningConfig;
+use serde::Deserialize;
+
+#[derive(Deserialize)]
+struct Sections {
+ microseg: Option<MicrosegRunningConfig>,
+}
+
+/// `None` for a running config without a microseg block. Every apply writes the block, even an
+/// empty one, so only a node without microseg support leaves it out. Such a document says nothing
+/// about the policy, it does not declare an empty one.
+pub fn parse(raw: &str) -> anyhow::Result<Option<MicrosegRunningConfig>> {
+ let sections: Sections = serde_json::from_str(raw)?;
+ Ok(sections.microseg)
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn a_missing_block_is_absent() {
+ let cfg = parse(r#"{"zones": {"ids": {}}}"#).expect("parse running config");
+ assert_eq!(cfg, None);
+ }
+}
--
2.47.3
^ permalink raw reply related [relevance 10%]
* [PATCH access-control/cluster/container/docs/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs}/qemu-server v3 00/45] sdn: add microsegmentation support
@ 2026-10-27 8:54 10% Hannes Laimer
2026-10-27 8:54 10% ` [PATCH proxmox-ve-rs v3 13/45] microseg: add a crate that applies the policy to a node's guest NICs Hannes Laimer
` (4 more replies)
0 siblings, 5 replies; 26+ results
From: Hannes Laimer @ 2026-10-27 8:54 UTC (permalink / raw)
To: pve-devel
This series adds group-based microsegmentation to SDN, enforced by eBPF
programs on the guest interfaces. Assignments put guest interfaces into
groups, and rules between groups decide which traffic passes. Sets that
every rule treats the same share one identity, a 16-bit value that
travels with the frame in the low bits of the packet mark. The host
stamps it where a frame comes off the guest interface, so a guest cannot
forge its own. A new zone option turns on VXLAN-GBP[2] for VXLAN and
EVPN zones, which carries the identity across nodes. On a zone without
it, traffic from another node arrives without an identity. An identity
whose sets are gone after a config change is retired. Its value is
reused only after a quarantine, since a frame stamped under the old
config can still be in flight.
The config in /etc/pve/sdn/microseg.cfg, with its API under
/cluster/sdn/microseg and the ACL path /sdn/microseg, holds groups,
rules and assignments and takes effect with an SDN apply. Groups can
nest, and a member of a subgroup is in every group above it. A rule
allows or denies traffic from a source predicate to a destination
predicate at a priority. A predicate of the kind `any`, `all` or
`exact` lists groups and matches an interface that has one of them, all
of them, or those and no others. An `every` predicate lists none and
matches each interface that has a group. Beyond the pair, a rule can be
narrowed to a protocol and ports, an ICMP type, a firewall macro or
non-first fragments. Which groups an interface has is determined by the
assignments, an ordered list that matches interfaces by guest, tag or
name regex. An interface takes the groups of the first one that covers
it.
Default is deny. Only interfaces that have at least one group assigned
are enforced. Enforcement happens when a frame arrives at an enforced
interface, so nothing is dropped on the way out of a guest's interface.
Traffic from interfaces that are not enforced is untagged, which
includes guests without groups on their NICs, the host and the outside.
Such traffic has to be allowed explicitly with the built-in untagged
group. Rules are stateless and directional, so a reply needs its own
allow, or the rule is marked bidirectional. Stateless also means no
reassembly, so fragments after the first carry no transport header. A
narrowed rule matches them only when it is narrowed to fragments.
The highest priority wins. At the same priority the rule with the more
specific `all` or `exact` predicate decides, so a rule on a subgroup
outranks the same rule on its parent. Equally specific rules deny if one
of them denies. Narrowed rules are checked before the rules that decide
the whole pair at the same priority.
A guest interface gets its groups the moment it comes up, from the
assignment that matches the guest at that moment. Changing the tags or
the name of a running guest takes effect right after the config is
written. The NICs get the groups the assignments now give them. Once no
assignment matches the guest, their enforcement stops. A change that
reaches the config another way, such as a restore or a migration, takes
effect the next time the NIC comes up or at the next SDN apply. A tag
or name the assignments match moves a guest between groups. So adding
or removing such a tag, or renaming into or out of such a name, needs
SDN.Use on /sdn/microseg besides the right to change the option.
Putting a NIC on a vnet needs SDN.Use on the vnet the same way.
As long as the policy has an assignment, every node keeps the programs
and maps loaded, about 20 MiB plus what the pairs take. Without one, the
nodes drop them. The BPF state does not survive a reboot, so a node
applies the policy again at boot, before any guest starts. The programs
are compiled into libpve-rs-perl, so an upgrade of that package applies
the policy again as well.
The SDN apply checks the policy against what a node can hold before it
writes the running config, and refuses one that exceeds it. A node that
cannot apply the policy fails its network reload task and keeps its
previous enforcement. A node without loaded programs, as after a failed
load at boot, starts no guest with an assigned interface until an apply
or a reload succeeds there. A guest also does not start when its node
cannot read or parse the running config, or cannot set up the
enforcement of its assigned interface.
ARP and neighbor solicitations/advertisements pass wherever either
direction of a pair allows anything, so the two ends of a one-way allow
can resolve each other's addresses. They also pass when the host itself
sends them without an identity. That is how the suppression replies of
an EVPN zone reach the guest. A frame the host turns around on the
interface it came in on passes as a whole, since only the host can make
one. Behind a firewall bridge the host's frames cannot be told from
other unstamped ones, so an interface there takes these frames from
every unstamped sender. The narrowed rules of a pair run first, so a
narrowed rule that denies neighbor discovery still holds.
In patch order, the series adds
- proxmox-ebpf, the policy subsystem with the tc programs that stamp
and check the identities
- proxmox-ve-rs, the types, the identity engine and the desired state
in proxmox-ve-config, and the new proxmox-microseg crate that hands
the desired state to the subsystem
- pve-cluster, microseg.cfg as an observed file
- pve-access-control, the /sdn/microseg ACL path
- proxmox-perl-rs, the config binding and the data plane binding in
pve-rs
- pve-network, the config, the API, the dry-run view, the zone option
and the enforcement on interface plug and after a library upgrade
- pve-manager, the panel, the dry-run view and the apply on network
reload and at boot
- qemu-server and pve-container, the immediate update of a running
guest's NICs on a tag or name change, and SDN.Use for a tag or name
the policy matches
- pve-docs, documentation
- pve-network needs pve-cluster, pve-access-control, pve-rs,
pve-guest-common and ifupdown2 with the vxlan-gbp attribute
- pve-manager needs pve-docs to build and pve-network and
pve-access-control at runtime
- pve-rs needs proxmox-microseg and proxmox-ve-config
- qemu-server and pve-container need pve-network
- proxmox-microseg needs proxmox-ebpf[1] and proxmox-ve-config
The ifupdown2 vxlan-gbp attribute[2] is sent separately, and so is the
pve-network patch that writes a VXLAN zone's local tunnel address[3].
This series needs both. A GBP device that ifupdown2 changes in place
drops every GBP frame afterward[4], and without[3] that happens when a
VXLAN zone with GBP exists next to an EVPN zone. ifupdown2 gives the
local tunnel address of the EVPN zone's interfaces to every VXLAN
interface without one of its own, and on a reload sets that address on
the VXLAN zone's live device.
[1] https://lore.proxmox.com/pve-devel/20261019142413.2255644-1-h.laimer@proxmox.com/
[2] https://lore.proxmox.com/pve-devel/20260828134708.692354-1-h.laimer@proxmox.com/
[3] https://lore.proxmox.com/pve-devel/20260925134050.754528-1-h.laimer@proxmox.com/
[4] https://lore.kernel.org/netdev/20261023-b4-vxlan-changelink-gbp-v1-0-f0d13951c09b@proxmox.com/
note: I did also have this implemented with nft instead of ebpf as a
dataplane. Without narrowing, packets per second (small UDP packets) was
about the same, with multiple checks nft's rate went down, nothing super
dramatic but about a 1.5-2x compared to eBPF (~140k vs ~250k). eBPF is
also more flexible, in case we want to expand possible actions in the
future, but replacing the dataplane is pretty simple which also allowed
me to do the side-by-side testing.
changelog
v3:
- the data plane is a library crate in the proxmox-ve-rs workspace that
pve-rs binds, on a policy subsystem in proxmox-ebpf, no agent binary
and no boot unit. A node loads the programs while the policy has an
assignment and takes new programs on a package upgrade
- the model changed in five places:
* groups have no numeric mark and can form a hierarchy
* assignments are an ordered list and an interface takes the groups
of the first that covers it instead of the union of all
* rules can be narrowed similar to how firewall rules work,
additionally non-first fragments can be matched and an explicit
bidirectional flag exists
* at a priority tie the more specific rule decides
* new `every` predicate that matches everything that has at least
one group assigned
- interface group (re)assignment happens whenever an interface comes
up, sdn apply runs or the tags or name of a running guest change.
Adding or removing a tag covered by an assignment, or renaming into
or out of a name a regex assignment matches, now also needs SDN.Use
on the policy, similar to how we check if a user is allowed to assign
a vnet
- if a node cannot apply the policy, its network reload task fails.
while a node has no loaded programs, as after a failed load at boot,
guests with an assigned NIC do not start on it. a nic with groups
only comes up enforced
- ARP and NS/NA are automatically allowed if there exists a (src,dst)
-> [checks ->] allow in either direction, this is so address
resolution for allowed connections is possible. Also host-generated
ARP and NS/NA frames are allowed, this is specifically needed for
EVPN suppression to work, and a frame the host turns around on the
interface it came in on passes
- api: section types and property keys are kebab-case, the endpoints
check /sdn/microseg (a pve-access-control patch adds the ACL path),
and the overview reports members, evaluation order and specificity
instead of a realized state, plus the id space usage
- rule and assignment ids are derived from their identifying fields,
so those cannot change on an existing object
- ui: a panel with the rule grid by priority, the assignments in match
order, the dry-run view, the rule editor on the firewall's selectors,
and a guest tab with its groups and rules
- the SRv6 carrier and its bridge object are out, the ifupdown2
vxlan-gbp attribute is a standalone patch, the zone option stays,
docs rewritten
v2:
- core model reworked: each interface now holds a *set* of groups
compiled into a per-NIC wire identity, replacing the single-group
parent/child tree
- rules gained explicit `src`/`dst` predicates (any/all/exact) and a
`prio`, replacing the implicit tree-distance ordering
- `untagged` is now a nameable built-in group (mark 0)
- assignments are additive: a NIC's set is the union of all that
resolve to it
- added tag-matcher and name-regex assignments
- rule and dynamic-assignment ids are now generated
- identity allocation is fresh-first with quarantined reclamation, so
churn cannot exhaust the id space
- split the SRv6 carrier support into droppable tail patches
- updated docs
- updated cover-letter
proxmox-ebpf:
Hannes Laimer (3):
build: keep the build directory out of the BPF objects
policy: add the enforcement subsystem for guest interfaces
policy: add a check for non-first fragments
Cargo.toml | 1 +
build.rs | 4 +
debian/control | 6 +-
src/bpf-shim/bpf/bpf_helpers.h | 1 +
src/bpf-shim/vmlinux.h | 1 +
src/lib.rs | 3 +
src/policy/bpf/mark.h | 27 +
src/policy/bpf/policy.bpf.c | 385 ++++++++++++
src/policy/bpf/types.h | 75 +++
src/policy/mod.rs | 1005 ++++++++++++++++++++++++++++++++
src/policy/types.rs | 159 +++++
src/subsystem.rs | 35 +-
tests/common/mod.rs | 40 ++
tests/policy.rs | 837 ++++++++++++++++++++++++++
14 files changed, 2573 insertions(+), 6 deletions(-)
create mode 100644 src/policy/bpf/mark.h
create mode 100644 src/policy/bpf/policy.bpf.c
create mode 100644 src/policy/bpf/types.h
create mode 100644 src/policy/mod.rs
create mode 100644 src/policy/types.rs
create mode 100644 tests/policy.rs
proxmox-ve-rs:
Hannes Laimer (11):
ve-config: firewall: add a constructor for sctp matches
ve-config: sdn: microseg: add identity allocation for group sets
ve-config: sdn: microseg: add config types
ve-config: sdn: microseg: add tag matcher
ve-config: sdn: microseg: add name regex matcher
ve-config: sdn: microseg: narrow rules by protocol and ports
ve-config: sdn: microseg: add group hierarchy
ve-config: firewall: expose protocol, icmp type and code numbers
ve-config: sdn: microseg: add the desired state
microseg: add a crate that applies the policy to a node's guest NICs
microseg: add a rule option that matches non-first fragments
Cargo.toml | 2 +
proxmox-microseg/Cargo.toml | 20 +
proxmox-microseg/debian/changelog | 5 +
proxmox-microseg/debian/control | 46 +
proxmox-microseg/debian/copyright | 18 +
proxmox-microseg/debian/debcargo.toml | 7 +
proxmox-microseg/debian/source/format | 1 +
proxmox-microseg/src/ebpf.rs | 247 +++
proxmox-microseg/src/lib.rs | 66 +
proxmox-microseg/src/nic.rs | 120 ++
proxmox-microseg/src/running_config.rs | 26 +
proxmox-ve-config/src/firewall/fw_macros.rs | 7 +
proxmox-ve-config/src/firewall/ports.rs | 65 +
.../src/firewall/types/rule_match.rs | 63 +
proxmox-ve-config/src/sdn/microseg/api.rs | 710 +++++++++
.../src/sdn/microseg/identity.rs | 475 ++++++
proxmox-ve-config/src/sdn/microseg/mod.rs | 1394 +++++++++++++++++
proxmox-ve-config/src/sdn/microseg/state.rs | 616 ++++++++
proxmox-ve-config/src/sdn/microseg/types.rs | 549 +++++++
proxmox-ve-config/src/sdn/mod.rs | 1 +
20 files changed, 4438 insertions(+)
create mode 100644 proxmox-microseg/Cargo.toml
create mode 100644 proxmox-microseg/debian/changelog
create mode 100644 proxmox-microseg/debian/control
create mode 100644 proxmox-microseg/debian/copyright
create mode 100644 proxmox-microseg/debian/debcargo.toml
create mode 100644 proxmox-microseg/debian/source/format
create mode 100644 proxmox-microseg/src/ebpf.rs
create mode 100644 proxmox-microseg/src/lib.rs
create mode 100644 proxmox-microseg/src/nic.rs
create mode 100644 proxmox-microseg/src/running_config.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/api.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/identity.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/mod.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/state.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/types.rs
pve-cluster:
Hannes Laimer (1):
cfs: add 'sdn/microseg.cfg' to observed files
src/PVE/Cluster.pm | 1 +
src/pmxcfs/status.c | 1 +
2 files changed, 2 insertions(+)
pve-access-control:
Hannes Laimer (1):
permissions: add ACL path for SDN microsegmentation
src/PVE/AccessControl.pm | 1 +
1 file changed, 1 insertion(+)
proxmox-perl-rs:
Hannes Laimer (4):
pve-rs: sdn: add microseg config binding
pve-rs: sdn: microseg: bind the data plane
pve-rs: sdn: microseg: check the data plane limits on render
pve-rs: debian: fire the pve-microseg-update trigger on upgrade
pve-rs/Cargo.toml | 2 +
pve-rs/Makefile | 3 +
pve-rs/debian/control | 1 +
pve-rs/debian/triggers | 1 +
pve-rs/src/bindings/sdn/microseg.rs | 350 ++++++++++++++++++++++++++++
pve-rs/src/bindings/sdn/mod.rs | 1 +
6 files changed, 358 insertions(+)
create mode 100644 pve-rs/src/bindings/sdn/microseg.rs
pve-network:
Hannes Laimer (10):
sdn: zones: add vxlan-gbp option to vxlan and evpn zones
sdn: microseg: add config, API and guest inventory
sdn: dry-run: show pending microseg changes
sdn: microseg: enforce the policy on guest NICs
sdn: microseg: add tag matcher
sdn: microseg: add name regex matcher
sdn: microseg: add an update for a running NIC
sdn: microseg: expose protocol, port and macro rule options
sdn: microseg: allow nesting groups under a parent
sdn: microseg: expose the fragments rule option
debian/control | 1 +
debian/libpve-network-perl.postinst | 21 +
debian/triggers | 1 +
src/PVE/API2/Network/SDN.pm | 47 +-
src/PVE/API2/Network/SDN/Makefile | 2 +
src/PVE/API2/Network/SDN/Microseg.pm | 236 +++++++++
.../API2/Network/SDN/Microseg/Assignment.pm | 23 +
src/PVE/API2/Network/SDN/Microseg/Base.pm | 382 ++++++++++++++
src/PVE/API2/Network/SDN/Microseg/Group.pm | 17 +
src/PVE/API2/Network/SDN/Microseg/Makefile | 11 +
src/PVE/API2/Network/SDN/Microseg/Rule.pm | 22 +
src/PVE/API2/Network/SDN/Zones.pm | 8 +
src/PVE/Network/SDN.pm | 25 +
src/PVE/Network/SDN/Makefile | 1 +
src/PVE/Network/SDN/Microseg.pm | 494 ++++++++++++++++++
src/PVE/Network/SDN/Zones.pm | 32 ++
src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 8 +
src/PVE/Network/SDN/Zones/VxlanPlugin.pm | 12 +
.../zones/evpn/gbp/expected_controller_config | 77 +++
.../zones/evpn/gbp/expected_sdn_interfaces | 45 ++
src/test/zones/evpn/gbp/interfaces | 7 +
src/test/zones/evpn/gbp/sdn_config | 26 +
.../zones/vxlan/gbp/expected_sdn_interfaces | 17 +
src/test/zones/vxlan/gbp/interfaces | 7 +
src/test/zones/vxlan/gbp/sdn_config | 11 +
25 files changed, 1531 insertions(+), 2 deletions(-)
create mode 100644 src/PVE/API2/Network/SDN/Microseg.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Assignment.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Base.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Group.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Makefile
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Rule.pm
create mode 100644 src/PVE/Network/SDN/Microseg.pm
create mode 100644 src/test/zones/evpn/gbp/expected_controller_config
create mode 100644 src/test/zones/evpn/gbp/expected_sdn_interfaces
create mode 100644 src/test/zones/evpn/gbp/interfaces
create mode 100644 src/test/zones/evpn/gbp/sdn_config
create mode 100644 src/test/zones/vxlan/gbp/expected_sdn_interfaces
create mode 100644 src/test/zones/vxlan/gbp/interfaces
create mode 100644 src/test/zones/vxlan/gbp/sdn_config
pve-manager:
Hannes Laimer (11):
network: apply the microseg policy on reload
pve-sdn-commit: apply the microseg policy at boot
ui: sdn: zones: add vxlan-gbp checkbox to vxlan and evpn
ui: sdn: add microsegmentation panel
ui: sdn: dry-run: show pending microseg diff
ui: sdn: microseg: add tag matcher
ui: sdn: microseg: add name regex matcher
ui: sdn: microseg: add narrowing to the rule form
ui: sdn: microseg: show and edit the group hierarchy
ui: sdn: microseg: add fragments option to the rule form
ui: sdn: microseg: add a guest tab with its groups and rules
PVE/API2/Network.pm | 31 +-
bin/pve-sdn-commit | 47 ++-
services/pve-sdn-commit.service | 1 +
www/css/ext6-pve.css | 23 ++
www/manager6/Makefile | 10 +
www/manager6/Utils.js | 98 +++++
www/manager6/data/PermPathStore.js | 1 +
www/manager6/dc/Config.js | 8 +
www/manager6/form/SDNMicrosegGroupSelector.js | 105 ++++++
www/manager6/grid/FirewallRules.js | 2 +
www/manager6/lxc/Config.js | 10 +
www/manager6/qemu/Config.js | 10 +
www/manager6/sdn/MicrosegView.js | 98 +++++
www/manager6/sdn/SdnDiffView.js | 29 ++
www/manager6/sdn/microseg/AssignmentEdit.js | 148 ++++++++
www/manager6/sdn/microseg/AssignmentView.js | 195 ++++++++++
www/manager6/sdn/microseg/Base.js | 262 ++++++++++++++
www/manager6/sdn/microseg/GroupEdit.js | 40 +++
www/manager6/sdn/microseg/GuestPanel.js | 117 ++++++
www/manager6/sdn/microseg/RuleEdit.js | 285 +++++++++++++++
www/manager6/sdn/microseg/RuleView.js | 338 ++++++++++++++++++
www/manager6/sdn/microseg/Tree.js | 278 ++++++++++++++
www/manager6/sdn/zones/EvpnEdit.js | 8 +
www/manager6/sdn/zones/VxlanEdit.js | 11 +
24 files changed, 2126 insertions(+), 29 deletions(-)
create mode 100644 www/manager6/form/SDNMicrosegGroupSelector.js
create mode 100644 www/manager6/sdn/MicrosegView.js
create mode 100644 www/manager6/sdn/microseg/AssignmentEdit.js
create mode 100644 www/manager6/sdn/microseg/AssignmentView.js
create mode 100644 www/manager6/sdn/microseg/Base.js
create mode 100644 www/manager6/sdn/microseg/GroupEdit.js
create mode 100644 www/manager6/sdn/microseg/GuestPanel.js
create mode 100644 www/manager6/sdn/microseg/RuleEdit.js
create mode 100644 www/manager6/sdn/microseg/RuleView.js
create mode 100644 www/manager6/sdn/microseg/Tree.js
qemu-server:
Hannes Laimer (1):
network: update the microseg enforcement on a tag or name change
src/PVE/API2/Qemu.pm | 26 ++++++++++++++++++++++++++
src/PVE/QemuServer.pm | 12 +++++++++++-
src/PVE/QemuServer/Network.pm | 14 ++++++++++++++
3 files changed, 51 insertions(+), 1 deletion(-)
pve-container:
Hannes Laimer (1):
lxc: update the microseg enforcement on a tag or hostname change
src/PVE/API2/LXC/Config.pm | 3 +++
src/PVE/LXC.pm | 28 ++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
pve-docs:
Hannes Laimer (2):
sdn: zones: document the VXLAN-GBP option
sdn: add microsegmentation section
pvesdn.adoc | 403 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 403 insertions(+)
Summary over all repositories:
98 files changed, 11514 insertions(+), 38 deletions(-)
--
Generated by murpp 0.12.0
^ permalink raw reply [relevance 10%]
* Re: [PATCH access-control/cluster/docs/manager/network/proxmox{-ve-rs,-firewall,-perl-rs} v3 00/38] sdn: add microsegmentation support
2026-09-22 10:09 11% [PATCH access-control/cluster/docs/manager/network/proxmox{-ve-rs,-firewall,-perl-rs} v3 00/38] sdn: add microsegmentation support Hannes Laimer
@ 2026-09-22 10:13 8% ` Hannes Laimer
0 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-09-22 10:13 UTC (permalink / raw)
To: pve-devel
did not intend to send these, please ignore.
sorry for the noise
On 2026-09-22 12:10, Hannes Laimer wrote:
> Guests on a vnet are separated only by IP addressing and the guest
...
>
^ permalink raw reply [relevance 8%]
* [PATCH access-control/cluster/docs/manager/network/proxmox{-ve-rs,-firewall,-perl-rs} v3 00/38] sdn: add microsegmentation support
@ 2026-09-22 10:09 11% Hannes Laimer
2026-09-22 10:13 8% ` Hannes Laimer
0 siblings, 1 reply; 26+ results
From: Hannes Laimer @ 2026-09-22 10:09 UTC (permalink / raw)
To: pve-devel
Guests on a vnet are separated only by IP addressing and the guest
firewall. Its address rules have to follow every move and renumbering.
No identity crosses nodes with a frame, and tags and names carry no
policy.
This series adds a group-based policy with a datacenter panel over
/etc/pve/sdn/microseg.cfg and /cluster/sdn/microseg. A rule has a
priority and a verdict and matches a source and a destination predicate
over groups, any, all or exact. It can be narrowed to a protocol and
ports, an ICMP type or a firewall macro. Assignments bind guest
interfaces to groups by guest, tag or name regex, and a subgroup member
is in every group above it. VXLAN and EVPN zones gain a vxlan-gbp option
that carries the identity across nodes. The host stamps it where a frame
enters the bridge, so a guest cannot forge its own.
Default is deny. Rules are stateless and directional, so a reply needs
its own allow, or the rule is marked both ways, which is exactly that
pair with the ports swapped. The highest priority wins, at a tie the
more specific all and exact predicates decide, and deny wins among
equals. Identities stay stable across config changes, and a retired one
is reused only after a quarantine. A full apply swaps a node's policy in
one transaction, and a guest interface is enforced before it is bridged.
A running config a node cannot read fails every guest start there, one
it cannot parse or build fails the start of guests with assigned
interfaces, as does an interface headed for an Open vSwitch port without
a firewall bridge. One already on such a port is named in the node's
network reload task and stays unenforced until the firewall option is
set. A guest matched after the last apply stays unmanaged until the next
one.
proxmox-ve-config carries the types, the identity engine and the desired
state, the policy in a form no enforcing mechanism depends on.
pve-cluster adds the observed file, pve-access-control the ACL path.
pve-network holds the config, the API, the zone option and the plug
trigger. proxmox-microseg, a library crate in the proxmox-firewall
workspace, renders the desired state into a bridge family nftables
table, and pve-rs binds it next to the config, so Perl applies it on an
SDN apply and on a NIC plug. pve-manager adds the panel and applies on
network reload. pve-docs adds the section. Connection tracking, rule
logging, the SRv6 carrier and an eBPF plane are left out on purpose.
libpve-network-perl loads only with the pve-cluster of this series and
needs its libpve-rs-perl, or every guest start on the node fails at the
plug. It gains dependencies on nftables and libpve-guest-common-perl.
The API package needs the libpve-access-control of this series, or no
ACL can be granted on /sdn/microseg and its endpoints only see what /sdn
passes down. pve-manager builds only with the pve-docs of this series,
whose anchors its help buttons name, and at runtime needs the new
libpve-network-perl, since its network reload applies the microseg
policy through it. pve-rs builds against the proxmox-microseg crate,
which pulls in proxmox-nftables. pve-rs and the crate both need a
proxmox-ve-config with the new module, and so does the proxmox-firewall
source package that carries the crate. None of these floors is bumped
here. The ifupdown2 vxlan-gbp attribute and four proxmox-nftables
patches (building without the config extension, mark-keyed verdict
maps, shared protocol rendering, crate packaging) are sent separately.
# changelog
v3:
- data plane moved from eBPF programs to an nftables bridge-family
table, proxmox-ebpf is gone and the data plane is a library crate in
the proxmox-firewall workspace that pve-rs binds, without an agent
binary or a boot-time unit since the first plug builds the table, the
desired state it renders lives in proxmox-ve-config, and
libpve-network-perl depends on nftables
- rules can be narrowed to a protocol, ports, an ICMP type or a
firewall macro, the protocol and port rendering is shared with the
firewall
- a rule can be marked both ways, which applies it with the predicates
and the ports swapped as well, under one id, so the reply rule of a
stateless pair no longer has to be written by hand
- groups can form a hierarchy, membership in a subgroup implies the
groups above it, and for all and exact predicates specificity breaks
priority ties so a subgroup rule outranks its parent's
- a plug fails when the running config cannot be read, or cannot be
parsed or built and the NIC is assigned, or an assigned NIC would
become an Open vSwitch port with no firewall bridge, an unreachable
pmxcfs fails the plug instead of reading as an empty config, and a
realized set without an identity fails the apply instead of passing
as untagged
- the microseg endpoints check their privileges on a new /sdn/microseg
ACL path, added by a pve-access-control patch in the series
- the overview endpoint reports identity id space usage, shown in the
tree header
- the pve-cluster patch also registers the file with the version array
pmxcfs keeps for observed files
- validation rejects mark 0 for a group, `untagged` in an all or exact
destination, and `untagged` next to real groups in an all or exact
source
- an assignment naming an interface index is realized whether or not
the guest has that interface yet, and tag matcher tags are
normalized like guest tags
- the running config stores the realized assignments per group set
with per-guest interface lists, so the file stays small at scale
- the network reload warns about an assigned interface that is already
up on an Open vSwitch port without a firewall bridge, since only a
plug can refuse one
- two-column rule editor reusing the firewall's selectors, the tree
shows subgroups
- the SRv6 carrier is out of the series, it belongs with an SRv6 zone
- the ifupdown2 `vxlan-gbp` attribute and the proxmox-nftables
additions with the crate packaging are sent as standalone patches,
the zone option stays in the series and the evpn vxlan-learning fix
is folded into it
- docs updated, cover letter rewritten
v2:
- core model reworked: each interface now holds a *set* of groups
compiled into a per-NIC wire identity, replacing the single-group
parent/child tree
- rules gained explicit `src`/`dst` predicates (any/all/exact) and a
`prio`, replacing the implicit tree-distance ordering
- `untagged` is now a nameable built-in group (mark 0)
- assignments are additive: a NIC's set is the union of all that
resolve to it
- added tag-matcher and name-regex assignments
- rule and dynamic-assignment ids are now generated
- identity allocation is fresh-first with quarantined reclamation, so
churn cannot exhaust the id space
- split the SRv6 carrier support into droppable tail patches
- updated docs
- updated cover-letter
proxmox-ve-rs:
Hannes Laimer (8):
ve-config: firewall: add a constructor for sctp matches
ve-config: sdn: add microseg signature-identity engine
ve-config: sdn: add microseg config types
ve-config: sdn: microseg: add tag matcher
ve-config: sdn: microseg: add name regex matcher
ve-config: sdn: microseg: narrow rules by protocol and ports
ve-config: sdn: microseg: add group hierarchy
ve-config: sdn: microseg: add the desired state
.../src/firewall/types/rule_match.rs | 4 +
.../src/sdn/microseg/identity.rs | 625 +++
proxmox-ve-config/src/sdn/microseg/mod.rs | 3819 +++++++++++++++++
proxmox-ve-config/src/sdn/microseg/state.rs | 316 ++
proxmox-ve-config/src/sdn/mod.rs | 1 +
5 files changed, 4765 insertions(+)
create mode 100644 proxmox-ve-config/src/sdn/microseg/identity.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/mod.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/state.rs
proxmox-firewall:
Hannes Laimer (5):
nftables: build without the config extension
nftables: add support for mark-keyed verdict maps
nftables: move protocol match rendering into the lib
nftables: package the crate for debcargo
microseg: add the SDN microsegmentation data plane
.gitignore | 4 +
Cargo.toml | 4 +
Makefile | 12 +-
build.sh | 46 ++
proxmox-firewall/src/rule.rs | 166 +---
proxmox-microseg/Cargo.toml | 22 +
proxmox-microseg/debian/changelog | 6 +
proxmox-microseg/debian/control | 46 ++
proxmox-microseg/debian/copyright | 18 +
proxmox-microseg/debian/debcargo.toml | 7 +
proxmox-microseg/debian/source/format | 1 +
proxmox-microseg/src/dataplane.rs | 12 +
proxmox-microseg/src/lib.rs | 41 +
proxmox-microseg/src/nft.rs | 458 +++++++++++
proxmox-microseg/src/nic.rs | 54 ++
proxmox-microseg/src/running_config.rs | 28 +
..._tests__empty_state_removes_the_table.snap | 24 +
..._tests__full_apply_replaces_the_table.snap | 726 ++++++++++++++++++
...t__tests__nic_apply_adds_its_elements.snap | 46 ++
proxmox-nftables/Cargo.toml | 7 +-
proxmox-nftables/debian/changelog | 6 +
proxmox-nftables/debian/control | 60 ++
proxmox-nftables/debian/copyright | 18 +
proxmox-nftables/debian/debcargo.toml | 7 +
proxmox-nftables/debian/source/format | 1 +
proxmox-nftables/src/expression.rs | 3 +-
proxmox-nftables/src/lib.rs | 2 +
proxmox-nftables/src/protocol.rs | 70 ++
proxmox-nftables/src/statement.rs | 10 +
proxmox-nftables/src/types.rs | 1 +
30 files changed, 1748 insertions(+), 158 deletions(-)
create mode 100755 build.sh
create mode 100644 proxmox-microseg/Cargo.toml
create mode 100644 proxmox-microseg/debian/changelog
create mode 100644 proxmox-microseg/debian/control
create mode 100644 proxmox-microseg/debian/copyright
create mode 100644 proxmox-microseg/debian/debcargo.toml
create mode 100644 proxmox-microseg/debian/source/format
create mode 100644 proxmox-microseg/src/dataplane.rs
create mode 100644 proxmox-microseg/src/lib.rs
create mode 100644 proxmox-microseg/src/nft.rs
create mode 100644 proxmox-microseg/src/nic.rs
create mode 100644 proxmox-microseg/src/running_config.rs
create mode 100644 proxmox-microseg/src/snapshots/proxmox_microseg__nft__tests__empty_state_removes_the_table.snap
create mode 100644 proxmox-microseg/src/snapshots/proxmox_microseg__nft__tests__full_apply_replaces_the_table.snap
create mode 100644 proxmox-microseg/src/snapshots/proxmox_microseg__nft__tests__nic_apply_adds_its_elements.snap
create mode 100644 proxmox-nftables/debian/changelog
create mode 100644 proxmox-nftables/debian/control
create mode 100644 proxmox-nftables/debian/copyright
create mode 100644 proxmox-nftables/debian/debcargo.toml
create mode 100644 proxmox-nftables/debian/source/format
create mode 100644 proxmox-nftables/src/protocol.rs
pve-cluster:
Hannes Laimer (1):
cfs: add 'sdn/microseg.cfg' to observed files
src/PVE/Cluster.pm | 1 +
src/pmxcfs/status.c | 1 +
2 files changed, 2 insertions(+)
pve-access-control:
Hannes Laimer (1):
permissions: add ACL path for SDN microsegmentation
src/PVE/AccessControl.pm | 1 +
1 file changed, 1 insertion(+)
proxmox-perl-rs:
Hannes Laimer (2):
pve-rs: sdn: add microseg config binding
pve-rs: sdn: microseg: bind the data plane
pve-rs/Cargo.toml | 2 +
pve-rs/Makefile | 1 +
pve-rs/debian/control | 1 +
pve-rs/src/bindings/sdn/microseg.rs | 278 ++++++++++++++++++++++++++++
pve-rs/src/bindings/sdn/mod.rs | 1 +
5 files changed, 283 insertions(+)
create mode 100644 pve-rs/src/bindings/sdn/microseg.rs
pve-network:
Hannes Laimer (8):
sdn: zones: add vxlan-gbp option to vxlan and evpn zones
sdn: microseg: add config, API and guest inventory
sdn: dry-run: show pending microseg changes
sdn: zones: trigger microseg apply on tap_plug
sdn: microseg: add tag matcher
sdn: microseg: add name regex matcher
sdn: microseg: expose protocol, port and macro rule options
sdn: microseg: expose the group parent
debian/control | 2 +
src/PVE/API2/Network/SDN.pm | 38 +-
src/PVE/API2/Network/SDN/Makefile | 2 +
src/PVE/API2/Network/SDN/Microseg.pm | 277 +++++++
.../API2/Network/SDN/Microseg/Assignment.pm | 192 +++++
src/PVE/API2/Network/SDN/Microseg/Group.pm | 191 +++++
src/PVE/API2/Network/SDN/Microseg/Makefile | 10 +
src/PVE/API2/Network/SDN/Microseg/Rule.pm | 194 +++++
src/PVE/API2/Network/SDN/Zones.pm | 8 +
src/PVE/Network/SDN.pm | 36 +
src/PVE/Network/SDN/Makefile | 1 +
src/PVE/Network/SDN/Microseg.pm | 774 ++++++++++++++++++
src/PVE/Network/SDN/Zones.pm | 5 +
src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 5 +
src/PVE/Network/SDN/Zones/VxlanPlugin.pm | 10 +
.../zones/evpn/gbp/expected_controller_config | 77 ++
.../zones/evpn/gbp/expected_sdn_interfaces | 45 +
src/test/zones/evpn/gbp/interfaces | 7 +
src/test/zones/evpn/gbp/sdn_config | 26 +
.../zones/vxlan/gbp/expected_sdn_interfaces | 16 +
src/test/zones/vxlan/gbp/interfaces | 7 +
src/test/zones/vxlan/gbp/sdn_config | 11 +
22 files changed, 1932 insertions(+), 2 deletions(-)
create mode 100644 src/PVE/API2/Network/SDN/Microseg.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Assignment.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Group.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Makefile
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Rule.pm
create mode 100644 src/PVE/Network/SDN/Microseg.pm
create mode 100644 src/test/zones/evpn/gbp/expected_controller_config
create mode 100644 src/test/zones/evpn/gbp/expected_sdn_interfaces
create mode 100644 src/test/zones/evpn/gbp/interfaces
create mode 100644 src/test/zones/evpn/gbp/sdn_config
create mode 100644 src/test/zones/vxlan/gbp/expected_sdn_interfaces
create mode 100644 src/test/zones/vxlan/gbp/interfaces
create mode 100644 src/test/zones/vxlan/gbp/sdn_config
pve-manager:
Hannes Laimer (9):
network: apply microseg state on reload
ui: firewall: register the ICMP type stores by id
ui: sdn: zones: add vxlan-gbp checkbox to vxlan and evpn
ui: sdn: add microsegmentation panel
ui: sdn: dry-run: show pending microseg diff
ui: sdn: microseg: add tag matcher
ui: sdn: microseg: add name regex matcher
ui: sdn: microseg: add narrowing to the rule form
ui: sdn: microseg: show and edit the group hierarchy
PVE/API2/Network.pm | 4 +
www/css/ext6-pve.css | 8 +
www/manager6/Makefile | 8 +
www/manager6/Utils.js | 34 ++
www/manager6/data/PermPathStore.js | 1 +
www/manager6/dc/Config.js | 8 +
www/manager6/form/MicrosegGroupSelector.js | 95 ++++
www/manager6/grid/FirewallRules.js | 2 +
www/manager6/sdn/MicrosegView.js | 43 ++
www/manager6/sdn/SdnDiffView.js | 24 +
www/manager6/sdn/microseg/AssignmentEdit.js | 238 ++++++++++
www/manager6/sdn/microseg/Base.js | 123 ++++++
www/manager6/sdn/microseg/GroupEdit.js | 47 ++
www/manager6/sdn/microseg/PolicyView.js | 401 +++++++++++++++++
www/manager6/sdn/microseg/RuleEdit.js | 285 ++++++++++++
www/manager6/sdn/microseg/Tree.js | 460 ++++++++++++++++++++
www/manager6/sdn/zones/EvpnEdit.js | 8 +
www/manager6/sdn/zones/VxlanEdit.js | 11 +
18 files changed, 1800 insertions(+)
create mode 100644 www/manager6/form/MicrosegGroupSelector.js
create mode 100644 www/manager6/sdn/MicrosegView.js
create mode 100644 www/manager6/sdn/microseg/AssignmentEdit.js
create mode 100644 www/manager6/sdn/microseg/Base.js
create mode 100644 www/manager6/sdn/microseg/GroupEdit.js
create mode 100644 www/manager6/sdn/microseg/PolicyView.js
create mode 100644 www/manager6/sdn/microseg/RuleEdit.js
create mode 100644 www/manager6/sdn/microseg/Tree.js
pve-docs:
Hannes Laimer (4):
sdn: add VXLAN-GBP flag to evpn/vxlan zone sections
sdn: add microsegmentation section
sdn: microseg: document narrowed rules
sdn: microseg: document group hierarchy and the specificity tie-break
pvesdn.adoc | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 264 insertions(+)
Summary over all repositories:
84 files changed, 10795 insertions(+), 160 deletions(-)
--
Generated by murpp 0.12.0
^ permalink raw reply [relevance 11%]
* Re: [RFC] VMware/NSX to Proxmox migration: policy transformation and staged network handoff
2026-09-02 11:29 8% ` Stefan Hanreich
@ 2026-09-03 12:31 9% ` LIONNETON Vincent
0 siblings, 0 replies; 26+ results
From: LIONNETON Vincent @ 2026-09-03 12:31 UTC (permalink / raw)
To: Stefan Hanreich, pve-devel@lists.proxmox.com; +Cc: pdm-devel@lists.proxmox.com
Hello,
Thank you again for the detailed response. It confirms that the most appropriate boundary would be to keep VMware/NSX-specific discovery and migration logic in an external tool, while relying on native PVE/PDM capabilities for the resulting networking and security configuration.
After reviewing the ongoing microsegmentation and VRF work, I think it would be premature for us to implement the Proxmox target side of the migration tool against the current SDN and firewall models.
Both areas are still evolving significantly, and we would prefer to wait until the relevant data models and APIs are closer to their intended released form rather than building against the current implementation and having to redesign the integration shortly afterwards.
In the meantime, we will continue documenting the NSX migration requirements and concrete policy examples, particularly around:
* dynamic group membership based on multiple VM tags;
* stateful and service-specific Layer 3/Layer 4 rules;
* workloads external to the PVE identity domain during mixed NSX/PVE coexistence;
* atomic staging and validation of large policy changes;
* same-address workload migration and subsequent gateway handoff.
Once the relevant functionality is available through the supported PVE/PDM APIs, we can then build the migration layer against the native target model rather than an intermediate implementation.
Thank you as well for confirming that NSX object migration is not currently planned as part of the importer. This gives us a clear and complementary scope to revisit once the target SDN and security interfaces have stabilized.
Best regards,
Vincent Lionneton
________________________________
From: Stefan Hanreich <s.hanreich@proxmox.com>
Sent: Wednesday, September 2, 2026 1:29 PM
To: LIONNETON Vincent <vincent.lionneton@sword-group.com>; pve-devel@lists.proxmox.com <pve-devel@lists.proxmox.com>
Cc: pdm-devel@lists.proxmox.com <pdm-devel@lists.proxmox.com>
Subject: Re: [RFC] VMware/NSX to Proxmox migration: policy transformation and staged network handoff
[You don't often get email from s.hanreich@proxmox.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Thanks for your inquiry, I tried to keep the answers relatively short without
diving too much into technical details.
On 8/31/26 9:11 AM, LIONNETON Vincent wrote:
[snip]
> Before going further, particularly with same-address coexistence and network handoff, I would appreciate Proxmox's guidance on the following points:
>
>
> 1. Is NSX-aware migration already planned or being worked on within Proxmox, publicly or internally?
>
> In particular, are there plans around NSX DFW/security-policy migration, NSX network preservation, or staged migration from NSX networking to PVE SDN?
There are currently no plans for extending the importer functionality to migrating NSX
objects / entities, so efforts on developing something like that would be welcome.
> 2. Do you see this functionality primarily as an external migration/transformation tool using PVE/PDM APIs, or do some of these functions belong in PVE or PDM themselves?
>
> We explicitly do not want to develop a competing permanent SDN/firewall control plane if PDM is intended to provide that functionality.
Optimally, the functionality is implemented natively in PVE / PDM and then only managed
by the external tool. For your purposes, the most interesting things that are still in
development are VRF support and microsegmentation, which both have a RFC on the mailing
list. Looking at those should give you a good glimpse into our development workflow and
the current codebase.
> 3. For an external migration tool, what would you consider the preferred and sufficiently stable API integration points?
>
> In particular for VM migration, SDN/VNet provisioning, EVPN/BGP configuration, Security Groups/IP sets, guest/VNet firewall policies and multi-cluster orchestration through PDM.
The whole REST API, as described in the documentation [1], is considered to be stable and
does not introduce breaking changes during a major version. Our policy on what we deem a
breaking API change and how we treat evolving the API can be found in our Wiki [2].
> 4. Would effective NSX-policy translation and policy-parity validation be useful functionality from Proxmox's perspective?
>
> For example, resolving dynamic NSX group memberships and the effective DFW policy for a VM, compiling that intent into native PVE firewall objects, and comparing the resulting effective policy before cutover.
For that particular purpose, the ongoing work on microsegmentation is likely of
interest to you [3] as that should provide the functionality required. As it's in
a stage of development, feel free to chime in and test the functionality - we always
value feedback and in this early stage it's a good opportunity for you to check out
the implementation to see if it fits the use-case.
> 5. Does the proposed same-address migration model fit the intended PVE SDN architecture?
>
> The idea is to temporarily extend the existing NSX L2 network to PVE, migrate the workloads while keeping IP/gateway addressing unchanged, and only later hand the gateway/routing function over from NSX to PVE EVPN/BGP on a network-by-network basis.
That should work generally and I know of some customers that have done a similar setup, but
I personally have zero practical experience with this - so it's hard for me to talk about
details. Since standard routing protocols are involved the integration should work, but I
can imagine needing something like a translation layer, i.e. when using a route reflector
for both PVE / NSX-T the routes might need to get transformed by the reflector to match what
the respective stacks expect. Potentially even a router in front of the PVE cluster, that
handles NSX-T / Proxmox VE specifics during the migration. With the recently introduced
route maps feature, this might be possible on the PVE side via the SDN stack solely.
There's very likely a few pitfalls that'd need to be worked out. Ir's very likely that some
setups are currently impossible to model with the SDN stack alone and an external router or
custom FRR configuration is needed - although we're working hard on addressing those
deficiencies. I'd start with attempting to migrate relatively simple setups (e.g.
single-tenant) and see how everything works out for simpler setups.
> 6. Is low-downtime/incremental VMware migration already in scope for the existing importer?
>
> We are particularly interested in whether a VDDK/CBT-style precopy/delta mechanism, or another warm-migration mechanism from ESXi, is already planned.
There has been some work done internally on improving the importer by utilizing NFC/CBT,
but it still needs a bit of work to drag it over the finish line, I cannot provide
an ETA at this point.
> 7. Are there generic PVE/PDM capabilities that would be useful to implement upstream for this use case?
>
> Possible examples are effective-firewall-policy inspection, policy diff/validation, dry-run APIs, structured external-migration prechecks, or bulk firewall/IP-set operations.
Yes, I would see all of those capabilities as something that should be provided by
the Proxmox VE API and then consumed by your tool. The firewall currently does not
support staging changes, as the configuration is applied continously by the firewall
daemon. SDN itself already has a dry-run API that has been recently introduced [4]
and the related endpoints all support querying the current / pending configuration
via the pending / running GET parameters.
I'm currently working on improving firewall configuration handling together with
a colleague, but the general mechanism stay the same. For the use-cases you mentioned
that would require implementing some sort of staging mechanism for firewall changes.
I'm not sure what you mean with bulk firewall / IP-set operations exactly?
> 8. If some of these pieces would be appropriate upstream, where would you prefer them to live and what development interfaces/conventions should we target?
>
> For example PVE vs PDM, the appropriate repositories and APIs, Rust vs existing PVE components, expected test coverage and contribution workflow.
Development of Proxmox VE (and other products) happens out here in the open on the
respective mailing lists. We have a short introductory guide to our workflow in the
Wiki [5]. Discussion of specific features usually happens in our bug tracking
instance [6], rather than here on the mailing list directly.
For the SDN stack in particular, new features are implemented in Rust and only
exposed via our perlmod module, which allows calling into Rust code. The new
firewall daemon is implemented in Rust as well, but the API still lives on the
Perl side. That might change in the future though, as we plan on implementing
more and more new features in Rust while also porting existing functionality
over where it makes sense. In the short to mid-term we also want to work on
eliminating the need for Perl to act as a middle man for Rust.
> intention would be to keep all VMware/NSX-specific discovery and transformation logic in the migration tooling, while contributing only genuinely generic Proxmox capabilities upstream if that is of interest.
That would be the preferred way, in my opinion.
> Once the migration is complete, the resulting environment should consist solely of native PVE/PDM SDN and firewall configuration and should not depend on the migration tool for normal operation.
Yes, I think there are two phases to this? First, the network topology / structure
would need to get set up on PVE (and hooked up with its NSX-T counterparts) - then
the migration of the VMs and their network configuration, which maps the guest
configuration from VMWare onto the SDN entities. The tool would need to maintain
some form of mapping in that case / or it'd need to be stored in the SDN stack
directly - so the tool can consume that (which is preferable imo).
> I would be happy to share a more detailed architecture or the results of the current proof of concept if useful.
Yes, I'd be interested in that!
[1] https://pve.proxmox.com/pve-docs/api-viewer/
[2] https://pve.proxmox.com/wiki/Proxmox_VE_API#API_Stability_&_Breakage
[3] https://lore.proxmox.com/all/DKRAX8JGPAP2.19JLE3T7U6DS1@proxmox.com/
[4] https://pve.proxmox.com/pve-docs/api-viewer/#/cluster/sdn/dry-run
[5] https://pve.proxmox.com/wiki/Developer_Documentation
[6] https://bugzilla.proxmox.com/
^ permalink raw reply [relevance 9%]
* Re: [RFC] VMware/NSX to Proxmox migration: policy transformation and staged network handoff
@ 2026-09-02 11:29 8% ` Stefan Hanreich
2026-09-03 12:31 9% ` LIONNETON Vincent
0 siblings, 1 reply; 26+ results
From: Stefan Hanreich @ 2026-09-02 11:29 UTC (permalink / raw)
To: LIONNETON Vincent, pve-devel@lists.proxmox.com
Cc: pdm-devel@lists.proxmox.com
Thanks for your inquiry, I tried to keep the answers relatively short without
diving too much into technical details.
On 8/31/26 9:11 AM, LIONNETON Vincent wrote:
[snip]
> Before going further, particularly with same-address coexistence and network handoff, I would appreciate Proxmox's guidance on the following points:
>
>
> 1. Is NSX-aware migration already planned or being worked on within Proxmox, publicly or internally?
>
> In particular, are there plans around NSX DFW/security-policy migration, NSX network preservation, or staged migration from NSX networking to PVE SDN?
There are currently no plans for extending the importer functionality to migrating NSX
objects / entities, so efforts on developing something like that would be welcome.
> 2. Do you see this functionality primarily as an external migration/transformation tool using PVE/PDM APIs, or do some of these functions belong in PVE or PDM themselves?
>
> We explicitly do not want to develop a competing permanent SDN/firewall control plane if PDM is intended to provide that functionality.
Optimally, the functionality is implemented natively in PVE / PDM and then only managed
by the external tool. For your purposes, the most interesting things that are still in
development are VRF support and microsegmentation, which both have a RFC on the mailing
list. Looking at those should give you a good glimpse into our development workflow and
the current codebase.
> 3. For an external migration tool, what would you consider the preferred and sufficiently stable API integration points?
>
> In particular for VM migration, SDN/VNet provisioning, EVPN/BGP configuration, Security Groups/IP sets, guest/VNet firewall policies and multi-cluster orchestration through PDM.
The whole REST API, as described in the documentation [1], is considered to be stable and
does not introduce breaking changes during a major version. Our policy on what we deem a
breaking API change and how we treat evolving the API can be found in our Wiki [2].
> 4. Would effective NSX-policy translation and policy-parity validation be useful functionality from Proxmox's perspective?
>
> For example, resolving dynamic NSX group memberships and the effective DFW policy for a VM, compiling that intent into native PVE firewall objects, and comparing the resulting effective policy before cutover.
For that particular purpose, the ongoing work on microsegmentation is likely of
interest to you [3] as that should provide the functionality required. As it's in
a stage of development, feel free to chime in and test the functionality - we always
value feedback and in this early stage it's a good opportunity for you to check out
the implementation to see if it fits the use-case.
> 5. Does the proposed same-address migration model fit the intended PVE SDN architecture?
>
> The idea is to temporarily extend the existing NSX L2 network to PVE, migrate the workloads while keeping IP/gateway addressing unchanged, and only later hand the gateway/routing function over from NSX to PVE EVPN/BGP on a network-by-network basis.
That should work generally and I know of some customers that have done a similar setup, but
I personally have zero practical experience with this - so it's hard for me to talk about
details. Since standard routing protocols are involved the integration should work, but I
can imagine needing something like a translation layer, i.e. when using a route reflector
for both PVE / NSX-T the routes might need to get transformed by the reflector to match what
the respective stacks expect. Potentially even a router in front of the PVE cluster, that
handles NSX-T / Proxmox VE specifics during the migration. With the recently introduced
route maps feature, this might be possible on the PVE side via the SDN stack solely.
There's very likely a few pitfalls that'd need to be worked out. Ir's very likely that some
setups are currently impossible to model with the SDN stack alone and an external router or
custom FRR configuration is needed - although we're working hard on addressing those
deficiencies. I'd start with attempting to migrate relatively simple setups (e.g.
single-tenant) and see how everything works out for simpler setups.
> 6. Is low-downtime/incremental VMware migration already in scope for the existing importer?
>
> We are particularly interested in whether a VDDK/CBT-style precopy/delta mechanism, or another warm-migration mechanism from ESXi, is already planned.
There has been some work done internally on improving the importer by utilizing NFC/CBT,
but it still needs a bit of work to drag it over the finish line, I cannot provide
an ETA at this point.
> 7. Are there generic PVE/PDM capabilities that would be useful to implement upstream for this use case?
>
> Possible examples are effective-firewall-policy inspection, policy diff/validation, dry-run APIs, structured external-migration prechecks, or bulk firewall/IP-set operations.
Yes, I would see all of those capabilities as something that should be provided by
the Proxmox VE API and then consumed by your tool. The firewall currently does not
support staging changes, as the configuration is applied continously by the firewall
daemon. SDN itself already has a dry-run API that has been recently introduced [4]
and the related endpoints all support querying the current / pending configuration
via the pending / running GET parameters.
I'm currently working on improving firewall configuration handling together with
a colleague, but the general mechanism stay the same. For the use-cases you mentioned
that would require implementing some sort of staging mechanism for firewall changes.
I'm not sure what you mean with bulk firewall / IP-set operations exactly?
> 8. If some of these pieces would be appropriate upstream, where would you prefer them to live and what development interfaces/conventions should we target?
>
> For example PVE vs PDM, the appropriate repositories and APIs, Rust vs existing PVE components, expected test coverage and contribution workflow.
Development of Proxmox VE (and other products) happens out here in the open on the
respective mailing lists. We have a short introductory guide to our workflow in the
Wiki [5]. Discussion of specific features usually happens in our bug tracking
instance [6], rather than here on the mailing list directly.
For the SDN stack in particular, new features are implemented in Rust and only
exposed via our perlmod module, which allows calling into Rust code. The new
firewall daemon is implemented in Rust as well, but the API still lives on the
Perl side. That might change in the future though, as we plan on implementing
more and more new features in Rust while also porting existing functionality
over where it makes sense. In the short to mid-term we also want to work on
eliminating the need for Perl to act as a middle man for Rust.
> intention would be to keep all VMware/NSX-specific discovery and transformation logic in the migration tooling, while contributing only genuinely generic Proxmox capabilities upstream if that is of interest.
That would be the preferred way, in my opinion.
> Once the migration is complete, the resulting environment should consist solely of native PVE/PDM SDN and firewall configuration and should not depend on the migration tool for normal operation.
Yes, I think there are two phases to this? First, the network topology / structure
would need to get set up on PVE (and hooked up with its NSX-T counterparts) - then
the migration of the VMs and their network configuration, which maps the guest
configuration from VMWare onto the SDN entities. The tool would need to maintain
some form of mapping in that case / or it'd need to be stored in the SDN stack
directly - so the tool can consume that (which is preferable imo).
> I would be happy to share a more detailed architecture or the results of the current proof of concept if useful.
Yes, I'd be interested in that!
[1] https://pve.proxmox.com/pve-docs/api-viewer/
[2] https://pve.proxmox.com/wiki/Proxmox_VE_API#API_Stability_&_Breakage
[3] https://lore.proxmox.com/all/DKRAX8JGPAP2.19JLE3T7U6DS1@proxmox.com/
[4] https://pve.proxmox.com/pve-docs/api-viewer/#/cluster/sdn/dry-run
[5] https://pve.proxmox.com/wiki/Developer_Documentation
[6] https://bugzilla.proxmox.com/
^ permalink raw reply [relevance 8%]
* Re: SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] sdn: add microsegmentation support
2026-08-17 11:17 10% ` Lukas Sichert
@ 2026-08-17 14:50 8% ` Lukas Sichert
0 siblings, 0 replies; 26+ results
From: Lukas Sichert @ 2026-08-17 14:50 UTC (permalink / raw)
To: Lukas Sichert, Hannes Laimer, pve-devel
On 2026-08-17 13:17, Lukas Sichert <l.sichert@proxmox.com> wrote:
> On 2026-07-09 11:18, Hannes Laimer <h.laimer@proxmox.com> wrote:
>
>> This adds support for microsegmentation using eBPF programs attached to
>> interfaces. Mostly the tap/veth interfaces on the guests directly.
>>
>
> Overall, the microsegmentation setup worked for both VMs and containers
> across the three-node EVPN cluster.
>
On 2026-08-17 13:17, Lukas Sichert <l.sichert@proxmox.com> wrote:
> On 2026-07-09 11:18, Hannes Laimer <h.laimer@proxmox.com> wrote:
>
>> This adds support for microsegmentation using eBPF programs attached to
>> interfaces. Mostly the tap/veth interfaces on the guests directly.
>>
>
> Overall, the microsegmentation setup worked for both VMs and containers
> across the three-node EVPN cluster.
>
One thing I forgot to add in my last mail:
Hannes mentioned concerns that the 16-bit identity field used to carry
the eBPF-assigned identity might be too small.
A minimal theoretical exhaustion scenario requires 16 independently
distinguishable groups, 8 rules, and 65,536 NICs. Each rule can
distinguish group membership in both its source and destination
predicate. For example:
allow g1 -> g2
allow g3 -> g4
...
allow g15 -> g16
A NIC can belong to any subset of these groups, such as {g1}, {g1, g3},
or {g2, g5, g8}. With the predicates above, every subset produces a
different rule-matching signature and therefore forms a separate
policy-equivalence class.
With 16 groups, there are:
2^16 = 65,536
possible subsets.
Only equivalence classes actually realized by NICs receive identities.
Identity 0 is reserved for genuinely untagged traffic, leaving 65,535
identities for managed equivalence classes. Therefore, up to 65,535
NICs can always be assigned, even if every NIC has different policy
behavior. Configurations with more NICs remain possible as long as some
NICs share an equivalence class.
In practice, reaching the limit would require an automatically
generated configuration containing at least 65,536 distinct policy
behaviors. Real environments generally contain many NICs with
identical behavior and therefore sharing an identity. It seems highly
unlikely that the 16-bit limit will become a practical problem.
^ permalink raw reply [relevance 8%]
* Re: SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] sdn: add microsegmentation support
2026-07-09 9:18 10% SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] " Hannes Laimer
` (2 preceding siblings ...)
2026-08-12 10:33 10% ` SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] sdn: add microsegmentation support Lukas Sichert
@ 2026-08-17 11:17 10% ` Lukas Sichert
2026-08-17 14:50 8% ` Lukas Sichert
2026-10-27 8:57 8% ` superseded: " Hannes Laimer
4 siblings, 1 reply; 26+ results
From: Lukas Sichert @ 2026-08-17 11:17 UTC (permalink / raw)
To: Hannes Laimer, pve-devel
On 2026-07-09 11:18, Hannes Laimer <h.laimer@proxmox.com> wrote:
> This adds support for microsegmentation using eBPF programs attached to
> interfaces. Mostly the tap/veth interfaces on the guests directly.
>
Overall, the microsegmentation setup worked for both VMs and containers
across the three-node EVPN cluster.
What worked:
- Group assignments were applied to QEMU VM TAP interfaces and LXC container veth interfaces.
- Allowed traffic paths worked across nodes:
│ - web <-> app
│ - app <-> db
│ - managed guests <-> gateway/untagged
- Default-denied paths, such as web <-> db, were blocked.
- VM-to-CT and CT-to-VM policy enforcement worked.
- Migration between cluster nodes preserved the expected policy.
- VXLAN-GBP carried the source identity across hosts after the VXLAN
devices were recreated with gbp.
- A normal SDN reload preserved the VXLAN gbp flag.
- A second SDN apply correctly realized a NIC that had been added after
the previous render.
A bigger design change I have also already talked with Hannes about already:
In my opinion the any/all/exact architecture is superior to the
hierachical structure from v1. Still, I think hierarchy has some useful
properties. In particular, it allows the group structure to resemble the
internal structure of an organization.
In an example:
Lets say we have
testing
└── database
production
└── database
A testing database usually requires very different rules from a
production database. It may need to communicate with untagged developer
machines, test services, and debugging tools. A production database
should typically communicate only with production application servers
and explicitly approved external services.
A hierarchy makes both systems’ database role visible while clearly
separating their inherited testing and production policies.
The question remains how this can be best integrated into the
any/all/exact architecture.
The most promising way we are currently exploring is deplicating the
policies for the subgroups.
For ALL and EXACT policies, a policy is duplicated with the parent group
replaced by the subgroup. For ANY policies, only occurrences of the
parent group in the ANY part are expanded.
For any duplicated rule the priority gets increased by 0.01.
To not directly creating conflicts it is also important that longer
matching rules get proritized when compared against other policies with
the conflicting rules.
For every group in the all set the priority gets increased by 0.1.
ANY sets get increase by 0.1.
This means if one has
ALL(a,u,v) -> ALL(s,t) allow priority=5
ANY(a,x,y) -> All(r) allow priority=4
and the subgroup a/b
He would get the rules:
ALL(a,u,v) -> ALL(s,t) allow priority=5.5
ALL(a/b,u,v) -> ALL(s,t) allow priority=5.51
ANY(a,x,y) -> All(r) allow priority=4.1
ANY(a/b) -> All(r) allow priority=4.11
This would allow hierarchical groups while retaining the ANY/ALL/EXACT
matching model. It also seems more intuitive than computing
intersections and denying everything outside the intersection.
The problem is, that this can also create confusing behaviour:
Consider
ALL(v,u) -> ALL(s) deny priority=5
All(a,o) -> ALL(x) allow prioriy=5
and subgroup a/b, this would result in:
ALL(v,u) -> ALL(s) deny priority=5.3
All(a,o) -> ALL(x) allow prioriy=5.3
All(a/b,o) -> ALL(x) allow prioriy=5.31
This means a vm with set {a,v,u,o} can't send to a vm with set {s,x},
because allow and deny rules both match equally and we conservatively
then do not allow sending.
But for a vm with set {a/b,v,u,o} it is possible, because the rule with
priority 5.31 overrules the deny rule. This means that the policies for a
and a/b differ even though no additional policies are set.
I don't know if this added complexity is a valid tradeoff for the
additional configurability.
Some other things that could be adjusted in the next version:
1. stale bpf entries after interface
Stopping and restarting a container changed its veth ifindex, but BPF
links and tap_to_group entries for the old ifindex remained pinned.
This is visible with:
root@pve1-cluster:~# cat /sys/class/net/veth300i0/ifindex
52
root@pve1-cluster:~# ls -1 /sys/fs/bpf/proxmox-ebpf/policy/links
52-egress
52-ingress
root@pve1-cluster:~# pct stop 300
│ pct start 300
│ sleep 2
│ cat /sys/class/net/veth300i0/ifindex
53
root@pve1-cluster:~# ls -1 /sys/fs/bpf/proxmox-ebpf/policy/links
52-egress
52-ingress
53-egress
53-ingress
The commands here are exact, the output is shortend for better
readability.
2. Missing assignments fail open as untagged
In a normal workflow, adding a NIC after the SDN render left it absent
from realized. The agent TREATED IT AS UNASSIGNED AND ATTACHED NO BPF
PROGRAMS. THE INTERFACE DOES NOT STAMP A MANAGED- Source identity. Its
packets retain mark 0 and are treated as untagged. This means pings were
possible until a SDN reload.
I think this is because in proxmox-ebpf/src/state.rs the wire id is
called with
let wire_id = registry
.id_of(&set, &policies)
.unwrap_or(microseg::identity::UNTAGGED_ID);
and the documentation of id_of states:
Returns `None` only for a set no current class carries..., but as the
nic is created after the ids are set, the id of the set, the nic belongs
to is UNTAGGED_ID.
3. CTs are also named VMx
When adding an assignment for an container, one can only selects the
CT/VM via --vmid 300. This then creates vm300 in the GUI and entries
with "id" : "vm300i1" even though in the cluster/resources it is listed
as "vmid": 300, "type": "lxc". I think it would be nice to rename
containers into ct300.
4. Gui resets when reloading
When adding an assignment in the Gui, the Policy Window resets and jumps back to
the All Policies page. This is even more annoying, because the menu selection
stays at the selected group, so one has to click on a different group
and the on the group that was selected before.
^ permalink raw reply [relevance 10%]
* Re: SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] sdn: add microsegmentation support
2026-07-09 9:18 10% SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] " Hannes Laimer
2026-07-09 9:18 9% ` [PATCH proxmox-ebpf v2 08/27] debian: add packaging and boot-time oneshot unit Hannes Laimer
2026-07-09 9:18 12% ` [PATCH pve-docs v2 26/27] sdn: add microsegmentation section Hannes Laimer
@ 2026-08-12 10:33 10% ` Lukas Sichert
2026-08-17 11:17 10% ` Lukas Sichert
2026-10-27 8:57 8% ` superseded: " Hannes Laimer
4 siblings, 0 replies; 26+ results
From: Lukas Sichert @ 2026-08-12 10:33 UTC (permalink / raw)
To: Hannes Laimer, pve-devel
On 2026-07-09 11:18, Hannes Laimer <h.laimer@proxmox.com> wrote:
> This adds support for microsegmentation using eBPF programs attached to
> interfaces. Mostly the tap/veth interfaces on the guests directly.
>
> # testing
> I have put pre-built packages on sani, these include ifupdown2 with the patch
>
> # building
> 1. proxmox-ve-rs (install)
> 2. proxmox-ebpf
> 3. pve-cluster (install)
> 4. proxmox-perl-rs (install)
> 5. pve-network
> 6. pve-manager
I think one needs to install the patched pve-docs generator to be able to
build pve-manager because otherwise this fails with
undefined blockid 'pvesdn_config_microseg' (sdn/MicrosegView.js, line 109)
make[4]: *** [Makefile:416: OnlineHelpInfo.js] Error 25
After installing the debs from the patched pve-docs it built without an
error.
^ permalink raw reply [relevance 10%]
* superseded: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs} 00/16] sdn: add microsegmentation support
2026-06-09 13:25 12% [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs} 00/16] sdn: add microsegmentation support Hannes Laimer
2026-06-09 13:25 9% ` [PATCH proxmox-ebpf 03/16] debian: add packaging and boot-time oneshot unit Hannes Laimer
2026-06-18 13:10 9% ` [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs} 00/16] sdn: add microsegmentation support Lukas Sichert
@ 2026-07-09 9:20 8% ` Hannes Laimer
2 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-07-09 9:20 UTC (permalink / raw)
To: pve-devel
superseded-by:
https://lore.proxmox.com/pve-devel/20260709091852.538885-1-h.laimer@proxmox.com/T/#m0cbbbfddbde18a12ffa26a5ae2ac0a1450ea0749
On 2026-06-09 15:25, Hannes Laimer wrote:
> This adds support for microsegmentation using eBPF programs attached to
> interfaces. Mostly the tap/veth interfaces on the guests directly.
>
> # Overview
> Each guest interface can be assigned a group, then, on these groups it is
> possible to define policies/rules between these groups. A policy is a mapping
> `(src,dst) -> allow`
> Each interface can be assigned to only a *single* group. Groups however can be
> part of groups, that should cover most use cases I came up with. In case multiple
> policies would match (possibly because groups/sub-groups could have policies that overlap)
> the most specific policy wins: the one that names the destination group closest in
> the tree, and if two name it equally closely, the one that names the source closest, so:
>
> - web (db,web)->allow
> - wiki # from `web`: (db,web)->allow
> * CT100,net0
> - wol (db,wol)->deny # closer than the (db,web)->allow inherited from web, so deny wins
> * CT101,net0 # => packets from db to CT101,net0 are denied
>
> - db (web,db)->allow
> * CT200,net1 # packets from `web` reaching CT200,net1 will be allowed
>
> Because each group has a single parent, the destination-then-source ordering always
> picks exactly one rule, so there is no tie to resolve (a malformed config with
> duplicate rules falls back to deny).
>
> If an interface has a group assigned, it needs an explicit (0,dst) rule to
> accept un-tagged packets.
>
> Enforcement happens on the receiving side, cause that's where we for sure know both
> - where the packet is from
> - and, its destination (us)
>
> # config and API
> The config is a single section-config, `sdn/microseg.cfg`, owned by Rust (the types
> live in `proxmox-ve-config`, with a `PVE::RS::SDN::Microseg` binding) the same way the
> fabric config is. It holds four object types, keyed by section id:
> - group, a numeric `mark` (auto-assigned if omitted) and an optional `parent`
> - rule, `(src,dst) -> allow`, an absent `src` matches un-tagged traffic
> - assignment, binds a guest NIC (`vmid` plus `iface` index) to a group
> - bridge, marks a bridge-facing interface as an SRv6 carrier (no UI yet)
> The API exposes per-type endpoints under
> `/cluster/sdn/microseg/{group,rule,assignment,bridge}`, guarded by SDN.Audit for reads
> and SDN.Allocate for writes. Rule and assignment ids are derived from their contents
> (`p{src_mark}-{dst_mark}`, `vm{vmid}i{iface}`), groups and bridges take a chosen id. On
> commit the config is rendered into `.running-config`, which is what the agent reads.
>
> # skb->mark
> Every packet in the kernel lives in a `sk_buff` struct, this struct has a
> 32-bit field `mark`. This field can be written to and read while the packet
> passes through the kernel. We don't do that currently in our SDN stack, so
> currently we can't really overwrite stuff written by a different part of our
> stack. But this is something to keep in mind in case we should end up using
> this again in the future. For now microsegmentation only uses the lower 16 bits.
> We use this to assign packets to groups, with these 16 bits we support up to
> 65535 distinct groups (mark 0 is reserved for unstamped traffic). This `mark`
> however only lives as long as the packet does not leave the kernel, and given
> the nature of networking, chances are it'll leave it eventually. To transport
> this group identity between hosts we have to attach it to the actual network
> packet that hits the wire. For this we currently support both
> - VXLAN-GBP, the 16-bit GBP field on the VXLAN encapsulation
> - and, SRv6, the 16-bit Tag field on the SRH
> conveniently the kernel already handles putting the `mark` into the VXLAN-GBP
> encapsulation, and also taking it out of there (found out way too late :P). For
> SRv6 we need a small eBPF program that handles this.
>
> # eBPF
> Both tagging (setting `mark`) and enforcement happen in an eBPF program
> directly attached to the guest's interface. The programs themselves read and
> write to/from two maps:
> - tap_to_group, so we know what to set `mark` to
> - rules, map of (src,dst)->action, we know src from the `mark` and `dst` is
> the group we are in
>
> Specifically, on ingress we set the mark, and on egress we enforce.
>
> # Implementation
>
> We have an `agent` that reads the running sdn config, and applies that state to
> the kernel. The binary doing this is stateless, it runs on SDN apply, tap_plug
> of interfaces of guests and on boot after pve-sdn-commit but before guests
> start. It keeps track of what is currently running loaded in the kernel with
> two files under `/run/proxmox-ebpf`. One keeping track of the bpf program that
> was compiled into the binary, and one for keeping track of changes to the
> data structures the bpf program accesses. The distinction is useful cause for
> only a program change we can swap the currently attached program with the
> updated one atomically. In case the data structure (the maps) changed there is
> no other way than to tear-down all the current state and repopulate the maps
> and re-attach the programs. Swapping out the maps first would have old programs
> interact with a new data schema, and swapping the programs first will lead
> to new programs accessing an old data schema. Either way, not good, so we wipe
> the state in that case and re-build it. So, in case we change the structure of
> the data our bpf programs access, there will be a bunch of ms where the
> configured segmentation is not enforced. But that is the only scenario where
> that can happen.
>
> ## aya, aya-ebpf
> Aya is a rust lib that helps with working with BPF more easily. It has both a
> userspace part(`aya`) and a part(`aya-ebpf`) that compiles to bpf. I chose to
> only use the userspace part, and use C for the BPF programs themselves. The reasons were:
> - we don't have `aya-ebpf` packaged
> - `aya-ebpf` *requires* nightly toolchain to compile
> - the bpf programs are very small, in case this should change at some point we
> can reconsider. Also, it doesn't matter what produces the .o file, so this
> could be swapped in really easily if we decided to
>
> So we compile the bpf program written in C to a .o targeting bpf using clang
> and include it when compiling the agent binary.
>
> ## agent
> The agent is not a long running daemon, the triggers mentioned before should cover
> all situations where we'd have to touch the kernel state. When started, the
> first thing it does is check both the program and schema version, so what it
> was compiled with, and what the last invocation did to the kernel. If either
> the program or the schema differs it either swaps out the program currently
> loaded by the kernel and pins it. If the schema version differs it does that as
> well, but additionally also tears down all state and rebuilds it.
>
> The agent also populates the `rules` map, so it creates all the inherited rules
> and resolves multiple matches to the closest one as described before.
>
> ## SRv6
> This also adds support for SRv6 as a transport, we don't support that yet in
> our SDN stack, but could be useful for basic routing between simple zones on
> multiple nodes. A bit like EVPN-lite since it's only L3. I did most of my
> testing with SRv6 as transport between kernels, before I found out the kernel
> does it for VXLAN automatically. I didn't wire up any UI for it yet, but I
> decided to include it in this RFC for now.
>
> # enabling VXLAN-GBP
> The kernel only moves the mark into the GBP field if the vxlan device was
> created with the GBP flag set, and it's create-only: the kernel won't
> toggle it on a running device. ifupdown2 had no attribute for this, so
> this series includes a small ifupdown2 patch adding `vxlan-gbp`, which
> threads the flag through to the netlink/iproute2 create path.
>
> # testing
> I have put pre-built packages on sani, these include ifupdown2 with the patch
>
> # building
> 1. proxmox-ve-rs (install)
> 2. proxmox-ebpf
> 3. pve-cluster (install)
> 4. proxmox-perl-rs (install)
> 5. pve-network
> 6. pve-manager
>
> # notes
> I did not send the first commit for `proxmox-ebpf` since it contains a
> `vmlinux.h` which is rather large but is needed for compiling. The commit is in
> my staff repo.
>
> # feedback wanted
> - the general desgin, specifically with the agent being one-shot and triggered
> rather than a running service
> - I put the VXLAN-GBP flag into the zones that run on vxlan for now, so it has
> to be enabled on the zone, and will affect all vxlan interfaces that are
> part of it. The only real alternative is enabling it always, or trying to
> infer if a nic is assigned a vnet that is in a zone that does vxlan and
> corss-referencing that with potentially configured microseg
> groups/assignments. This seemed brittle, and since the needed flag is
> additionally create-only, a simple flag on the zone appeard to be the better
> approach
> - and the ui, very likely needs some polishing, and im very open to
> alternative approaches
>
>
> proxmox-ebpf:
>
> Hannes Laimer (3):
> agent: add userspace coordinator and stateless policy subsystem
> bpf: add bridge subsystem
> debian: add packaging and boot-time oneshot unit
>
> Makefile | 66 +++++++
> debian/changelog | 5 +
> debian/control | 34 ++++
> debian/copyright | 18 ++
> debian/proxmox-ebpf.install | 1 +
> debian/proxmox-ebpf.postrm | 11 ++
> debian/proxmox-ebpf.prerm | 12 ++
> debian/proxmox-ebpf.service | 15 ++
> debian/rules | 33 ++++
> debian/source/format | 1 +
> include/mark.h | 30 +++
> src/agent.rs | 105 ++++++++++
> src/bridge/bpf/srv6.bpf.c | 76 +++++++
> src/bridge/mod.rs | 75 +++++++
> src/main.rs | 69 +++++++
> src/policy/bpf/tap.bpf.c | 66 +++++++
> src/policy/bpf/types.h | 23 +++
> src/policy/mod.rs | 268 +++++++++++++++++++++++++
> src/policy/types.rs | 45 +++++
> src/running_config.rs | 38 ++++
> src/state.rs | 303 ++++++++++++++++++++++++++++
> src/subsystem.rs | 384 ++++++++++++++++++++++++++++++++++++
> src/tc.rs | 152 ++++++++++++++
> 23 files changed, 1830 insertions(+)
> create mode 100644 Makefile
> create mode 100644 debian/changelog
> create mode 100644 debian/control
> create mode 100644 debian/copyright
> create mode 100644 debian/proxmox-ebpf.install
> create mode 100755 debian/proxmox-ebpf.postrm
> create mode 100755 debian/proxmox-ebpf.prerm
> create mode 100644 debian/proxmox-ebpf.service
> create mode 100755 debian/rules
> create mode 100644 debian/source/format
> create mode 100644 include/mark.h
> create mode 100644 src/agent.rs
> create mode 100644 src/bridge/bpf/srv6.bpf.c
> create mode 100644 src/bridge/mod.rs
> create mode 100644 src/main.rs
> create mode 100644 src/policy/bpf/tap.bpf.c
> create mode 100644 src/policy/bpf/types.h
> create mode 100644 src/policy/mod.rs
> create mode 100644 src/policy/types.rs
> create mode 100644 src/running_config.rs
> create mode 100644 src/state.rs
> create mode 100644 src/subsystem.rs
> create mode 100644 src/tc.rs
>
>
> proxmox-ve-rs:
>
> Hannes Laimer (1):
> ve-config: sdn: add microseg config types
>
> proxmox-ve-config/src/sdn/config.rs | 9 +-
> proxmox-ve-config/src/sdn/microseg.rs | 847 ++++++++++++++++++++++++++
> proxmox-ve-config/src/sdn/mod.rs | 1 +
> 3 files changed, 856 insertions(+), 1 deletion(-)
> create mode 100644 proxmox-ve-config/src/sdn/microseg.rs
>
>
> proxmox-perl-rs:
>
> Hannes Laimer (1):
> sdn: add microseg config binding
>
> pve-rs/Makefile | 1 +
> pve-rs/src/bindings/sdn/microseg.rs | 172 ++++++++++++++++++++++++++++
> pve-rs/src/bindings/sdn/mod.rs | 1 +
> 3 files changed, 174 insertions(+)
> create mode 100644 pve-rs/src/bindings/sdn/microseg.rs
>
>
> pve-cluster:
>
> Hannes Laimer (1):
> cfs: add 'sdn/microseg.cfg' to observed files
>
> src/PVE/Cluster.pm | 1 +
> 1 file changed, 1 insertion(+)
>
>
> pve-network:
>
> Hannes Laimer (4):
> sdn: microseg: add config and API
> sdn: zones: trigger microseg apply on tap_plug
> sdn: zones: add vxlan-gbp option to vxlan and evpn zones
> evpn: disable vxlan-learning on create if GBP is enabled
>
> src/PVE/API2/Network/SDN.pm | 12 +
> src/PVE/API2/Network/SDN/Makefile | 2 +
> src/PVE/API2/Network/SDN/Microseg.pm | 126 +++++++
> .../API2/Network/SDN/Microseg/Assignment.pm | 163 +++++++++
> src/PVE/API2/Network/SDN/Microseg/Bridge.pm | 171 ++++++++++
> src/PVE/API2/Network/SDN/Microseg/Group.pm | 171 ++++++++++
> src/PVE/API2/Network/SDN/Microseg/Makefile | 8 +
> src/PVE/API2/Network/SDN/Microseg/Rule.pm | 163 +++++++++
> src/PVE/Network/SDN.pm | 5 +
> src/PVE/Network/SDN/Makefile | 1 +
> src/PVE/Network/SDN/Microseg.pm | 316 ++++++++++++++++++
> src/PVE/Network/SDN/Zones.pm | 6 +
> src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 11 +
> src/PVE/Network/SDN/Zones/VxlanPlugin.pm | 9 +
> 14 files changed, 1164 insertions(+)
> create mode 100644 src/PVE/API2/Network/SDN/Microseg.pm
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Assignment.pm
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Bridge.pm
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Group.pm
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Makefile
> create mode 100644 src/PVE/API2/Network/SDN/Microseg/Rule.pm
> create mode 100644 src/PVE/Network/SDN/Microseg.pm
>
>
> pve-manager:
>
> Hannes Laimer (3):
> ui: sdn: add microsegmentation
> network: apply microseg state on reload
> ui: sdn: zones: add vxlan-gbp checkbox to vxlan and evpn
>
> PVE/API2/Network.pm | 4 +
> www/manager6/Makefile | 9 +
> www/manager6/Utils.js | 23 +
> www/manager6/dc/Config.js | 8 +
> www/manager6/form/MicrosegGroupSelector.js | 64 +++
> www/manager6/form/MicrosegGuestNicSelector.js | 107 +++++
> www/manager6/form/MicrosegGuestSelector.js | 83 ++++
> www/manager6/sdn/MicrosegView.js | 408 ++++++++++++++++++
> www/manager6/sdn/microseg/AssignmentEdit.js | 63 +++
> www/manager6/sdn/microseg/Base.js | 88 ++++
> www/manager6/sdn/microseg/GroupEdit.js | 61 +++
> www/manager6/sdn/microseg/PolicyView.js | 221 ++++++++++
> www/manager6/sdn/microseg/RuleEdit.js | 49 +++
> www/manager6/sdn/zones/EvpnEdit.js | 8 +
> www/manager6/sdn/zones/VxlanEdit.js | 11 +
> 15 files changed, 1207 insertions(+)
> create mode 100644 www/manager6/form/MicrosegGroupSelector.js
> create mode 100644 www/manager6/form/MicrosegGuestNicSelector.js
> create mode 100644 www/manager6/form/MicrosegGuestSelector.js
> create mode 100644 www/manager6/sdn/MicrosegView.js
> create mode 100644 www/manager6/sdn/microseg/AssignmentEdit.js
> create mode 100644 www/manager6/sdn/microseg/Base.js
> create mode 100644 www/manager6/sdn/microseg/GroupEdit.js
> create mode 100644 www/manager6/sdn/microseg/PolicyView.js
> create mode 100644 www/manager6/sdn/microseg/RuleEdit.js
>
>
> pve-docs:
>
> Hannes Laimer (2):
> sdn: add microsegmentation section
> sdn: add VXLAN-GBP flag to evpn/vxlan zone sections
>
> pvesdn.adoc | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 87 insertions(+)
>
>
> ifupdown2:
>
> Hannes Laimer (1):
> d/patches: add support for VXLAN-GBP flag
>
> ...addons-vxlan-add-vxlan-gbp-attribute.patch | 228 ++++++++++++++++++
> debian/patches/series | 1 +
> 2 files changed, 229 insertions(+)
> create mode 100644 debian/patches/pve/0016-addons-vxlan-add-vxlan-gbp-attribute.patch
>
>
> Summary over all repositories:
> 62 files changed, 5548 insertions(+), 1 deletions(-)
>
^ permalink raw reply [relevance 8%]
* [PATCH pve-docs v2 26/27] sdn: add microsegmentation section
2026-07-09 9:18 10% SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] " Hannes Laimer
2026-07-09 9:18 9% ` [PATCH proxmox-ebpf v2 08/27] debian: add packaging and boot-time oneshot unit Hannes Laimer
@ 2026-07-09 9:18 12% ` Hannes Laimer
2026-08-12 10:33 10% ` SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] sdn: add microsegmentation support Lukas Sichert
` (2 subsequent siblings)
4 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-07-09 9:18 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
pvesdn.adoc | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 118 insertions(+)
diff --git a/pvesdn.adoc b/pvesdn.adoc
index 3fd3533..bb8a36e 100644
--- a/pvesdn.adoc
+++ b/pvesdn.adoc
@@ -443,6 +443,124 @@ DNS Zone Prefix:: Add a prefix to the domain registration, like
<hostname>.prefix.<domain> Optional.
+[[pvesdn_config_microseg]]
+Microsegmentation
+-----------------
+
+Microsegmentation enforces an allow/deny policy between groups of guests at the
+guest network interface, independent of IP addressing. Each interface can be
+assigned a set of *groups*, and *rules* between groups decide which traffic is
+allowed. Enforcement happens in the kernel via eBPF programs attached to the
+guest interfaces, on the receiving side.
+
+The default is deny. Without a matching rule, traffic between groups is
+dropped, so every allowed flow needs an explicit rule.
+
+To carry the group identity between nodes on a VXLAN-based zone, the underlying
+VXLAN must have Group Based Policy enabled via the `VXLAN-GBP` option on the
+zone (see xref:pvesdn_zone_plugin_vxlan[VXLAN Zones] and
+xref:pvesdn_zone_plugin_evpn[EVPN Zones]). An SRv6-based carrier for routed
+setups exists at the API level, without UI support yet. Traffic that stays on a
+single node needs no extra configuration. A guest cannot forge its own group, as the
+host stamps it at the interface. The underlay is trusted, much like a VLAN tag.
+
+[[pvesdn_microseg_group]]
+Groups
+~~~~~~
+
+A group is a label applied to one or more guest interfaces. An interface can
+carry several groups at once. Its memberships form a set, the union of every
+assignment that covers it. Rules do not target interfaces directly but match
+this set through their predicates, so combinations of groups (a guest that is
+both `prod` and `web`) can be addressed without defining a group for every
+combination.
+
+Group configuration options:
+
+Name:: An identifier for the group.
+
+Mark:: A unique number from 1 to 65535 identifying the group, auto-assigned if
+ omitted. What is carried on the wire is a compact identity derived from an
+ interface's whole group set, not the individual marks.
+
+Comment:: Optional descriptive comment.
+
+[[pvesdn_microseg_rule]]
+Rules
+~~~~~
+
+A rule permits or denies traffic between a *source* and a *destination*
+predicate, each evaluated against an interface's group set by a match kind. As
+the default is deny, rules are only needed to permit traffic (or to deny a flow
+within a broader allow). Traffic within a single group is not permitted
+implicitly, so add an explicit rule for it.
+
+Rules are stateless and directional. Each packet is checked on its own, the
+source predicate against the sender's groups and the destination predicate
+against the receiver's, with no connection tracking. Return traffic needs its
+own rule. For a TCP connection from `web` to `app`, both a `web` to `app` and
+an `app` to `web` allow are required.
+
+Rule configuration options:
+
+Source / Destination:: The groups each predicate is evaluated against.
+
+Source match / Destination match:: How the predicate matches an interface's
+ groups. *any* fires when the set shares at least one listed group, *all* when
+ it has all of them, and *exact* when the groups equal the listed set.
+
+Priority:: On a conflict the highest-priority matching rule wins. Conflicting
+ verdicts tied at the top priority deny.
+
+Action:: Allow or deny.
+
+A built-in *untagged* group represents the no-group identity, an interface in no
+group, an external host, or a cross-node frame that arrives without a GBP tag.
+List it in a predicate like any other group, on its own (`exact` over
+`untagged`) or combined with real groups (`any` over `untagged, web`), to admit
+such traffic. This is what lets a managed guest exchange ARP / DHCP and reach its
+gateway, which are themselves untagged and would otherwise be dropped. It is
+meaningful as a rule *source*. As a destination it has no effect, since an
+untagged interface has no program to enforce on. The `untagged` group cannot be
+used in an assignment.
+
+[[pvesdn_microseg_assignment]]
+Assignments
+~~~~~~~~~~~
+
+An assignment binds guest network interfaces to a set of groups. It matches a
+specific guest, guests by their tags, or guests whose name matches a regular
+expression. An interface may be placed in several groups (by one assignment
+listing multiple groups, or by several assignments).
+
+The *tag* and *name regex* matchers are dynamic. They are re-evaluated against
+the current guests whenever the SDN configuration is applied, so tagging or
+renaming a guest shows up as a pending SDN change and takes effect on the next
+apply (until then a newly matched guest is treated as it was at the last apply,
+i.e. fail-closed). Both match at the guest level, so unless a specific interface
+is named the assignment covers all of a matching guest's interfaces.
+
+Assignment configuration options:
+
+Match by:: Whether to match a specific *guest*, guests by *tags*, or guests by
+ a *name regex*.
+
+Guest:: (guest matcher) The VM or container.
+
+Tags:: (tag matcher) The guest tags to match.
+
+Tag match:: (tag matcher) Whether a guest must carry *any* of the listed tags
+ (the default), *all* of them, or have *exact*ly the listed set.
+
+Name regex:: (regex matcher) A regular expression matched against each guest's
+ name (VM name or container hostname). It matches anywhere in the name, so anchor
+ it with `^` and `$` to match the whole name.
+
+Network interface:: Optional. The guest's netN interface. If left empty, all of
+ the guest's interfaces are covered.
+
+Groups:: The groups the matching interfaces are placed into.
+
[[pvesdn_config_controllers]]
Controllers
-----------
--
2.47.3
^ permalink raw reply related [relevance 12%]
* [PATCH proxmox-ebpf v2 08/27] debian: add packaging and boot-time oneshot unit
2026-07-09 9:18 10% SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] " Hannes Laimer
@ 2026-07-09 9:18 9% ` Hannes Laimer
2026-07-09 9:18 12% ` [PATCH pve-docs v2 26/27] sdn: add microsegmentation section Hannes Laimer
` (3 subsequent siblings)
4 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-07-09 9:18 UTC (permalink / raw)
To: pve-devel
The oneshot unit re-applies the running config at boot, after the SDN
commit ran and before guests start, so the pinned state lost on reboot
is rebuilt before the first NIC comes up. On package removal all
programs are detached and pinned state is dropped: leaving them
attached would keep enforcing a policy no agent can update anymore.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
Makefile | 66 +++++++++++++++++++++++++++++++++++++
debian/changelog | 5 +++
debian/control | 35 ++++++++++++++++++++
debian/copyright | 18 ++++++++++
debian/proxmox-ebpf.install | 1 +
debian/proxmox-ebpf.postrm | 11 +++++++
debian/proxmox-ebpf.prerm | 12 +++++++
debian/proxmox-ebpf.service | 15 +++++++++
debian/rules | 33 +++++++++++++++++++
debian/source/format | 1 +
10 files changed, 197 insertions(+)
create mode 100644 Makefile
create mode 100644 debian/changelog
create mode 100644 debian/control
create mode 100644 debian/copyright
create mode 100644 debian/proxmox-ebpf.install
create mode 100755 debian/proxmox-ebpf.postrm
create mode 100755 debian/proxmox-ebpf.prerm
create mode 100644 debian/proxmox-ebpf.service
create mode 100755 debian/rules
create mode 100644 debian/source/format
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..bf3d7e7
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,66 @@
+include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/pkg-info.mk
+
+PACKAGE := proxmox-ebpf
+BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
+CARGO ?= cargo
+
+ifeq ($(BUILD_MODE), release)
+CARGO_BUILD_ARGS += --release
+endif
+
+DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
+DBG_DEB=$(PACKAGE)-dbgsym_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
+DSC=$(PACKAGE)_$(DEB_VERSION).dsc
+
+all: cargo-build
+
+.PHONY: cargo-build
+cargo-build:
+ $(CARGO) build $(CARGO_BUILD_ARGS)
+
+.PHONY: test
+test:
+ $(CARGO) test $(CARGO_BUILD_ARGS)
+
+.PHONY: check
+check: test
+
+$(BUILDDIR): src include debian Cargo.toml build.rs
+ rm -rf $(BUILDDIR) $(BUILDDIR).tmp
+ mkdir $(BUILDDIR).tmp
+ cp -a -t $(BUILDDIR).tmp $^ Makefile
+ mv $(BUILDDIR).tmp $(BUILDDIR)
+
+.PHONY: deb
+deb: $(DEB)
+$(DEB) $(DBG_DEB) &: $(BUILDDIR)
+ cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
+ lintian $(DEB)
+
+.PHONY: dsc
+dsc:
+ $(MAKE) clean
+ $(MAKE) $(DSC)
+ lintian $(DSC)
+
+$(DSC): $(BUILDDIR)
+ cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
+
+sbuild: $(DSC)
+ sbuild $(DSC)
+
+.PHONY: upload
+upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
+upload: $(DEB) $(DBG_DEB)
+ tar -cf - $(DEB) $(DBG_DEB) | ssh -X repoman@repo.proxmox.com upload --product pve --dist $(UPLOAD_DIST)
+
+.PHONY: dinstall
+dinstall:
+ $(MAKE) deb
+ sudo -k dpkg -i $(DEB)
+
+clean:
+ $(CARGO) clean
+ rm -rf ./$(BUILDDIR)
+ rm -f -- *.deb *.dsc *.tar.?z *.buildinfo *.build *.changes
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..310d2cd
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+proxmox-ebpf (0.1.0) trixie; urgency=medium
+
+ * initial packaging.
+
+ -- Proxmox Support Team <support@proxmox.com> Mon, 18 May 2026 11:00:00 +0200
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..03bd62e
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,35 @@
+Source: proxmox-ebpf
+Section: admin
+Priority: optional
+Build-Depends: debhelper-compat (= 13),
+ dh-cargo,
+ clang,
+ llvm,
+ libbpf-dev,
+ linux-libc-dev,
+ cargo:native,
+ rustc:native,
+ libstd-rust-dev,
+ librust-anyhow-1+default-dev,
+ librust-aya-0.13+default-dev,
+ librust-log-0.4+default-dev,
+ librust-pico-args-0.5+default-dev,
+ librust-proxmox-log-1+default-dev,
+ librust-proxmox-ve-config-0.10+default-dev,
+ librust-nix-0.29+default-dev,
+ librust-nix-0.29+hostname-dev,
+ librust-nix-0.29+net-dev,
+ librust-serde-json-1+default-dev,
+Maintainer: Proxmox Support Team <support@proxmox.com>
+Standards-Version: 4.6.2
+Homepage: https://www.proxmox.com
+Rules-Requires-Root: no
+
+Package: proxmox-ebpf
+Architecture: any
+Depends: pve-cluster (>= 9.0.1),
+ libpve-network-perl,
+ ${shlibs:Depends},
+ ${misc:Depends},
+Description: eBPF-based microsegmentation agent for Proxmox VE
+ Filters traffic between guests by identity.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..01138fa
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,18 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+Files:
+ *
+Copyright: 2026 Proxmox Server Solutions GmbH <support@proxmox.com>
+License: AGPL-3.0-or-later
+ This program is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Affero General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option) any
+ later version.
+ .
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+ details.
+ .
+ You should have received a copy of the GNU Affero General Public License along
+ with this program. If not, see <https://www.gnu.org/licenses/>.
diff --git a/debian/proxmox-ebpf.install b/debian/proxmox-ebpf.install
new file mode 100644
index 0000000..7fbce7e
--- /dev/null
+++ b/debian/proxmox-ebpf.install
@@ -0,0 +1 @@
+target/x86_64-unknown-linux-gnu/release/proxmox-ebpf usr/libexec/proxmox
diff --git a/debian/proxmox-ebpf.postrm b/debian/proxmox-ebpf.postrm
new file mode 100755
index 0000000..2a7d9a5
--- /dev/null
+++ b/debian/proxmox-ebpf.postrm
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+ remove|purge)
+ rm -rf /sys/fs/bpf/proxmox-ebpf /sys/fs/bpf/proxmox-ebpf-test || true
+ rm -rf /run/proxmox-ebpf || true
+ ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/proxmox-ebpf.prerm b/debian/proxmox-ebpf.prerm
new file mode 100755
index 0000000..cce50f0
--- /dev/null
+++ b/debian/proxmox-ebpf.prerm
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+ remove)
+ if [ -x /usr/libexec/proxmox/proxmox-ebpf ]; then
+ /usr/libexec/proxmox/proxmox-ebpf clear || true
+ fi
+ ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/proxmox-ebpf.service b/debian/proxmox-ebpf.service
new file mode 100644
index 0000000..b78259e
--- /dev/null
+++ b/debian/proxmox-ebpf.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Proxmox VE eBPF microsegmentation boot reconcile
+Wants=pve-cluster.service network-online.target
+After=pve-cluster.service network-online.target pve-sdn-commit.service
+Before=pve-guests.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/libexec/proxmox/proxmox-ebpf apply
+RuntimeDirectory=proxmox-ebpf
+RuntimeDirectoryPreserve=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..db2a8c9
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,33 @@
+#!/usr/bin/make -f
+# See debhelper(7) (uncomment to enable)
+# output every command that modifies files on the build system.
+DH_VERBOSE = 1
+
+include /usr/share/dpkg/pkg-info.mk
+include /usr/share/rustc/architecture.mk
+
+export BUILD_MODE=release
+
+export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
+export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
+
+export CARGO=/usr/share/cargo/bin/cargo
+export CARGO_HOME = $(CURDIR)/debian/cargo_home
+
+export DEB_CARGO_CRATE=proxmox-ebpf_$(DEB_VERSION_UPSTREAM)
+export DEB_CARGO_PACKAGE=proxmox-ebpf
+
+%:
+ dh $@
+
+override_dh_auto_configure:
+ @perl -ne 'if (/^version\s*=\s*"(\d+(?:\.\d+)+)"/) { my $$v_cargo = $$1; my $$v_deb = "$(DEB_VERSION_UPSTREAM)"; \
+ die "ERROR: d/changelog <-> Cargo.toml version mismatch: $$v_cargo != $$v_deb\n" if $$v_cargo ne $$v_deb; exit(0); }' Cargo.toml
+ $(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system
+ dh_auto_configure
+
+override_dh_missing:
+ dh_missing --fail-missing
+
+override_dh_installsystemd:
+ dh_installsystemd proxmox-ebpf.service
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
--
2.47.3
^ permalink raw reply related [relevance 9%]
* SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] sdn: add microsegmentation support
@ 2026-07-09 9:18 10% Hannes Laimer
2026-07-09 9:18 9% ` [PATCH proxmox-ebpf v2 08/27] debian: add packaging and boot-time oneshot unit Hannes Laimer
` (4 more replies)
0 siblings, 5 replies; 26+ results
From: Hannes Laimer @ 2026-07-09 9:18 UTC (permalink / raw)
To: pve-devel
This adds support for microsegmentation using eBPF programs attached to
interfaces. Mostly the tap/veth interfaces on the guests directly.
# Overview
Each guest interface is assigned a *set* of groups. Rather than a hierarchy,
group membership is treated as a signature. The agent compiles each interface's
group set into a single per-NIC *identity*, and policies are rules between
groups, matched against those sets with predicates.
A rule is a `src` predicate and a `dst` predicate plus a verdict and a
priority, where a predicate is a match kind over a list of groups:
- any{...} the interface shares at least one of the listed groups
- all{...} the interface has all of the listed groups
- exact{...} the interface's groups are exactly the listed set
For a packet, the `src` predicate is evaluated against the sender's set and the
`dst` predicate against the receiver's. Among the rules that fire the highest
`prio` wins, a conflicting tie (with different verdicts) denies, and if no rule
fires the packet is denied (default-deny). For example, with the groups
web/app/db/prod, specific allows punched through a broad deny:
- any{web} -> any{app} : allow prio 10
- any{app} -> any{db} : allow prio 10
- all{prod} -> all{prod} : allow prio 10 # these three carve out east-west...
- any{web,app,db} -> any{web,app,db} : deny prio 5 # ...through a broad tier-to-tier deny
(the last is technically not needed cause the default is deny, in a larger
context having this explicitly can be necesarry though)
The allows above are one-directional. Rules are stateless and per-packet, there
is no connection tracking. The reply needs its own allow, so for TCP between web
and app both any{web} -> any{app} and any{app} -> any{web} have to be allowed.
Groups land on an interface either directly (a guest matcher: a `vmid`,
optionally a single `iface`), by tag (a tag matcher: every guest carrying the
named tags, e.g. `prod`/`staging`/`web`), or by name (a regex matcher: every
guest whose name matches a regular expression). Assignments are additive, an
interface's set is the union of every assignment that resolves to it, so the
matchers compose.
`untagged` is a reserved built-in group (mark 0) for traffic that arrives
unstamped (gateways, DHCP/ARP, cross-node frames without a tag). It can be
named in a predicate and composed with real groups (e.g. `any{untagged, web}`),
but it is not assignable.
Enforcement happens on the receiving side, cause that's where we for sure know both
- where the packet is from
- and, its destination (us)
# config and API
The config is a single section-config, `sdn/microseg.cfg`. It holds these
object types, keyed by section id:
- group, a numeric `mark` (auto-assigned if omitted) and an optional comment
- rule, a `src`/`dst` predicate pair (`*_match` is any/all/exact over a group list),
a `prio` and `allow`
- guestassignment, binds a guest's NIC(s) (`vmid`, optional `iface`) to a group set
- tagassignment, binds the NICs of every guest matching `tags` (by `tag_match`) to a
group set, expanded against the live guest inventory on render
- regexassignment, same but for every guest whose name matches a regular
expression
- bridge, marks a bridge-facing interface as an SRv6 carrier (no UI yet)
The API exposes endpoints under
`/cluster/sdn/microseg/{group,rule,assignment,bridge}`, guarded by SDN.Audit for reads
and SDN.Allocate for writes. The assignment endpoint discriminates the two matcher
kinds on a `type` property (like the fabric `protocol`).
Rule and tag/regex-assignment ids are derived from their contents (an FNV-1a hash),
guest assignments from `vm{vmid}i{iface}`, groups and bridges take a chosen id. On
commit the config is rendered into `.running-config`, which is what the agent reads.
Rendering resolves each interface's group set to a wire identity and expands the
dynamic matchers against the inventory.
# identity
An identity is not one id per group set but one id per *signature*. Two
interfaces share an id when every rule predicate fires the same way on both, so
no rule can tell them apart. The identities are the classes of that partition,
each named by a 16-bit id, and that id is what rides on the wire.
Editing rules reshapes the partition. A new predicate that separates two sets
which used to look alike *splits* their class in two, and dropping the
predicate that told two classes apart *merges* them back into one. On a split
the subclass that still carries the old representative keeps the id and the
other gets a fresh one, on a merge the surviving class keeps its id and the
fused-away ones retire.
New ids come fresh-first from a counter. A retired id is not reused right away,
it sits in a time quarantine long enough that no packet stamped under its old
meaning can still be in flight. Only once the fresh space is exhausted does
allocation fall back to reusing a retired id whose quarantine has passed, so
config churn alone cannot exhaust the 16-bit id space. Actually running out
would take more than 65534 identities the policies can tell apart. So it
doesn't scale with count of group combinations in use, but with the distinct
semantic meaning they carry.
# skb->mark
Every packet in the kernel lives in a `sk_buff` struct, which has a 32-bit
`mark` field you can read and write while the packet moves through the kernel.
Nothing else in our SDN stack touches `mark` today, so microseg has it to
itself. Worth keeping in mind if that ever changes. For now we only use the
lower 16 bits, to carry the interface's identity (mark 0 is reserved for
unstamped traffic), so up to 65535 identities.
The catch is `mark` only lives as long as the packet stays in the kernel, and
sooner or later it leaves. To carry the identity between hosts we have to put it
on the wire itself. For that we support two carriers:
- VXLAN-GBP, the 16-bit GBP field on the VXLAN encapsulation
- SRv6, the 16-bit Tag field on the SRH
The kernel already moves `mark` in and out of the VXLAN-GBP field for us (found
that out way too late :P). For SRv6 we do it ourselves with a small eBPF program.
# eBPF
Both tagging (setting `mark`) and enforcement happen in an eBPF program
directly attached to the guest's interface. The programs themselves read and
write to/from two maps:
- tap_to_group, the identity to stamp for a given interface
- rules, a map of (src_id, dst_id) -> action, where src is the `mark` the
packet carries and dst is our own interface's identity
Specifically, on ingress we set the mark, and on egress we enforce.
# Implementation
We have an `agent` that reads the running sdn config, and applies that state to
the kernel. The binary is stateless and one-shot, not a long running daemon. It
runs on SDN apply, on tap_plug of a guest interface, and on boot after
pve-sdn-commit but before guests start. Those triggers cover every situation
where we have to touch kernel state.
It compiles the config into what the data plane needs. It folds each
interface's group set into a wire identity (a registry kept stable across
renders so identities agree across hosts, allocated as described above), and
folds the rules into the `(src_id, dst_id)` action map by priority (highest
wins, conflicting ties deny).
It keeps track of what is currently loaded in the kernel with two files under
`/run/proxmox-ebpf`. One keeping track of the bpf program that was compiled
into the binary, and one for keeping track of changes to the data structures
the bpf program accesses. The distinction is useful cause for only a program
change we can swap the currently attached program with the updated one
atomically. In case the data structure (the maps) changed there is no other way
than to tear-down all the current state and repopulate the maps and re-attach
the programs. Swapping out the maps first would have old programs interact with
a new data schema, and swapping the programs first will lead to new programs
accessing an old data schema. Either way, not good, so we wipe the state in
that case and re-build it. So, in case we change the structure of the data our
bpf programs access, there will be a bunch of ms where the configured
segmentation is not enforced. But that is the only scenario where that can
happen.
## aya, aya-ebpf
Aya is a rust lib that helps with working with BPF more easily. It has both a
userspace part (`aya`) and a part (`aya-ebpf`) that compiles to bpf. I chose to
only use the userspace part, and use C for the BPF programs themselves. The
reasons were:
- we don't have `aya-ebpf` packaged
- `aya-ebpf` *requires* nightly toolchain to compile
- the bpf programs are very small, in case this should change at some point we
can reconsider. Also, it doesn't matter what produces the .o file, so this
could be swapped in really easily if we decided to
So we compile the bpf program written in C to a .o targeting bpf using clang
and include it when compiling the agent binary.
## SRv6
Besides VXLAN-GBP, the identity can also ride in the 16-bit Tag field of an SRv6
SRH. The kernel already does this move for VXLAN-GBP but not for SRv6, so this
adds a small eBPF program that writes the identity into the SRH on egress and
reads it back on ingress. The `bridge` object marks the bridge-facing interface
it runs on.
This is only the tag carrier, not an SRv6 transport. Our SDN stack has no SRv6
zone yet, so there is nothing configured to route it over, and there is no UI.
If SDN grows an SRv6 transport later (a small L3, EVPN-lite style option), the
carrier is already in place.
It is packaged as a droppable tail. The carrier bridge section (proxmox-ve-config),
the bridge API (pve-network) and the bridge subsystem (proxmox-ebpf) are each the
last patch of their repo's series, so SRv6 can be deferred without touching the rest.
# enabling VXLAN-GBP
The kernel only moves the mark into the GBP field if the vxlan device was
created with the GBP flag set, and it's create-only, the kernel won't
toggle it on a running device. ifupdown2 had no attribute for this, so
this series includes a small ifupdown2 patch adding `vxlan-gbp`, which
threads the flag through to the netlink/iproute2 create path.
# testing
I have put pre-built packages on sani, these include ifupdown2 with the patch
# building
1. proxmox-ve-rs (install)
2. proxmox-ebpf
3. pve-cluster (install)
4. proxmox-perl-rs (install)
5. pve-network
6. pve-manager
# notes
* everything eBPF related did not change since v1, this v2 only really changes identity semantics
* using GENEVE would also be an option, but with this current approach we gain
a lot of flexibility. Expanding predicate logic, or having not just
allow/deny but also match ports or alike is possible without touching the
underlying identity system. (limiting the per-packet overhead to just 16
bits is also good I'd argue)
* the enforement mechanism is not set in stone, weather this is eBPF or maybe
nftables with a map we populate as shortly discussed with @Stefan. The
current approach plays nicely with both since it conveys identity through
`skb->mark` that nft can access as well
* I did not send the first commit for `proxmox-ebpf` since it contains a
`vmlinux.h` which is rather large but is needed for compiling. The commit is in
my staff repo.
# changelog
v2:
- core model reworked: each interface now holds a *set* of groups compiled
into a per-NIC wire identity, replacing the single-group parent/child tree
- rules gained explicit `src`/`dst` predicates (any/all/exact) and a `prio`,
replacing the implicit tree-distance ordering
- `untagged` is now a nameable built-in group (mark 0)
- assignments are additive: a NIC's set is the union of all that resolve to it
- added tag-matcher and name-regex assignments
- rule and dynamic-assignment ids are now generated
- identity allocation is fresh-first with quarantined reclamation, so churn
cannot exhaust the id space
- split the SRv6 carrier support into droppable tail patches
- updated docs
- updated cover-letter
proxmox-ve-rs:
Hannes Laimer (5):
ve-config: sdn: add microseg signature-identity engine
ve-config: sdn: add microseg config types
ve-config: sdn: microseg: add tag matcher
ve-config: sdn: microseg: add name regex matcher
ve-config: sdn: microseg: add carrier bridge section
proxmox-ve-config/src/sdn/config.rs | 9 +-
.../src/sdn/microseg/identity.rs | 624 +++++
proxmox-ve-config/src/sdn/microseg/mod.rs | 2349 +++++++++++++++++
proxmox-ve-config/src/sdn/mod.rs | 1 +
4 files changed, 2982 insertions(+), 1 deletion(-)
create mode 100644 proxmox-ve-config/src/sdn/microseg/identity.rs
create mode 100644 proxmox-ve-config/src/sdn/microseg/mod.rs
proxmox-ebpf:
Hannes Laimer (3):
agent: add userspace coordinator and stateless policy subsystem
bpf: add bridge subsystem
debian: add packaging and boot-time oneshot unit
Makefile | 66 +++++++
debian/changelog | 5 +
debian/control | 35 ++++
debian/copyright | 18 ++
debian/proxmox-ebpf.install | 1 +
debian/proxmox-ebpf.postrm | 11 ++
debian/proxmox-ebpf.prerm | 12 ++
debian/proxmox-ebpf.service | 15 ++
debian/rules | 33 ++++
debian/source/format | 1 +
include/mark.h | 30 +++
src/agent.rs | 99 ++++++++++
src/bridge/bpf/srv6.bpf.c | 76 +++++++
src/bridge/mod.rs | 76 +++++++
src/main.rs | 69 +++++++
src/policy/bpf/tap.bpf.c | 68 +++++++
src/policy/bpf/types.h | 23 +++
src/policy/mod.rs | 268 +++++++++++++++++++++++++
src/policy/types.rs | 45 +++++
src/running_config.rs | 38 ++++
src/state.rs | 149 ++++++++++++++
src/subsystem.rs | 385 ++++++++++++++++++++++++++++++++++++
src/tc.rs | 152 ++++++++++++++
23 files changed, 1675 insertions(+)
create mode 100644 Makefile
create mode 100644 debian/changelog
create mode 100644 debian/control
create mode 100644 debian/copyright
create mode 100644 debian/proxmox-ebpf.install
create mode 100755 debian/proxmox-ebpf.postrm
create mode 100755 debian/proxmox-ebpf.prerm
create mode 100644 debian/proxmox-ebpf.service
create mode 100755 debian/rules
create mode 100644 debian/source/format
create mode 100644 include/mark.h
create mode 100644 src/agent.rs
create mode 100644 src/bridge/bpf/srv6.bpf.c
create mode 100644 src/bridge/mod.rs
create mode 100644 src/main.rs
create mode 100644 src/policy/bpf/tap.bpf.c
create mode 100644 src/policy/bpf/types.h
create mode 100644 src/policy/mod.rs
create mode 100644 src/policy/types.rs
create mode 100644 src/running_config.rs
create mode 100644 src/state.rs
create mode 100644 src/subsystem.rs
create mode 100644 src/tc.rs
pve-cluster:
Hannes Laimer (1):
cfs: add 'sdn/microseg.cfg' to observed files
src/PVE/Cluster.pm | 1 +
1 file changed, 1 insertion(+)
proxmox-perl-rs:
Hannes Laimer (1):
pve-rs: sdn: add microseg config binding
pve-rs/Makefile | 1 +
pve-rs/src/bindings/sdn/microseg.rs | 235 ++++++++++++++++++++++++++++
pve-rs/src/bindings/sdn/mod.rs | 1 +
3 files changed, 237 insertions(+)
create mode 100644 pve-rs/src/bindings/sdn/microseg.rs
ifupdown2:
Hannes Laimer (1):
d/patches: add support for VXLAN-GBP flag
...addons-vxlan-add-vxlan-gbp-attribute.patch | 228 ++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 229 insertions(+)
create mode 100644 debian/patches/pve/0016-addons-vxlan-add-vxlan-gbp-attribute.patch
pve-network:
Hannes Laimer (8):
sdn: microseg: add config, API and guest inventory
sdn: dry-run: surface pending microseg changes
sdn: zones: trigger microseg apply on tap_plug
sdn: zones: add vxlan-gbp option to vxlan and evpn zones
evpn: disable vxlan-learning on create if GBP is enabled
sdn: microseg: add tag matcher
sdn: microseg: add name regex matcher
sdn: microseg: add carrier bridge API
src/PVE/API2/Network/SDN.pm | 31 ++
src/PVE/API2/Network/SDN/Makefile | 2 +
src/PVE/API2/Network/SDN/Microseg.pm | 204 +++++++
.../API2/Network/SDN/Microseg/Assignment.pm | 185 +++++++
src/PVE/API2/Network/SDN/Microseg/Bridge.pm | 179 ++++++
src/PVE/API2/Network/SDN/Microseg/Group.pm | 179 ++++++
src/PVE/API2/Network/SDN/Microseg/Makefile | 8 +
src/PVE/API2/Network/SDN/Microseg/Rule.pm | 180 +++++++
src/PVE/Network/SDN.pm | 37 ++
src/PVE/Network/SDN/Makefile | 1 +
src/PVE/Network/SDN/Microseg.pm | 509 ++++++++++++++++++
src/PVE/Network/SDN/Zones.pm | 6 +
src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 11 +
src/PVE/Network/SDN/Zones/VxlanPlugin.pm | 9 +
14 files changed, 1541 insertions(+)
create mode 100644 src/PVE/API2/Network/SDN/Microseg.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Assignment.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Bridge.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Group.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Makefile
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Rule.pm
create mode 100644 src/PVE/Network/SDN/Microseg.pm
pve-manager:
Hannes Laimer (6):
ui: sdn: add microsegmentation panel
ui: sdn: dry-run: show pending microseg diff
network: apply microseg state on reload
ui: sdn: zones: add vxlan-gbp checkbox to vxlan and evpn
ui: sdn: microseg: add tag matcher
ui: sdn: microseg: add name regex matcher
PVE/API2/Network.pm | 4 +
www/manager6/Makefile | 9 +
www/manager6/Utils.js | 34 ++
www/manager6/dc/Config.js | 8 +
www/manager6/form/MicrosegGroupSelector.js | 77 +++++
www/manager6/form/MicrosegGuestSelector.js | 83 +++++
www/manager6/sdn/MicrosegView.js | 143 ++++++++
www/manager6/sdn/SdnDiffView.js | 24 ++
www/manager6/sdn/microseg/AssignmentEdit.js | 245 ++++++++++++++
www/manager6/sdn/microseg/Base.js | 137 ++++++++
www/manager6/sdn/microseg/GroupEdit.js | 45 +++
www/manager6/sdn/microseg/PolicyView.js | 181 ++++++++++
www/manager6/sdn/microseg/RuleEdit.js | 104 ++++++
www/manager6/sdn/microseg/Tree.js | 356 ++++++++++++++++++++
www/manager6/sdn/zones/EvpnEdit.js | 8 +
www/manager6/sdn/zones/VxlanEdit.js | 11 +
16 files changed, 1469 insertions(+)
create mode 100644 www/manager6/form/MicrosegGroupSelector.js
create mode 100644 www/manager6/form/MicrosegGuestSelector.js
create mode 100644 www/manager6/sdn/MicrosegView.js
create mode 100644 www/manager6/sdn/microseg/AssignmentEdit.js
create mode 100644 www/manager6/sdn/microseg/Base.js
create mode 100644 www/manager6/sdn/microseg/GroupEdit.js
create mode 100644 www/manager6/sdn/microseg/PolicyView.js
create mode 100644 www/manager6/sdn/microseg/RuleEdit.js
create mode 100644 www/manager6/sdn/microseg/Tree.js
pve-docs:
Hannes Laimer (2):
sdn: add microsegmentation section
sdn: add VXLAN-GBP flag to evpn/vxlan zone sections
pvesdn.adoc | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 134 insertions(+)
Summary over all repositories:
64 files changed, 8268 insertions(+), 1 deletions(-)
--
Generated by murpp 0.12.0
^ permalink raw reply [relevance 10%]
* Re: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs} 00/16] sdn: add microsegmentation support
2026-06-09 13:25 12% [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs} 00/16] sdn: add microsegmentation support Hannes Laimer
2026-06-09 13:25 9% ` [PATCH proxmox-ebpf 03/16] debian: add packaging and boot-time oneshot unit Hannes Laimer
@ 2026-06-18 13:10 9% ` Lukas Sichert
2026-07-09 9:20 8% ` superseded: " Hannes Laimer
2 siblings, 0 replies; 26+ results
From: Lukas Sichert @ 2026-06-18 13:10 UTC (permalink / raw)
To: Hannes Laimer, pve-devel
On 2026-06-09 15:25, Hannes Laimer <h.laimer@proxmox.com> wrote:
> This adds support for microsegmentation using eBPF programs attached to
> interfaces. Mostly the tap/veth interfaces on the guests directly.
I installed and tested this using the .debs from the staff repo.
First, on a standalone node I created some groups and subgroups and
and assigned VMs. After I set some policies and moved the VMs around the
groups. Everything works as expected. Also overriding rules set for
parent groups with subgroup rules works.
After that I set up a 3 node EVPN-VXLAN setup with an IPv6 Openfabric
underlay. Then on different nodes I setup VMs and played around
with goups and policies. Again everything works as expected.
> # feedback wanted
> - the general desgin, specifically with the agent being one-shot and triggered
> rather than a running service
> - I put the VXLAN-GBP flag into the zones that run on vxlan for now, so it has
> to be enabled on the zone, and will affect all vxlan interfaces that are
> part of it. The only real alternative is enabling it always, or trying to
> infer if a nic is assigned a vnet that is in a zone that does vxlan and
> corss-referencing that with potentially configured microseg
> groups/assignments. This seemed brittle, and since the needed flag is
> additionally create-only, a simple flag on the zone appeard to be the better
> approach
> - and the ui, very likely needs some polishing, and im very open to
> alternative approaches
- I only glanced over the EBPF code and the agent call in pve-network
and did not dive in deeper into every function, but in general making
the config change triggered rather than a service actively syncing is
a good idea. This eliminates delays that users might encounter, it
decreases cpu load and also it makes it easier to see current state of
the ebpf setup as we don't have to consider, what the service
currently might doing.
- We have already had a small discussion about whether it would be
possible to infer which vms belong to groups and only mark these. But
as the marking happens at the vxland encapsulation and not really at
egress from the VM, it gets handled by the vxlan interface of the
host. Therefore IMO it makes most sense to make this a zone
configuration. Additionally, there is no scenario I can think of where
this enabled on the zone could cause any packet dropping.
some small UI nits:
- the Add button is greyed out when trying to allow untagged traffic for
a Group, one can set it only by first making a change, then undoing the
change
- the error messages for removal are a bit cryptic, specifically I
encountered:
- 'delete sdn microseg group failed: group 'gr1-1' is still referenced
by 'p0-3' (500)', when removing a group that still contained a VM
- 'delete sdn microseg group failed: group 'gr2' is still referenced
by 'p0-2' (500)', when removing a group, that still contained a
policy
- I would love to have something like a move button for VMs instead of
having to remove and then add again
- IMO the symbols are really nice, especially that the egress and ingress
from and to other groups can and must be set separatly, but for the
unstamped traffic I would maybe do something like <-> instead of just
->, because this leads to beleave egress also has to bet set
Apart from that I found the UI very intuitive.
As these are all smaller nits, if nothing bigger changes consider for
this and future versions:
Tested-by: Lukas Sichert <l.sichert@proxmox.com>
^ permalink raw reply [relevance 9%]
* [PATCH proxmox-ebpf 03/16] debian: add packaging and boot-time oneshot unit
2026-06-09 13:25 12% [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs} 00/16] sdn: add microsegmentation support Hannes Laimer
@ 2026-06-09 13:25 9% ` Hannes Laimer
2026-06-18 13:10 9% ` [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs} 00/16] sdn: add microsegmentation support Lukas Sichert
2026-07-09 9:20 8% ` superseded: " Hannes Laimer
2 siblings, 0 replies; 26+ results
From: Hannes Laimer @ 2026-06-09 13:25 UTC (permalink / raw)
To: pve-devel
Package the agent and ship a systemd unit that runs `apply` once at boot,
bringing BPF state in line with the SDN running-config.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
Makefile | 66 +++++++++++++++++++++++++++++++++++++
debian/changelog | 5 +++
debian/control | 34 +++++++++++++++++++
debian/copyright | 18 ++++++++++
debian/proxmox-ebpf.install | 1 +
debian/proxmox-ebpf.postrm | 11 +++++++
debian/proxmox-ebpf.prerm | 12 +++++++
debian/proxmox-ebpf.service | 15 +++++++++
debian/rules | 33 +++++++++++++++++++
debian/source/format | 1 +
10 files changed, 196 insertions(+)
create mode 100644 Makefile
create mode 100644 debian/changelog
create mode 100644 debian/control
create mode 100644 debian/copyright
create mode 100644 debian/proxmox-ebpf.install
create mode 100755 debian/proxmox-ebpf.postrm
create mode 100755 debian/proxmox-ebpf.prerm
create mode 100644 debian/proxmox-ebpf.service
create mode 100755 debian/rules
create mode 100644 debian/source/format
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..bf3d7e7
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,66 @@
+include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/pkg-info.mk
+
+PACKAGE := proxmox-ebpf
+BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
+CARGO ?= cargo
+
+ifeq ($(BUILD_MODE), release)
+CARGO_BUILD_ARGS += --release
+endif
+
+DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
+DBG_DEB=$(PACKAGE)-dbgsym_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
+DSC=$(PACKAGE)_$(DEB_VERSION).dsc
+
+all: cargo-build
+
+.PHONY: cargo-build
+cargo-build:
+ $(CARGO) build $(CARGO_BUILD_ARGS)
+
+.PHONY: test
+test:
+ $(CARGO) test $(CARGO_BUILD_ARGS)
+
+.PHONY: check
+check: test
+
+$(BUILDDIR): src include debian Cargo.toml build.rs
+ rm -rf $(BUILDDIR) $(BUILDDIR).tmp
+ mkdir $(BUILDDIR).tmp
+ cp -a -t $(BUILDDIR).tmp $^ Makefile
+ mv $(BUILDDIR).tmp $(BUILDDIR)
+
+.PHONY: deb
+deb: $(DEB)
+$(DEB) $(DBG_DEB) &: $(BUILDDIR)
+ cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
+ lintian $(DEB)
+
+.PHONY: dsc
+dsc:
+ $(MAKE) clean
+ $(MAKE) $(DSC)
+ lintian $(DSC)
+
+$(DSC): $(BUILDDIR)
+ cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
+
+sbuild: $(DSC)
+ sbuild $(DSC)
+
+.PHONY: upload
+upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
+upload: $(DEB) $(DBG_DEB)
+ tar -cf - $(DEB) $(DBG_DEB) | ssh -X repoman@repo.proxmox.com upload --product pve --dist $(UPLOAD_DIST)
+
+.PHONY: dinstall
+dinstall:
+ $(MAKE) deb
+ sudo -k dpkg -i $(DEB)
+
+clean:
+ $(CARGO) clean
+ rm -rf ./$(BUILDDIR)
+ rm -f -- *.deb *.dsc *.tar.?z *.buildinfo *.build *.changes
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..310d2cd
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+proxmox-ebpf (0.1.0) trixie; urgency=medium
+
+ * initial packaging.
+
+ -- Proxmox Support Team <support@proxmox.com> Mon, 18 May 2026 11:00:00 +0200
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..680da4f
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,34 @@
+Source: proxmox-ebpf
+Section: admin
+Priority: optional
+Build-Depends: debhelper-compat (= 13),
+ clang,
+ llvm,
+ libbpf-dev,
+ linux-libc-dev,
+ cargo:native,
+ rustc:native,
+ libstd-rust-dev,
+ librust-anyhow-1+default-dev,
+ librust-aya-0.13+default-dev,
+ librust-log-0.4+default-dev,
+ librust-pico-args-0.5+default-dev,
+ librust-proxmox-log-1+default-dev,
+ librust-proxmox-ve-config-0.10+default-dev,
+ librust-nix-0.29+default-dev,
+ librust-nix-0.29+hostname-dev,
+ librust-nix-0.29+net-dev,
+ librust-serde-json-1+default-dev,
+Maintainer: Proxmox Support Team <support@proxmox.com>
+Standards-Version: 4.6.2
+Homepage: https://www.proxmox.com
+Rules-Requires-Root: no
+
+Package: proxmox-ebpf
+Architecture: any
+Depends: pve-cluster (>= 9.0.1),
+ libpve-network-perl,
+ ${shlibs:Depends},
+ ${misc:Depends},
+Description: eBPF-based microsegmentation agent for Proxmox VE
+ Filters traffic between guests by identity.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..01138fa
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,18 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+Files:
+ *
+Copyright: 2026 Proxmox Server Solutions GmbH <support@proxmox.com>
+License: AGPL-3.0-or-later
+ This program is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Affero General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option) any
+ later version.
+ .
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+ details.
+ .
+ You should have received a copy of the GNU Affero General Public License along
+ with this program. If not, see <https://www.gnu.org/licenses/>.
diff --git a/debian/proxmox-ebpf.install b/debian/proxmox-ebpf.install
new file mode 100644
index 0000000..7fbce7e
--- /dev/null
+++ b/debian/proxmox-ebpf.install
@@ -0,0 +1 @@
+target/x86_64-unknown-linux-gnu/release/proxmox-ebpf usr/libexec/proxmox
diff --git a/debian/proxmox-ebpf.postrm b/debian/proxmox-ebpf.postrm
new file mode 100755
index 0000000..2a7d9a5
--- /dev/null
+++ b/debian/proxmox-ebpf.postrm
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+ remove|purge)
+ rm -rf /sys/fs/bpf/proxmox-ebpf /sys/fs/bpf/proxmox-ebpf-test || true
+ rm -rf /run/proxmox-ebpf || true
+ ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/proxmox-ebpf.prerm b/debian/proxmox-ebpf.prerm
new file mode 100755
index 0000000..cce50f0
--- /dev/null
+++ b/debian/proxmox-ebpf.prerm
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+ remove)
+ if [ -x /usr/libexec/proxmox/proxmox-ebpf ]; then
+ /usr/libexec/proxmox/proxmox-ebpf clear || true
+ fi
+ ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/proxmox-ebpf.service b/debian/proxmox-ebpf.service
new file mode 100644
index 0000000..b78259e
--- /dev/null
+++ b/debian/proxmox-ebpf.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Proxmox VE eBPF microsegmentation boot reconcile
+Wants=pve-cluster.service network-online.target
+After=pve-cluster.service network-online.target pve-sdn-commit.service
+Before=pve-guests.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/libexec/proxmox/proxmox-ebpf apply
+RuntimeDirectory=proxmox-ebpf
+RuntimeDirectoryPreserve=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..db2a8c9
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,33 @@
+#!/usr/bin/make -f
+# See debhelper(7) (uncomment to enable)
+# output every command that modifies files on the build system.
+DH_VERBOSE = 1
+
+include /usr/share/dpkg/pkg-info.mk
+include /usr/share/rustc/architecture.mk
+
+export BUILD_MODE=release
+
+export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
+export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
+
+export CARGO=/usr/share/cargo/bin/cargo
+export CARGO_HOME = $(CURDIR)/debian/cargo_home
+
+export DEB_CARGO_CRATE=proxmox-ebpf_$(DEB_VERSION_UPSTREAM)
+export DEB_CARGO_PACKAGE=proxmox-ebpf
+
+%:
+ dh $@
+
+override_dh_auto_configure:
+ @perl -ne 'if (/^version\s*=\s*"(\d+(?:\.\d+)+)"/) { my $$v_cargo = $$1; my $$v_deb = "$(DEB_VERSION_UPSTREAM)"; \
+ die "ERROR: d/changelog <-> Cargo.toml version mismatch: $$v_cargo != $$v_deb\n" if $$v_cargo ne $$v_deb; exit(0); }' Cargo.toml
+ $(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system
+ dh_auto_configure
+
+override_dh_missing:
+ dh_missing --fail-missing
+
+override_dh_installsystemd:
+ dh_installsystemd proxmox-ebpf.service
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
--
2.47.3
^ permalink raw reply related [relevance 9%]
* [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs} 00/16] sdn: add microsegmentation support
@ 2026-06-09 13:25 12% Hannes Laimer
2026-06-09 13:25 9% ` [PATCH proxmox-ebpf 03/16] debian: add packaging and boot-time oneshot unit Hannes Laimer
` (2 more replies)
0 siblings, 3 replies; 26+ results
From: Hannes Laimer @ 2026-06-09 13:25 UTC (permalink / raw)
To: pve-devel
This adds support for microsegmentation using eBPF programs attached to
interfaces. Mostly the tap/veth interfaces on the guests directly.
# Overview
Each guest interface can be assigned a group, then, on these groups it is
possible to define policies/rules between these groups. A policy is a mapping
`(src,dst) -> allow`
Each interface can be assigned to only a *single* group. Groups however can be
part of groups, that should cover most use cases I came up with. In case multiple
policies would match (possibly because groups/sub-groups could have policies that overlap)
the most specific policy wins: the one that names the destination group closest in
the tree, and if two name it equally closely, the one that names the source closest, so:
- web (db,web)->allow
- wiki # from `web`: (db,web)->allow
* CT100,net0
- wol (db,wol)->deny # closer than the (db,web)->allow inherited from web, so deny wins
* CT101,net0 # => packets from db to CT101,net0 are denied
- db (web,db)->allow
* CT200,net1 # packets from `web` reaching CT200,net1 will be allowed
Because each group has a single parent, the destination-then-source ordering always
picks exactly one rule, so there is no tie to resolve (a malformed config with
duplicate rules falls back to deny).
If an interface has a group assigned, it needs an explicit (0,dst) rule to
accept un-tagged packets.
Enforcement happens on the receiving side, cause that's where we for sure know both
- where the packet is from
- and, its destination (us)
# config and API
The config is a single section-config, `sdn/microseg.cfg`, owned by Rust (the types
live in `proxmox-ve-config`, with a `PVE::RS::SDN::Microseg` binding) the same way the
fabric config is. It holds four object types, keyed by section id:
- group, a numeric `mark` (auto-assigned if omitted) and an optional `parent`
- rule, `(src,dst) -> allow`, an absent `src` matches un-tagged traffic
- assignment, binds a guest NIC (`vmid` plus `iface` index) to a group
- bridge, marks a bridge-facing interface as an SRv6 carrier (no UI yet)
The API exposes per-type endpoints under
`/cluster/sdn/microseg/{group,rule,assignment,bridge}`, guarded by SDN.Audit for reads
and SDN.Allocate for writes. Rule and assignment ids are derived from their contents
(`p{src_mark}-{dst_mark}`, `vm{vmid}i{iface}`), groups and bridges take a chosen id. On
commit the config is rendered into `.running-config`, which is what the agent reads.
# skb->mark
Every packet in the kernel lives in a `sk_buff` struct, this struct has a
32-bit field `mark`. This field can be written to and read while the packet
passes through the kernel. We don't do that currently in our SDN stack, so
currently we can't really overwrite stuff written by a different part of our
stack. But this is something to keep in mind in case we should end up using
this again in the future. For now microsegmentation only uses the lower 16 bits.
We use this to assign packets to groups, with these 16 bits we support up to
65535 distinct groups (mark 0 is reserved for unstamped traffic). This `mark`
however only lives as long as the packet does not leave the kernel, and given
the nature of networking, chances are it'll leave it eventually. To transport
this group identity between hosts we have to attach it to the actual network
packet that hits the wire. For this we currently support both
- VXLAN-GBP, the 16-bit GBP field on the VXLAN encapsulation
- and, SRv6, the 16-bit Tag field on the SRH
conveniently the kernel already handles putting the `mark` into the VXLAN-GBP
encapsulation, and also taking it out of there (found out way too late :P). For
SRv6 we need a small eBPF program that handles this.
# eBPF
Both tagging (setting `mark`) and enforcement happen in an eBPF program
directly attached to the guest's interface. The programs themselves read and
write to/from two maps:
- tap_to_group, so we know what to set `mark` to
- rules, map of (src,dst)->action, we know src from the `mark` and `dst` is
the group we are in
Specifically, on ingress we set the mark, and on egress we enforce.
# Implementation
We have an `agent` that reads the running sdn config, and applies that state to
the kernel. The binary doing this is stateless, it runs on SDN apply, tap_plug
of interfaces of guests and on boot after pve-sdn-commit but before guests
start. It keeps track of what is currently running loaded in the kernel with
two files under `/run/proxmox-ebpf`. One keeping track of the bpf program that
was compiled into the binary, and one for keeping track of changes to the
data structures the bpf program accesses. The distinction is useful cause for
only a program change we can swap the currently attached program with the
updated one atomically. In case the data structure (the maps) changed there is
no other way than to tear-down all the current state and repopulate the maps
and re-attach the programs. Swapping out the maps first would have old programs
interact with a new data schema, and swapping the programs first will lead
to new programs accessing an old data schema. Either way, not good, so we wipe
the state in that case and re-build it. So, in case we change the structure of
the data our bpf programs access, there will be a bunch of ms where the
configured segmentation is not enforced. But that is the only scenario where
that can happen.
## aya, aya-ebpf
Aya is a rust lib that helps with working with BPF more easily. It has both a
userspace part(`aya`) and a part(`aya-ebpf`) that compiles to bpf. I chose to
only use the userspace part, and use C for the BPF programs themselves. The reasons were:
- we don't have `aya-ebpf` packaged
- `aya-ebpf` *requires* nightly toolchain to compile
- the bpf programs are very small, in case this should change at some point we
can reconsider. Also, it doesn't matter what produces the .o file, so this
could be swapped in really easily if we decided to
So we compile the bpf program written in C to a .o targeting bpf using clang
and include it when compiling the agent binary.
## agent
The agent is not a long running daemon, the triggers mentioned before should cover
all situations where we'd have to touch the kernel state. When started, the
first thing it does is check both the program and schema version, so what it
was compiled with, and what the last invocation did to the kernel. If either
the program or the schema differs it either swaps out the program currently
loaded by the kernel and pins it. If the schema version differs it does that as
well, but additionally also tears down all state and rebuilds it.
The agent also populates the `rules` map, so it creates all the inherited rules
and resolves multiple matches to the closest one as described before.
## SRv6
This also adds support for SRv6 as a transport, we don't support that yet in
our SDN stack, but could be useful for basic routing between simple zones on
multiple nodes. A bit like EVPN-lite since it's only L3. I did most of my
testing with SRv6 as transport between kernels, before I found out the kernel
does it for VXLAN automatically. I didn't wire up any UI for it yet, but I
decided to include it in this RFC for now.
# enabling VXLAN-GBP
The kernel only moves the mark into the GBP field if the vxlan device was
created with the GBP flag set, and it's create-only: the kernel won't
toggle it on a running device. ifupdown2 had no attribute for this, so
this series includes a small ifupdown2 patch adding `vxlan-gbp`, which
threads the flag through to the netlink/iproute2 create path.
# testing
I have put pre-built packages on sani, these include ifupdown2 with the patch
# building
1. proxmox-ve-rs (install)
2. proxmox-ebpf
3. pve-cluster (install)
4. proxmox-perl-rs (install)
5. pve-network
6. pve-manager
# notes
I did not send the first commit for `proxmox-ebpf` since it contains a
`vmlinux.h` which is rather large but is needed for compiling. The commit is in
my staff repo.
# feedback wanted
- the general desgin, specifically with the agent being one-shot and triggered
rather than a running service
- I put the VXLAN-GBP flag into the zones that run on vxlan for now, so it has
to be enabled on the zone, and will affect all vxlan interfaces that are
part of it. The only real alternative is enabling it always, or trying to
infer if a nic is assigned a vnet that is in a zone that does vxlan and
corss-referencing that with potentially configured microseg
groups/assignments. This seemed brittle, and since the needed flag is
additionally create-only, a simple flag on the zone appeard to be the better
approach
- and the ui, very likely needs some polishing, and im very open to
alternative approaches
proxmox-ebpf:
Hannes Laimer (3):
agent: add userspace coordinator and stateless policy subsystem
bpf: add bridge subsystem
debian: add packaging and boot-time oneshot unit
Makefile | 66 +++++++
debian/changelog | 5 +
debian/control | 34 ++++
debian/copyright | 18 ++
debian/proxmox-ebpf.install | 1 +
debian/proxmox-ebpf.postrm | 11 ++
debian/proxmox-ebpf.prerm | 12 ++
debian/proxmox-ebpf.service | 15 ++
debian/rules | 33 ++++
debian/source/format | 1 +
include/mark.h | 30 +++
src/agent.rs | 105 ++++++++++
src/bridge/bpf/srv6.bpf.c | 76 +++++++
src/bridge/mod.rs | 75 +++++++
src/main.rs | 69 +++++++
src/policy/bpf/tap.bpf.c | 66 +++++++
src/policy/bpf/types.h | 23 +++
src/policy/mod.rs | 268 +++++++++++++++++++++++++
src/policy/types.rs | 45 +++++
src/running_config.rs | 38 ++++
src/state.rs | 303 ++++++++++++++++++++++++++++
src/subsystem.rs | 384 ++++++++++++++++++++++++++++++++++++
src/tc.rs | 152 ++++++++++++++
23 files changed, 1830 insertions(+)
create mode 100644 Makefile
create mode 100644 debian/changelog
create mode 100644 debian/control
create mode 100644 debian/copyright
create mode 100644 debian/proxmox-ebpf.install
create mode 100755 debian/proxmox-ebpf.postrm
create mode 100755 debian/proxmox-ebpf.prerm
create mode 100644 debian/proxmox-ebpf.service
create mode 100755 debian/rules
create mode 100644 debian/source/format
create mode 100644 include/mark.h
create mode 100644 src/agent.rs
create mode 100644 src/bridge/bpf/srv6.bpf.c
create mode 100644 src/bridge/mod.rs
create mode 100644 src/main.rs
create mode 100644 src/policy/bpf/tap.bpf.c
create mode 100644 src/policy/bpf/types.h
create mode 100644 src/policy/mod.rs
create mode 100644 src/policy/types.rs
create mode 100644 src/running_config.rs
create mode 100644 src/state.rs
create mode 100644 src/subsystem.rs
create mode 100644 src/tc.rs
proxmox-ve-rs:
Hannes Laimer (1):
ve-config: sdn: add microseg config types
proxmox-ve-config/src/sdn/config.rs | 9 +-
proxmox-ve-config/src/sdn/microseg.rs | 847 ++++++++++++++++++++++++++
proxmox-ve-config/src/sdn/mod.rs | 1 +
3 files changed, 856 insertions(+), 1 deletion(-)
create mode 100644 proxmox-ve-config/src/sdn/microseg.rs
proxmox-perl-rs:
Hannes Laimer (1):
sdn: add microseg config binding
pve-rs/Makefile | 1 +
pve-rs/src/bindings/sdn/microseg.rs | 172 ++++++++++++++++++++++++++++
pve-rs/src/bindings/sdn/mod.rs | 1 +
3 files changed, 174 insertions(+)
create mode 100644 pve-rs/src/bindings/sdn/microseg.rs
pve-cluster:
Hannes Laimer (1):
cfs: add 'sdn/microseg.cfg' to observed files
src/PVE/Cluster.pm | 1 +
1 file changed, 1 insertion(+)
pve-network:
Hannes Laimer (4):
sdn: microseg: add config and API
sdn: zones: trigger microseg apply on tap_plug
sdn: zones: add vxlan-gbp option to vxlan and evpn zones
evpn: disable vxlan-learning on create if GBP is enabled
src/PVE/API2/Network/SDN.pm | 12 +
src/PVE/API2/Network/SDN/Makefile | 2 +
src/PVE/API2/Network/SDN/Microseg.pm | 126 +++++++
.../API2/Network/SDN/Microseg/Assignment.pm | 163 +++++++++
src/PVE/API2/Network/SDN/Microseg/Bridge.pm | 171 ++++++++++
src/PVE/API2/Network/SDN/Microseg/Group.pm | 171 ++++++++++
src/PVE/API2/Network/SDN/Microseg/Makefile | 8 +
src/PVE/API2/Network/SDN/Microseg/Rule.pm | 163 +++++++++
src/PVE/Network/SDN.pm | 5 +
src/PVE/Network/SDN/Makefile | 1 +
src/PVE/Network/SDN/Microseg.pm | 316 ++++++++++++++++++
src/PVE/Network/SDN/Zones.pm | 6 +
src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 11 +
src/PVE/Network/SDN/Zones/VxlanPlugin.pm | 9 +
14 files changed, 1164 insertions(+)
create mode 100644 src/PVE/API2/Network/SDN/Microseg.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Assignment.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Bridge.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Group.pm
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Makefile
create mode 100644 src/PVE/API2/Network/SDN/Microseg/Rule.pm
create mode 100644 src/PVE/Network/SDN/Microseg.pm
pve-manager:
Hannes Laimer (3):
ui: sdn: add microsegmentation
network: apply microseg state on reload
ui: sdn: zones: add vxlan-gbp checkbox to vxlan and evpn
PVE/API2/Network.pm | 4 +
www/manager6/Makefile | 9 +
www/manager6/Utils.js | 23 +
www/manager6/dc/Config.js | 8 +
www/manager6/form/MicrosegGroupSelector.js | 64 +++
www/manager6/form/MicrosegGuestNicSelector.js | 107 +++++
www/manager6/form/MicrosegGuestSelector.js | 83 ++++
www/manager6/sdn/MicrosegView.js | 408 ++++++++++++++++++
www/manager6/sdn/microseg/AssignmentEdit.js | 63 +++
www/manager6/sdn/microseg/Base.js | 88 ++++
www/manager6/sdn/microseg/GroupEdit.js | 61 +++
www/manager6/sdn/microseg/PolicyView.js | 221 ++++++++++
www/manager6/sdn/microseg/RuleEdit.js | 49 +++
www/manager6/sdn/zones/EvpnEdit.js | 8 +
www/manager6/sdn/zones/VxlanEdit.js | 11 +
15 files changed, 1207 insertions(+)
create mode 100644 www/manager6/form/MicrosegGroupSelector.js
create mode 100644 www/manager6/form/MicrosegGuestNicSelector.js
create mode 100644 www/manager6/form/MicrosegGuestSelector.js
create mode 100644 www/manager6/sdn/MicrosegView.js
create mode 100644 www/manager6/sdn/microseg/AssignmentEdit.js
create mode 100644 www/manager6/sdn/microseg/Base.js
create mode 100644 www/manager6/sdn/microseg/GroupEdit.js
create mode 100644 www/manager6/sdn/microseg/PolicyView.js
create mode 100644 www/manager6/sdn/microseg/RuleEdit.js
pve-docs:
Hannes Laimer (2):
sdn: add microsegmentation section
sdn: add VXLAN-GBP flag to evpn/vxlan zone sections
pvesdn.adoc | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+)
ifupdown2:
Hannes Laimer (1):
d/patches: add support for VXLAN-GBP flag
...addons-vxlan-add-vxlan-gbp-attribute.patch | 228 ++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 229 insertions(+)
create mode 100644 debian/patches/pve/0016-addons-vxlan-add-vxlan-gbp-attribute.patch
Summary over all repositories:
62 files changed, 5548 insertions(+), 1 deletions(-)
--
Generated by murpp 0.11.0
^ permalink raw reply [relevance 12%]
Results 1-26 of 26 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2026-06-09 13:25 12% [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs} 00/16] sdn: add microsegmentation support Hannes Laimer
2026-06-09 13:25 9% ` [PATCH proxmox-ebpf 03/16] debian: add packaging and boot-time oneshot unit Hannes Laimer
2026-06-18 13:10 9% ` [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs} 00/16] sdn: add microsegmentation support Lukas Sichert
2026-07-09 9:20 8% ` superseded: " Hannes Laimer
2026-07-09 9:18 10% SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] " Hannes Laimer
2026-07-09 9:18 9% ` [PATCH proxmox-ebpf v2 08/27] debian: add packaging and boot-time oneshot unit Hannes Laimer
2026-07-09 9:18 12% ` [PATCH pve-docs v2 26/27] sdn: add microsegmentation section Hannes Laimer
2026-08-12 10:33 10% ` SPAM: [RFC cluster/docs/ifupdown2/manager/network/proxmox{-ve-rs,-ebpf,-perl-rs} v2 00/27] sdn: add microsegmentation support Lukas Sichert
2026-08-17 11:17 10% ` Lukas Sichert
2026-08-17 14:50 8% ` Lukas Sichert
2026-10-27 8:57 8% ` superseded: " Hannes Laimer
2026-08-31 7:11 [RFC] VMware/NSX to Proxmox migration: policy transformation and staged network handoff LIONNETON Vincent
2026-09-02 11:29 8% ` Stefan Hanreich
2026-09-03 12:31 9% ` LIONNETON Vincent
2026-09-22 10:09 11% [PATCH access-control/cluster/docs/manager/network/proxmox{-ve-rs,-firewall,-perl-rs} v3 00/38] sdn: add microsegmentation support Hannes Laimer
2026-09-22 10:13 8% ` Hannes Laimer
2026-10-27 8:54 10% [PATCH access-control/cluster/container/docs/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs}/qemu-server v3 00/45] " Hannes Laimer
2026-10-27 8:54 10% ` [PATCH proxmox-ve-rs v3 13/45] microseg: add a crate that applies the policy to a node's guest NICs Hannes Laimer
2026-10-27 8:55 19% ` [PATCH pve-network v3 24/45] sdn: microseg: enforce the policy on " Hannes Laimer
2026-10-27 8:55 23% ` [PATCH pve-network v3 25/45] sdn: microseg: add tag matcher Hannes Laimer
2026-10-27 8:55 14% ` [PATCH pve-docs v3 45/45] sdn: add microsegmentation section Hannes Laimer
2026-11-05 11:14 8% ` superseded: [PATCH access-control/cluster/container/docs/manager/network/proxmox{-ebpf,-ve-rs,-perl-rs}/qemu-server v3 00/45] sdn: add microsegmentation support Hannes Laimer
2026-11-05 11:12 9% [PATCH access-control/cluster/container/docs/manager/network/proxmox{,-ve-rs,-perl-rs}/qemu-server v4 " Hannes Laimer
2026-11-05 11:12 10% ` [PATCH proxmox-ve-rs v4 13/45] microseg: add a crate that applies the policy to a node's guest NICs Hannes Laimer
2026-11-05 11:13 22% ` [PATCH pve-network v4 24/45] sdn: microseg: enforce the policy on " Hannes Laimer
2026-11-05 11:13 23% ` [PATCH pve-network v4 25/45] sdn: microseg: add tag matcher Hannes Laimer
2026-11-05 11:13 14% ` [PATCH pve-docs v4 45/45] sdn: add microsegmentation section Hannes Laimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox