--- title: "Dual Connection Check with Ping and Triggering an Action - icom OS Routers" slug: "dual-connection-check-with-ping-and-triggering-an-action-en" updated: 2026-09-01T14:49:57Z published: 2026-09-01T14:49:57Z canonical: "docs.insys-icom.com/dual-connection-check-with-ping-and-triggering-an-action-en" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.insys-icom.com/llms.txt > Use this file to discover all available pages before exploring further. # Dual Connection Check with Ping and Triggering an Action - icom OS Routers ASCII configuration files can be designed flexibly and with dependencies by using the Lua scripting language within them. ## Situation A connection check is to be performed for a WAN chain. This is possible with on-board means in the *Network* → *WAN/Internet* menu of the router. In this case, a ping to **two** different IP addresses is to be carried out to check the availability of at least one of the addresses. If none of the addresses can be pinged, the modem shall be reset. ## Solution This special application will be realised using a Lua script. Refer to the [Lua 5.3 Reference Manual](https://www.lua.org/manual/5.3/) for more information about Lua. ### Preparation of the Lua script We’ve prepared the following Lua script for the described purpose. Copy and paste it to your text editor or download it using the link below. Don’t forget to change the ping IP addresses to the addresses you need to ping. Lua script ```lua -----LUA----- -- variable definition: PING_ADDRESS1 = "10.10.0.1" -- replace this with your first IP address PING_ADDRESS2 = "10.11.0.1" -- replace this with your second IP address TRY = 3 -- this defines that an unsuccessful check will be repeated 3 times -- aux flag SUCCESS = 0 -- this flag is used to differentiate success (1) and no success (0) -- ping check for LOOP = 1 , TRY do a, b, c = pcall(cli, "help.debug.tool=ping -c 1 " .. PING_ADDRESS1) -- lua script that pings to address 1 and returns information to the variables a, b and c if c == 0 then -- means that the ping to address 1 was successful SUCCESS = 1 -- sets the success flag to 1 cli_log("LUA ping - " .. LOOP .. ". check to target " .. PING_ADDRESS1 .. " successful") -- outputs the success message in the log -- device is online, exit lua and the script return -- exits the loop else -- continues the script in case of no success a, b, c = pcall(cli, "help.debug.tool=ping -c 1 " .. PING_ADDRESS2) -- lua script that pings to address 2 and returns information to the variables a, b and c print ("LOOP: " .. LOOP .. " - b:" .. b .. " c:" ..c) -- outputs the parameter in the cli if c == 0 then -- means that the ping to address 2 was successful SUCCESS = 1 -- sets the success flag to 1 cli_log("LUA ping - " .. LOOP .. ". check to target " .. PING_ADDRESS2 .. " successful") -- outputs the success message in the log -- device is online, exit lua and the script return -- exits the loop else -- continues the script in case of no success at the end of the final number of loops cli_log("LUA ping - " .. LOOP .. ". check, both failed") -- outputs the no success message in the log end end end if SUCCESS == 0 then -- means that no ping was successful, the following commands will be executed cli_log("LUA ping - restarting modem") -- outputs this information in the log cli("help.debug.modem_state.name=lte2") -- defines the modem to be restarted cli("help.debug.modem_state.state_change=turn_off") -- defines that the modem is to be turned off cli("help.debug.modem_state.submit") -- submits above command to the router end -----LUA----- exit ``` [Lua script download (right-click and save as)](https://docs.insys-icom.de/assets/configs/cg_m3_lua_connection_check_script.txt) An ASCII configuration file can be used to add additional configurations to an already existing profile. We’ve prepared the following ASCII configuration file that will add a timer and an event to your profile as well as an IP filter rule that permits the ping requests. The event will execute the Lua script every time the timer expires. Copy and paste it to your text editor or download it using the link below. You may change the timer interval (and file name in case you changed it) to suit your requirements. > [!WARNING] > Please note! > > If timers are already configured in the profile, the correct name of the added timer must be entered in the subsequent line “events.event_config.event[last].event_timer_name”. ASCII configuration file ```plaintext events.timer.timer.add events.timer.timer[last].active=1 events.timer.timer[last].description=Timer for dual ping check with Lua events.timer.timer[last].type=interval events.timer.timer[last].interval_hh=00 events.timer.timer[last].interval_mm=10 events.event_config.event.add events.event_config.event[last].active=1 events.event_config.event[last].description=Dual ping check with Lua events.event_config.event[last].event_type=ev_timer #NOTE: Enter the correct value in following line, according to the name of the previous created timer. events.event_config.event[last].event_timer_name=timer1 events.event_config.event[last].event_action_type=act_ascii events.event_config.event[last].event_action_ascii=CG_m3_lua_connection_check_script.txt netfilter.ip_filter.rule.add netfilter.ip_filter.rule[last].rule_active=1 netfilter.ip_filter.rule[last].rule_desription=Ping queries sent by the router netfilter.ip_filter.rule[last].rule_direction=output netfilter.ip_filter.rule[last].rule_protocol=icmp netfilter.ip_filter.rule[last].rule_output_if=all netfilter.ip_filter.rule[last].rule_ipversion=all administration.profiles.activate ``` [ASCII configuration file download (right-click and save as)](https://docs.insys-icom.de/assets/configs/cg_m3_lua_connection_check_script.txt) ### Router configuration It is prerequisite that you have access to the web interface of the router, an LTE modem is inserted in slot 2 and the router has been commissioned using the Startup Wizard. > [!NOTE] > Please note! > > The device can only be accessed via the first Ethernet socket in default settings. This avoids to bridge several networks accidentally on an already configured router when resetting to default settings. 1. Open the user interface of the router: [https://insys.icom](https://insys.icom) 2. Click in the *Administration* → *Profile* menu in the *ASCII configuration* section on , select the Lua script just downloaded and click on SUBMIT. 3. Click on , select the ASCII configuration file just downloaded and click on SUBMIT. 4. In order to apply an ASCII configuration file, click in the row of the configuration file (not the Lua script), then on *Apply ASCII configuration* and on APPLY ASCII CONFIGURATION. This will add the timer and the event as well as the IP filter rule that permits Ping requests to your profile. ### Result testing 1. Change to the ![view dashboard outline](https://docs.insys-icom.de/assets/icons/view-dashboard-outline.png) *Status* → *Log view* menu to watch the results of this configuration in the log. 2. Check the following logs: - *Modem* - *Network* - *CLI* - *Events* ## Troubleshooting - The status of the WAN chain and their interfaces is displayed in the ![view dashboard outline](https://docs.insys-icom.de/assets/icons/view-dashboard-outline.png) *Status* → *Dashboard* menu. If an interface does not achieve the **online** condition, its condition can also be examined on this page. - If no network traffic is achieved, the tools integrated in the router can be used for debugging. - Network devices connected to the router cannot use the Internet connection. The reason can be that they have not entered the router as gateway and DNS server. - The IP filters can be deactivated for testing purposes. The router itself is also subject to the IP filters. If the router itself has to send packets, an OUTPUT rule is necessary for this. If the router itself has to receive packets, an INPUT rule is necessary for this. In order to be able to route IP packets, a FORWARD rule is necessary. Standard IP address: https://192.168.1.1; login depending on configuration; default for earlier firmware versions: *User name*: **insys**, *Password*: **icom** Applying an ASCII configuration file means that the opened profile will be amended or modified by the configurations contained. The opened profile will not be activated by this unless it contains the command `administration.profiles.activate`.