[Switch] NAT+Route gets ignored and packets get forwarded to bridge trunk instead

2026-10-06 21:59:19 by RouterOS 7.24.5

software id = 2Z3G-DFG5

model = RB4011iGS+5HacQ2HnD

/interface bridge
add name=bridge
add name=bridge2
/interface list
add comment=defconf name=LAN
/interface bridge port
add bridge=bridge hw=no interface=ether1
add bridge=bridge interface=ether2
add bridge=bridge interface=ether3
add bridge=bridge interface=ether4
add bridge=bridge interface=ether6
add bridge=bridge interface=ether7
add bridge=bridge hw=no interface=ether8
add bridge=bridge interface=ether9
add bridge=bridge interface=ether10
add bridge=bridge interface=sfp-sfpplus1
add bridge=bridge2 hw=no interface=ether5
/interface bridge settings
set use-ip-firewall=yes
/ipv6 settings
set disable-ipv6=yes forward=no
/ip address
add address=192.168.128.6/24 interface=bridge network=192.168.128.0
add address=192.168.100.100/24 comment="Test semi-wan local" interface=bridge2 network=192.168.100.0
/ip firewall nat
add action=masquerade chain=srcnat dst-address=192.168.100.1 log=yes log-prefix=NAT_SEMIWAN to-addresses=192.168.100.100
/ip route
add disabled=no distance=100 dst-address=0.0.0.0/0 gateway=192.168.128.1 routing-table=main scope=30 target-scope=10

I have a switch, and one port on it has different subnet. So disconnected it from bridge, added src-nat, and a route. But when I looked up sniffer, the ping from eth8 192.168.128.10 gets forwarded to eth1 instead of eth5...

And NAT rule is hit when I start ping command. But packet still gets forwarded to eth1.

Tried to disable hardware offloading for these interfaces eth1 eth8 eth5 but no difference.

Firewall rules disabled.

What am I not seeing ?

Two bridges?
One bridge with only one port? (So, why 2nd bridge? Use directly ether5 on config... for example)

First tried directly yes, that also did not work. This makes no difference.

Also easier to change bridge port (add or remove) if needed than changing pinned eth interface in multiple places; if reconfiguring needed for example.

That is the obvious thing that stands out.

As for the rest, two LANs managed by the same router (feel free to call it a WAN if you like) are directly reachable via forwarding,
without any need for NAT whatsoever...

What’s missing is: What do you want to achieve?

If you don't explain that,
it’s just a waste of time trying to correct or interpret something that you might not even need,
or that might turn out to be irrelevant once the right solution is found.

I need 192.168.100.1 external device to see/think/communicate with 192.168.100.100 explicitly. Otherwise external device will refuse connection (not related to this issue). Hence why src-nat used, and that's why router address is 192.168.100.100/24 on bridge2. There is no gateway in bridge2.

If the gateway on ether8 peripheral device is 192.168.128.1,
why would it send the packet to 192.168.128.6 instead?
His not the gateway, and the ether8 device do not know anything about 192.168.100.x

Internally, it doesn't know where it is, so it is normal for it to send the packet to the Gateway's MAC address rather than the RouterBOARD's...

Basically, you have to disable any kind of hardware acceleration and route everything through the CPU
(even packets that don't concern the RouterBOARD) in order to "see" the packets.
But is it worth it?

Real gateway is on 192.168.128.1@eth1 (not directly). But gateway in this case is not needed as internet not needed for this. All IPs are static.

192.168.128.1@eth1 directly

192.168.128.10@eth8 directly

192.168.100.1@eth5 directly.

192.168.128.10 does not ping into 192.168.100.1 (regardless if NAT is used).

I have disabled hardware-offloading on all ports, but still same issue.

In bridge/settings "use ip firewall"

No difference

Ok so the solution was to add:
/ip route
add disabled=no distance=1 dst-address=192.168.100.0/24 gateway=192.168.128.6
routing-table=main scope=30 target-scope=10

to main gateway-router.

Packets was operating at L2 and ignored L3, so first they need to go to gateway where L3 is done, which send packet back and then it can be forwarded (as L3).


Now would be interesting how could I skip this sending back and forth. and do L3 directly on original router/switch ?

Probably need to force L2 dst-mac to 192.168.128.6 router's mac when dst-ip is 192.168.100.1;

Ok found how to do that as well on 192.168.128.6 router (also kept original configuration as in original post):

/interface bridge nat
add action=redirect chain=dstnat dst-address=192.168.100.0/24 mac-protocol=ip

Now changes on 192.168.128.1 is not required (if devices directly connected to 192.168.128.6), but nice to have.