Custom iptables rules does not remain


In passthrough mode on a RUT241, I am modifying the default SNAT rules (so the device connected to the LAN port can present a different source IP than the one carried by the LTE access…but can still communicate with the RMS).

Below are the commands I put in rc.local and firewall.user (I am flushing and recreating the postrouting_rules) :

iptables -t nat -F postrouting_rule
iptables -t nat -A postrouting_rule -s <WAN_ADDRESS_LOCAL> -o wwan0 -j SNAT --to-source <WAN_ADDRESS_REMOTE>
iptables -t nat -A postrouting_rule -s <LAN_ADDRESS> -o wwan0 -j SNAT --to-source <WAN_ADDRESS_REMOTE>
iptables -t nat -A postrouting_rule -o wwan0 -m comment --comment “Bridge mode” -j ACCEPT

But randomly after a certain amount of time, default SNAT rule is coming back.

Is there an another “cleaner” way to do that so the parameter remains?


The router should still be able to reach RMS when it is configured in Passthrough mode. Also, is it absolutely necessary for you to use passthrough mode? Wouldn’t configuring it in NAT mode be a simpler option?

Regarding the iptable rules, by deleting the default ones, they may regenerate after some time. Can you try inserting your rules (iptables -t nat -I ) instead of flushing and then appending? This way, the default rules will persist, but your custom rules will take precedence as the first in the list and therefore be matched first.

Kind Regards,

This topic was automatically closed after 15 days. New replies are no longer allowed.