internet_connection_watchdog

This is an old revision of the document!


Internet connectino Watchdog

this is about creating a raspberry pi based appliance that monitors your internet conenction and if it goes down, automatically debugs it and restarts stuff like modem / router etc. as necessary. the device should also be reachable via an on-demand gsm link that can be initated by sms to login to the device and debug the link manually

so far, this is just a collection of snippets of information and links, i'll write it up into a nice article one day, but not today ;)

apt update && apt install wvdial gammu gammu-smsd picocom 
  • Software: Gammu
  • Hardware: TP-Link MA260
  • on the tp-link stick the last serial device seems to be the one that can be used for sms (gammu identify only gets information from that device).
    gammu-detect | grep -B1 TP-LINK | grep ttyUSB | tail -n 1

    to get the device name for the config

  • installation:
    apt install gammu gammu-smsd
  • process-sms.sh
    #!/bin/bash
    for i in `seq $SMS_MESSAGES` ; do
        $numvar="SMS_${i}_NUMBER"
        $textvar="SMS_${i}_TEXT";
        echo "${!numvar}:${!textvar}" >> /tmp/messages
        if [ "${!textvar}" == "connect ]; then
          echo "connect!" >> /tmp/messages
        fi
    done
  • Hardware: See above
  • Software: wvdial
  • config: /etc/wvdial.conf
    [Dialer Defaults]
    Init1 = ATZ
    Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    Init3 = AT+CGDCONT=1,"IP","internet"
    Modem Type = Analog Modem
    Baud = 9600
    New PPPD = yes
    Modem = /dev/ttyUSB5
    ISDN = 0
    Phone = *99#
    Password = { }
    Username = { }
  • via dual prolific basead usb to serial converter, one link goes to the relay card, the other to the serial terminal of the pfsense router.
  • usb link is extended down to the basement via cat7 link, I simply cut a usb extension cord into two and attached RJ45 plugs to both ends with identical pin layout. works like a charm :)
  • software: picocom
  • internet_connection_watchdog.1529264518.txt.gz
  • Last modified: 17.06.2018 21:41
  • by Pascal Suter