Both ISPs are PPPoE clients and have UPnP enabled, but since this is a load balancing setup, sometimes traffic is routed to ISP1, but UPnP opens up for ISP 2 and vice versa.
Set it to schedule every minute. Works as expected with a small problem.
The script removes any existing “clones” and recreates same clones every minute. This affects online gaming/VoIP as the ports keep getting removed then replicated every minute for a second or two.
If I remove the “#if the vars above are not same, first all old clones are cleaned /ip firewall nat remove [/ip fi nat find comment=“UPnP_Cloned”];” then everytime it runs, it will keep on cloning already cloned UPnP dynamic rules. I already have a separate cleanup script that runs once in 24 hours so I don’t need this cleanup.
Basically, what I think is best is to make the script exit when it finds existing dynamic NAT rules are already cloned instead of cleaning/re-cloning. How would I go about doing this?
Even if we could accomplish what I need, the script runs every 1 minute (I think it’s crazy to set it to run every 1 second) which is a problem for gaming/VoIP inside games.
Is there any proper solution for UPnP with load balancing setup?
Clone WAN1 dynamic rules to WAN2 and also clone WAN2 to WAN1 because that’s the original problem with UPnP anyway
Of course, while avoiding cloning already existing clones on either WAN interfaces.
I think yes
The original article said:
Make the simplest UPnP config for just WAN1
Did you do that? Or do you need to enable upnp for both interfaces?
One thing I’m concerned about is flash write cycles. Since it looks like cloned rules aka NAT rules are stored on the flash. What do you think?
I think there is reason for concern, but if the script does not re-create the rules, it will minimize the load on the flash memory as much as possible.
Yeah, ignore the “WAN1” only idea. That won’t play nice with failover, I enabled UPnP for both WAN interfaces. MikroTik support told me enabling UPnP for multiple external interfaces is fine. Just that it works well only in failover, not load balancing.
Regarding Flash memory, in the long run, running this script every minute isn’t the wisest thing I think?
Regarding Flash memory, in the long run, running this script every minute isn’t the wisest thing I think?
I will write an update for the script and we will test it. I hope that changes from UPNP will not be frequent and, accordingly, the load on the flash memory will be small, and it will be the normal, to run this script even often than 1 time at minute.
All right, post the script when it’s ready and I’ll test it.
Also, I think we need to make use of global variables to fetch the IP address of each interface in my case PPPoE clients since one is dynamic IP for use.