How to save iptables command

I ran a iptable command and it worked. But when I rebooted the router it went away. Can someone list all steps how to save this command?

You should put the iptables commands in /etc/firewall.user. It's executed during boot and firewall restarts.

https://openwrt.org/docs/guide-user/firewall/firewall_configuration

2 Likes

Can I do this using gui?

Yes, /etc/firewall.user can be edited on the page Firewall - Custom Rules.

How can I write these two commands in firewall.user ?

ip route delete default via 192.168.100.240 dev eth0.2
ip route add default via 192.168.100.240 dev br-lan

It is not firewall command, it is route command.

1 Like