Hello
I have an interesting situation.
I am using Router OS 6.49.13 (long term)
In my network temporarily I need have two separate WAN connections. Firewall Filter rules are set using interface lists, IP lists…
Until now I had only one existing internet connection WAN1 with his public IP address and this is still default gateway (route do destination 0.0.0.0)
I want to switch several public services to secondary WAN2 connection with different public IP address. This services uses DST-NAT and UPD/TCP ports.
DST-NAT rules are also set using interface lists so it is valid and should be functioning for both WAN connections.
Each WAN connection has it’s own interface.
When I trying to connect to these services using WAN2’s IP address, it does not work. I have tracked packets by packet sniffer and found that outgoing packets have the correct source address for WAN2 but are sent from the interface for WAN1 which is out of scope. How is this possible? Even if source address is for WAN2?
I have used routing mark to communicate several LAN systems using WAN2, it works correctly. Also I have set mark connections on output chain which has WAN2 source IP and destination to the WAN and it seems that this marking is not applied to DST-NAT response packets and therefore packets is still sent to WAN1 interface even though this packets has WAN2 source IP.
This is confusing for me. I understand that as default gateway in main routing table is WAN1 and therefore all packets to the world should go through WAN1 interface but using this route it should also use WAN1 IP address as source address in packets, not this confusing combination. Could someone explain this behavior? I think it is because DST-NAT input is from WAN2, mikrotik tries to response using WAN2 using correct IP address for WAN2 but by default route it is forced to WAN1 and that’s why it’s getting crazy.
Then I think the solution should be using packet marking using prerouting chain, but I am not sure how the filter rules is applied. In filter rules is not set routing mark and my question is if the filter rules will be valid also for marked packets or it is needed to set standalone set of filter rules for this routing mark? I tested it and it seems that filter rules without routing mark parameter set is applied on each packet but I need to be sure. Because this behavior is not valid for routes and I was unable to find some description to this.
Hello
I have an interesting situation.
I am using Router OS 6.49.13 (latest long term)
In my network temporarily I need have two separate WAN connections. Firewall Filter rules are set using interface lists, IP lists…
Until now I had only one existing internet connection WAN1 with his public IP address and this is still default gateway (route do destination 0.0.0.0)
I want to switch several public services to secondary WAN2 connection with different public IP address. This services uses DST-NAT and UPD/TCP ports.
DST-NAT rules are also set using interface lists so it is valid and should be functioning for both WAN connections.
Each WAN connection has it’s own interface.
When I trying to connect to these services using WAN2’s IP address, it does not work. I have tracked packets by packet sniffer and found that outgoing packets have the correct source address for WAN2 but are sent from the interface for WAN1 which is out of scope. How is this possible? Even if source address is for WAN2?
I have used routing mark to communicate several LAN systems using WAN2, it works correctly. Also I have set mark connections on output chain which has WAN2 source IP and destination to the WAN and it seems that this marking is not applied to DST-NAT response packets and therefore packets is still sent to WAN1 interface even though this packets has WAN2 source IP.
This is confusing for me. I understand that as default gateway in main routing table is WAN1 and therefore all packets to the world should go through WAN1 interface but using this route it should also use WAN1 IP address as source address in packets, not this confusing combination. Could someone explain this behavior? I think it is because DST-NAT input is from WAN2, mikrotik tries to response using WAN2 using correct IP address for WAN2 but by default route it is forced to WAN1 and that’s why it’s getting crazy.
Therefore I think the solution should be using packet marking using prerouting chain and then use separate default route, but I am not sure how the filter rules is applied. In filter rules is not set routing mark and my question is if the filter rules will be valid also for marked packets or it is needed to set standalone set of filter rules for this routing mark? I tested it and it seems that filter rules without routing mark parameter set is applied on each packet but I need to be sure. Because this behavior is not valid for routes. I was unable to find some description to this.
So I’m trying to point out that the routing mark parameter works differently for firewall rules and differently for routes. For routes, an unset routing mark parameter behaves the same as if it were set to main, so it always only applies to main, but this (probably) does not apply to filter rules.