Run custom firewall rules when 4G modem reboots

I have a set of firewalls (iptables and IP route) rules that I want to execute every time the 4G modem connects. I put the rules in custom script however it doesn't work.
The router has two 4G modem interface and I want to load balance traffic on the interfaces.

Welcom Javad,

First things first:

  • We cant guess what you have for hardware/OpenWrt version/or script without your input.
  • You'll have to provide the details necessary for the members to assist
  • Start by running ssh into your OpenWrt device and execute the following command and then copy/paste it into a preformatted text box.

ubus call system board

Once the community sees your version, someone may be interested in seeing more information on your script, network, firewall, route, installed packages, etc...

1 Like

Hi Bill, Thanks a lot.
The output of the above command:

        "kernel": "5.4.147",
        "hostname": "",
        "system": "ARMv7 Processor rev 5 (v7l)",
        "model": "RUTX STM32",
        "board_name": "teltonika,rutx",
        "release": {
                "distribution": "OpenWrt",
                "version": "21.02.0",
                "revision": "r16279-5cc0535800",
                "target": "ipq40xx/generic",
                "description": "OpenWrt 21.02.0 r16279-5cc0535800"
1 Like

Interesting indeed.

OpenWrt toh lists this a snapshot target recent commit and the OEM page shows it has a custom OpenWrt OS named RutOS.

Will you confirm the links above?
Can you confirm you're on snapshot or otherwise?

OK: It's a RUTX12

The RUTX12 Wiki (OEM)

Yes, However it is a RUTX12 model.

Use mwan3 for the load balancing and it also supports custom scripts when one uplink is connected.

1 Like