RE: Packet misrouted
Joel Low <[email protected]> Mon, 17 Nov 2025 12:49:45 +0000
| Newsgroups | gmane.comp.security.firewalls.netfilter.general |
|---|---|
| Message-ID | <TYSPR01MB675613CCDC313B78014A55B3C8C9A@TYSPR01MB6756.apcprd01.prod.exchangelabs.com> |
Hello Ethy, > -----Original Message----- > From: Ethy H. Brito <[email protected]> > Sent: Friday, 14 November 2025 11:04 pm > To: [email protected] > Subject: Packet misrouted > > I see the SYN hitting the equipment coming from outside after being SNAT'ed > and DNAT'ed, I see the equipment replying with SYN+ACK. > I also see the packet being un-NAT'ed at the router. > BUT the packet is directed to the wrong output interface and I can't find why. I have been using OpenWrt for a while, and there we have mwan3 which is a package for performing policy-based routing. The reason why this doesn't work is because the return flow does not remember which interface the original flow is from. mwan3 solves this by assigning indexes to each external interface, marking the original flow with an appropriate conntrack mark for the given external interface, and then using that mark to influence the routing table used (so conntrack mark -> routing rule). This should allow the return flow to egress from the correct interface. If you're not using OpenWrt, then source code is available at [1] and you may be able to adapt it for your needs. Regards, Joel [1]: https://github.com/openwrt/packages/tree/master/net/mwan3