How-to
Edge firewall routing, filtering and directional interfaces
Short answer
Routing, publishing and protection are separate layers on an edge firewall: IP Forward plus a Masquerade rule moves traffic for the machine subnet, one DNAT rule publishes exactly one inside service, and a unidirectional internet interface with drop-all-except-established refuses inbound MQTT or OPC UA while outbound VPN and time sync keep working. A working route never publishes a service, and a filter rule never replaces the routing configuration.
On this page
Routing, publishing and protection are three separate layers on an edge gateway's firewall, and each one is configured in its own place. On the ctrlX OS Firewall app's Basic view they sit in the tabs Filter, Routing and Directional interfaces; other gateway firewalls split them differently, but the layers themselves do not change. To route a machine subnet, activate IP Forward on the involved interfaces and add one Masquerade rule with that subnet as destination — 192.168.2.0/24 in the worked example below. To publish, add a DNAT rule, because a working route alone never exposes an inside service. To protect the uplink, set the internet-facing interface unidirectional with Reject (or drop) all except established connection, so inbound MQTT or OPC UA sessions are refused while the gateway's own outbound VPN and time sync keep running. A filter rule never replaces the routing configuration; it trims traffic after routing has already moved it.
Three layers, three failure modes #
Name the layer before you change a setting, because each fails in its own way. Routing decides whether a packet crosses the device at all: with IP Forward inactive on an involved interface, nothing crosses, and no filter rule changes that. Publishing decides whether an outsider reaches a specific service behind the device: without a DNAT rule, nothing inside is reachable, no matter how well the route works. Direction sets a boundary policy on one physical port: a unidirectional uplink refuses every session the outside starts.
Filtering is the fine trim on top: allow or deny one port or service, written for the chain the packet actually travels — Forward for traffic crossing between two of your networks, Input for traffic addressed to the gateway itself, Output for traffic the gateway originates. A rule in the wrong chain leaves the intended flow untouched, which is the most common reason an allow or a deny appears to do nothing. The exact option names below follow the Firewall app's Basic view on ctrlX OS; another vendor's gateway names the same controls differently, but the layers and their order do not change.
The order of work #
Work in this sequence; each step assumes the ones before it.
- Map the cabinet first: which physical port faces the machine network, which the company network, which the internet. In the documentation's suggested layout, XF10 carries the machine network, XF50 the company network and XF51 the internet — treat that as an example, not as your cabling.
- Confirm the Basic tabs exist. If
RoutingorDirectional interfacesis missing, check the app version and license first; the versions and license numbers are in the FAQ below. - Activate
IP Forwardon every involved interface underSettings > Network. - Add the Masquerade routing rule for the machine subnet under
Settings > Firewall, on theRoutingtab. - Add a DNAT rule only for each service an outside client genuinely needs to reach.
- Set the internet-facing port unidirectional, with
Prevent user interface lockoutactive while you work. - Add filter rules only where a specific allow or deny is required, then test outbound, inbound and the published port, in that order.
Route the machine subnet with IP Forward and Masquerade #
The example machine network is 192.168.2.0/24: mask 255.255.255.0, usable host addresses 192.168.2.1 through 192.168.2.254, broadcast 192.168.2.255, 254 hosts in total. Activate IP Forward on both involved interfaces — the machine-side port and the uplink — under Settings > Network; while forwarding is off, the routing rules have nothing to forward. Then open Settings > Firewall, Routing tab, use Add routing rule, and set Destination to 192.168.2.0/24 with NAT Type Masquerade. Write your real subnet into the destination, not the example's.
Masquerade performs source address translation for forwarded traffic. Take a PLC at 192.168.2.40, an example address inside that subnet, sending MQTT to a cloud broker: the packet leaves the uplink carrying the gateway's own address, the broker replies to the gateway, and the return packet matches the established entry and goes back to the PLC. The broker never needs to know the machine subnet exists.
A routing rule cannot repair a wrong interface address or a host whose default gateway points elsewhere, so confirm addressing and gateway settings on both sides before blaming the firewall. Where the gateway itself terminates a tunnel into the machine LAN instead of translating addresses outward, how a VPN gateway on a controller routes you to the machine LAN covers that pattern from the controller side.
Publish exactly one service with DNAT #
A working route moves traffic out; it never lets an outside client in. When a service on a device behind the gateway must be reachable through the gateway itself, add a Destination NAT rule on the same Routing tab. The documentation's example rule, named DnatXM, maps port 8234 on the gateway to port 80 at 192.168.2.25, so a browser pointed at the gateway's address on port 8234 lands on that device's web interface. Adapt the inside address and both ports to your service, and decide deliberately which outside networks may reach the translated destination: the rule publishes to every network that can address the gateway unless a directional or filter rule narrows it.
The decision: one DNAT port per service that truly needs to be reachable, nothing more. Before you enable a rule that lets outsiders touch a machine device, confirm that path is approved under your plant's remote-access policy; the product side of such a setup, router and firewall and VPN in one unit, is covered in a firewall VPN for an industrial remote access router.
Make the internet-facing interface unidirectional #
On the Directional interfaces tab, use Add interface rule to put a boundary policy on one physical port. Select the port your internet cable actually enters and select Reject (or drop) all except established connection. From then on the gateway can start and keep connections outward — internet access, VPN tunnels, external servers, remote directory mounts — while any session an outsider starts toward that port, MQTT and OPC UA included, is refused.
Do not copy an interface name from the manual: its suggested layout puts the internet on XF51, yet its unidirectional example selects XF50, so the two examples do not describe the same cabinet. Read your own cabling, decide which port forms the boundary, and apply the policy there.
Keep Prevent user interface lockout selected on the port you configure from, for setup and commissioning; it keeps the web UI reachable through that port. Clear it once the configuration is finished and you have confirmed access from the management side, so the running policy matches the design.
Add filter rules only where they earn their place #
The Filter tab writes simple allow or deny rules per port or service, as Forward, Input or Output. Choose the chain by where the packet is when it reaches the device: crossing between two of your networks takes Forward, arriving at the gateway itself takes Input, leaving the gateway takes Output. In practice two cases justify rules here: allowing one management port on the input side of the company interface, or denying a specific service on the forward path that interface direction does not already refuse. Everything else the unidirectional uplink refuses on its own.
When traffic will not cross, filters are the last place to look: check IP Forward first, then the routing rule's destination and NAT type, then any DNAT mapping, then the directional-interface rule, and only then the filter chains.
Decisions per case #
Test in the order you built. From a machine host, fetch an outside service and watch the reply return — that proves forwarding and Masquerade together. From a company PC, open the gateway's address on the published DNAT port and confirm the inside device's page appears. From outside, start a session toward the gateway on any port and confirm it fails while the gateway's own outbound sessions still run.
| Case | Configuration | Result |
|---|---|---|
| Machine hosts need outbound only: cloud MQTT, NTP, VPN | IP Forward on involved ports, one Masquerade rule, unidirectional uplink |
Outbound works; every inbound session refused |
| One inside service must be reachable from outside | The above plus exactly one DNAT port | Only the published port answers, all else refused |
| An external client must start MQTT or OPC UA into the machine network | Not available while the uplink is unidirectional | Start the session from the plant side, for example an edge broker machine devices publish to, or change the policy deliberately after approval |
| Traffic stops crossing between networks | IP Forward first, then routing destination and NAT type, then endpoint addressing |
Routing repaired before any filter is touched |
Configured in this order the layers cannot work against each other: routing moves the packets, one DNAT port publishes exactly what you chose, the unidirectional uplink refuses everything you did not publish, and filter rules only trim the result. If a remote agent still fails to come online after this, troubleshooting a PLC agent that will not go online remotely walks the gateway-side causes. Change any one layer later and re-run the three tests before you trust the path again.
Questions asked
Why does the firewall app not show the Routing and Directional interfaces tabs?
The Basic view exists from firewall app version 3.6.2 and above, shipped with release RM25.07. License R911430062 unlocks the Basic view only, and license R911400505 includes both Basic and Advanced. The Advanced entry at the upper right opens the older interface, which keeps working in parallel with the new tabs. If the tabs are missing, check the app version and the installed license before recreating those rules anywhere else.
Outbound traffic works but an outside client cannot reach the machine network. Which layer is at fault?
That is the publishing or boundary layer, not routing. Check first whether a DNAT rule exists for that service, because a route alone never publishes anything. If the rule exists, check the directional-interface rule on the uplink: a unidirectional setting refuses every session the outside starts, on any port, including ports a filter rule allows. A filter rule cannot override interface direction, so narrow or relax that policy deliberately instead.
Will a remote access VPN or a PLC agent still connect through a unidirectional interface?
Yes, when the gateway or a machine device starts the session itself. The policy refuses what an outsider initiates, while connections the plant side establishes match as established and keep running, including VPN tunnels, NTP lookups and outbound MQTT publishing. Only sessions started from the outside, such as an external MQTT or OPC UA client reaching toward the machine network, are refused.
Can more than one interface be set unidirectional?
Any physical interface can carry the one-way policy, and the setting belongs on whichever port your internet uplink physically enters, verified against the cabling rather than copied from an example. When segmentation needs more ports than the device has, the fix is a device with more interfaces, not two networks sharing one port.