Connection Tracking State in Firewall Rules
How to use the Connection Tracking State field on VergeOS firewall rules to block new inbound connections without dropping return traffic for outbound connections.
Overview
VergeOS firewall rules are stateful. The Connection Tracking State field on a network rule matches only the selected conntrack states. Its most common use is to make a Drop rule block new inbound connections without also dropping the return traffic of connections that the protected host starts itself.
Prerequisites
Familiarity with VergeOS network rules.
A user with permission to edit network rules.
The Connection Tracking State Field
The field is available in the network rule's edit form. Leave it blank to match any state.
Allowed values: new, established, related, untracked.
new
The first packet of a connection — an unsolicited connection attempt.
established
Packets that belong to a connection already seen in both directions.
related
A new connection that conntrack ties to an existing one (for example, FTP data channels and ICMP errors).
untracked
Packets explicitly excluded from connection tracking.
The field accepts multiple states separated by commas (established,related) and negation with a leading != (!= new).
The Problem: A Drop Rule That Breaks Outbound Traffic
A single public IP is often used both for inbound services and as the outbound SNAT address for a tenant or VM behind it. A blanket Drop rule on that destination IP blocks unsolicited inbound traffic as intended — but it also drops the replies to the tenant's own outbound traffic, because those replies arrive at the same public IP in state established.
The symptom: the tenant cannot reach the internet, and removing the deny rule fixes it.
Removing the drop lets the established replies through, but it also re-opens unsolicited inbound access — exactly what the rule was created to block. Do not remove the rule; scope it.
The Fix: Scope the Drop to New Connections
From the network's dashboard, click Rules on the left menu.
Select the Drop rule and click Edit on the left menu.
In the Connection Tracking State field, enter
new.Click Submit.
Click Apply Rules on the left menu to put the change into effect.
The drop now matches only new, unsolicited inbound connections. Return traffic for outbound connections is in state established, no longer matches the drop, and falls through to the chain's trailing ct state established,related accept.
Why No Return-Path Accept Rule Is Needed
VergeOS generates each network's input and forwarding chains with a drop policy and a trailing ct state established,related accept as the last line. nftables evaluates rules top-down, and drop and accept are terminal: an un-scoped drop placed above that trailing accept catches return traffic before it reaches the accept. Scoping the drop to new lets established and related traffic pass down to the trailing accept — you do not add an accept rule of your own.
Mental model: Block
newto lock out unsolicited inbound. Letestablishedandrelatedflow so anything the protected host started can finish.
Worth Knowing
Rule order matters. The trailing
established,related acceptis the last line of the generated chain; a blanket drop above it with no state set swallows return traffic.The same scoping applies to any rule, not just drops. For example, scope an inbound Accept to
newto control which side can start connections.The
relatedstate matters for protocols with helper-tracked secondary flows (FTP, some VoIP, ICMP errors); the trailing system accept covers these.
Additional Resources
Last updated
Was this helpful?