I have 2 WAN connections. One ISP seems to block incoming port 80, which I use for tunneling SSH session to port 22 on openwrt metarouter. I can connect to port 80 through 2nd WAN connection. Default route for outgoing traffic is 1st WAN connection (route 0.0.0.0/0 to WAN1).
However, when I ssh in on 2nd WAN interface I can see the connection going to the metarouter, but that default route sends the response out on 1st WAN interface. If I add route to the remote IP to ensure use of WAN2 then it works just fine.
Can’t rely on that static route though as I might connect from somewhere else externally and might get it right to come through on WAN1. I would like to ensure that a connection coming in on either WAN gets the response going out on the same WAN interface.
Could someone help with the mangle rules for this? I have tried these found in the wiki:
If the connection is going to a metarouter it won’t be in input and output as it - strictly speaking - isn’t terminated on the router, that is RouterOS itself. It will be in the forward chain. Instead of the rules you have, use something like
Thank you! I’ll give that a try. Yes, the use of input/output chains is wrong in my scenario. I’ll change the rules to the forward chain.
I need to find out from my ISP what incoming ports they allow, otherwise I’ll have to keep buying 2 DSL accounts. Gotta love this country’s DSL offerings.
I’ve done in pre-routing and it works fine. Thanks for the help.
I’ve done passthru=false on 2nd half of the rules and placed them all at the top of the mangle rules. Just need to make sure nothing lower down gets affected by these. Then again, since the connection mark is done on the inbound connection and carried through it should not affect my other rules which are all outbound connection orientated anyway.