Keep alive

Maintain a persistent 3G connection Prevent your modem link from dropping with Sakis3g's keep-alive features.

Connection persistence

Sakis3g includes keep-alive functionality designed to help maintain an active 3G modem connection over extended periods. This is especially useful on headless devices such as Raspberry Pi and BeagleBone Black, where an unattended drop can disrupt remote access or data collection.

The keep-alive mechanism monitors the connection state and can attempt to restore the link if it goes down, reducing the need for manual intervention.

Note: The ppp package must be installed on your Linux system before using Sakis3g. Install it with sudo apt-get install ppp if you haven't already.

When using Sakis3g to maintain a stable internet connection through a 3G modem on Linux, the keep-alive feature plays a vital role in preventing unexpected disconnections. Mobile networks often drop idle connections after a period of inactivity, which can interrupt critical tasks on devices like the Raspberry Pi or BeagleBone Black. Sakis3g includes built-in mechanisms to periodically send small data packets through the established PPP link, tricking the network into believing the connection remains actively in use. This approach helps ensure that long-running downloads, remote monitoring sessions, or server processes continue without interruption. Users can configure the interval at which these keep-alive signals are transmitted, balancing network responsiveness with data usage.

The underlying technology behind Sakis3g's keep-alive functionality relies on the PPP daemon and its ability to maintain a persistent link layer connection. When the script detects that the modem connection has been established successfully, it monitors the interface for activity and can automatically re-establish the link if it drops. This is particularly valuable in environments where network reliability is inconsistent, such as rural areas or locations with weak cellular coverage. The script also works alongside tools like UMTSkeeper to provide additional connection monitoring and automatic reconnection capabilities. By combining these components, users can achieve a degree of reliability that approaches wired connections, even when using cellular hardware that was not originally designed for always-on operation.

Configuration of keep-alive parameters in Sakis3g is handled through the interactive setup process or by editing the script's configuration variables directly. Users can specify the frequency of keep-alive pings, the target host to ping, and the timeout period before considering a connection dead. These settings allow the script to adapt to different network conditions and data plans, as some mobile carriers may interpret frequent pings as abuse while others require them to maintain the session. The script also supports logging of connection status, which helps administrators diagnose recurring disconnection issues. By fine-tuning these parameters, users can find the optimal balance between connection stability and data conservation, making Sakis3g suitable for both lightweight IoT deployments and more demanding remote access scenarios.

Troubleshooting keep-alive issues often begins with verifying that the required dependencies are properly installed on the system. The ppp package must be present, as Sakis3g relies on it to establish and maintain the point-to-point protocol connection with the modem. Additionally, users should ensure that the modem is correctly identified by the system and that the appropriate USB mode switching has occurred if the device initially presents itself as a CD-ROM. Checking system logs can reveal whether the keep-alive packets are being sent and whether the network is responding appropriately. In some cases, adjusting the APN settings or trying a different keep-alive method can resolve persistent disconnection problems. Community forums and documentation provide further guidance for specific modem models and carrier configurations.

Typical use cases

  • Remote monitoring setups that rely on a continuous 3G data link
  • IoT and embedded projects running on single-board computers
  • Long-running scripts or services that need the modem to stay connected

Related tool: UMTSkeeper

For users who need more advanced connection watchdog capabilities, a companion tool called UMTSkeeper is available. It works alongside Sakis3g to monitor and automatically reconnect 3G/UMTS links. You can find it at mintakaconciencia.net/squares/umtskeeper.

A graphite pencil sketch of a small single-board computer with a USB modem attached, set against a soft grey background with subtle cross-hatched shading.

Return to the home page for an overview of all Sakis3g features.