How to make connections answer from the same gateway they entered in RouterOS?

Solution 1:

You will need to mark the connections coming from ether3_3G so that you can then mark the replies to be routed back via ether3_3G.

Here's an example configuration (not tested)

/ip firewall mangle
add action=mark-connection chain=prerouting comment="Mark connection so packets from 3G get returned to 3G properly" disabled=no in-interface=ether3_3G new-connection-mark=3g-packets passthrough=no
add action=mark-routing chain=prerouting connection-mark=3g-packets disabled=no new-routing-mark=3g-packets passthrough=no
add action=mark-routing chain=output connection-mark=3g-packets disabled=no new-routing-mark=3g-packets passthrough=no


/ip route
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.3.1 routing-mark=3g-packets

The first rule will place a connection-mark on any packet arriving from ether3_3G interface.

The second and third rule will 'catch' the replies back based on that connection mark and then place a routing-mark on those connections.

The second rule is for packets that are essentially forwarded and the third rule is for replies that the router itself will send (e.g. pings)

Finally the static route at the end will route the packets with the appropriate routing-mark via the ether3_3G interface.