Masquerade behind each uplink#
You will end up with a source NAT rule for every uplink, so traffic leaving by any of them is translated to that uplink's address. An uplink without one carries traffic that leaves with a private source address and never comes back.
Before you start#
- The operator role and a licence.
- At least one uplink. The Uplinks tab shows which rule is behind each one, and offers to write a missing one.
Step 1 — Look at what you have#
Network → High availability → Uplinks. The table shows, per uplink, which source NAT rule masquerades behind it. An uplink with none is the thing to fix.
show nat source rulesStep 2 — Add the missing rule#
The Uplinks page offers a one-click masquerade rule for an uplink that has none, using the next free rule number.
set nat source rule 110 outbound-interface name eth2
set nat source rule 110 translation address masquerade
set nat source rule 110 description 'Wheelhouse: masquerade behind eth2'masquerade means "use whatever address this interface currently has", which is what a
DHCP or PPPoE uplink needs. A static uplink can use a literal instead if you want the
translation pinned:
set nat source rule 110 translation address 198.51.100.7Why one per uplink#
Because the rule matches on the outbound interface. A rule naming eth1 does nothing
for traffic leaving by eth2, and there is no wildcard that means "whichever uplink won".
The symptom of a missing rule is specific and confusing: everything works until a failover,
and then nothing does — because traffic is now leaving by an uplink whose packets have a
private source address.
That is also why the add-uplink wizard offers a masquerade rule as part of adding an uplink, ticked by default.
Step 3 — Narrow it, if you need to#
The default rule translates everything leaving by that interface. To translate only one source network:
set nat source rule 110 source address 192.0.2.0/24Rule numbers matter: rules are evaluated in order and the first match wins, so a narrow rule needs a lower number than the broad one it should take priority over.
The load balancer writes its own#
load-balancing wan writes masquerade rules for its members unless disable-source-nat is
set. If you are running the balancer and your own per-uplink rules, turn its NAT off:
set load-balancing wan disable-source-natTwo writers of masquerade rules is a configuration that works until the day the two disagree. Share load across two uplinks.
Check it worked#
From a client, through each uplink in turn. Use a policy route to pin a test host to one uplink, or fail the primary, then:
curl -s https://ifconfig.coThe answer should be that uplink's public address, not a private one and not a timeout.
On the router, the per-rule counters tell you which rule is doing the work:
show nat source statisticsThe NAT page shows the same counters joined onto the rules. A rule with a flat counter after a failover is the one that did not match.
Undoing it#
delete nat source rule 110The uplink's Stop using as uplink action on the Uplinks page stages the removal of the addressing, the failover entry and the balancer membership; the NAT rule is deleted from the NAT page.
See also#
- A second uplink with health-checked failover
- Share load across two uplinks
- Publish a service — the inbound half of the same problem
- Source NAT
Checked against ui/src/pages/Wan.tsx ·
agent/wan.go ·
docs/multi-wan.md ·
ui/src/pages/Nat.tsx