Check connectivity and switch on/off a LED (GL-AR150)

Written by pmd - - no comments

Shell script that will check if there is connectivity to a defined website every 60 seconds and switch ON/OFF the led :

  • /usr/bin/WANLED :
#!/bin/sh
while [ true ]; do
        /usr/bin/wget -q --tries=2 --spider http://google.com
        if [ $? -eq 0 ]; then
                #echo "Connected ! LED RED OFF. LED GREEN ON."
                echo "none" >  /sys/class/leds/gl-ar150:orange:wlan/trigger
                echo "default-on" >  /sys/class/leds/gl-ar150:green:wan/trigger
        else
                #echo "Not connected ! LED RED ON. LED GREEN OFF."
                echo "default-on" >  /sys/class/leds/gl-ar150:orange:wlan/trigger
                echo "none" >  /sys/class/leds/gl-ar150:green:wan/trigger
        fi
        sleep 60
done

 

Schell script to autostart the above script :

  • /etc/init.d/WANLED :
#!/bin/sh /etc/rc.common

START=99
STOP=1

start(){
        /usr/bin/WANLED &
}

stop(){
        killall -9 WANLED
}

Now let's make these script executable and started at startup:

# chmod +x /usr/bin/WANLED
# chmod +x /etc/init.d/WANLED
# /etc/init.d/WANLED enable
# /etc/init.d/WANLED start

Now the orange LED should be ON when there is no connectivity to Google.

FYI OpenWRT in use was : OpenWrt 19.07.2, r10947-65030d81f3

Source: LED, Start script at startup, LED on when Internet is available

Extra applications on LEDE (GL-AR150)

Written by pmd - - no comments

Transmission

  1. opkg update
  2. opkg install transmission-daemon-openssl transmission-web luci-app-transmission
  3. opkg install nano
  4. nano /etc/config/transmission
  5. chmod -R 777 /tmp/USB_KEY

It is necessary to make a swap file on AR150 otherwise you cannot access the web interface...

  1. cd /path/where/we/will/make/swap-file
  2. Create a 64MB swap-file:
    dd if=/dev/zero of=swap-file bs=1M count=64
  3. mkswap swap-file
  4. swapon swap-file
  5. Then go to LuCI to specify the swap file in System > Mount points to have it mounted at next router reboot.

For worldwide access add a rule in LEDE firewall:
Any tcp, udp
From any host in wan
To any router IP at port 9091 on this device

Source

Bandwidth Monitor (nlbw)

opkg install luci-app-nlbwmon

Aussi :

https://github.com/Kiougar/luci-wrtbwmon

LEDE/OpenWRT on GL-AR150

Written by pmd - - no comments

How to upgrade GL-AR150 to Stock OpenWRT

  1. Connect to router using SSH
  2. # cd /tmp
  3. Check what is the last available release for GL-AR150 here.
  4. # wget http://downloads.lede-project.org/releases/17.01.4/targets/ar71xx/generic/lede-17.01.4-ar71xx-generic-gl-ar150-squashfs-sysupgrade.bin
  5. # sysupgrade lede-17.01.4-ar71xx-generic-gl-ar150-squashfs-sysupgrade.bin

Source

I installed this version: LEDE Reboot (17.01.4, r3560-79f57e422d).

How to upgrade all packets

opkg list-upgradable | cut -f 1 -d ' ' | xargs opkg upgrade

Sources 1, 2

Enabling remote SSH access on LEDE/OpenWRT

Configure Dropbear

  1. Go to the System / Administration page.
  2. Under “SSH Access”, for the default “Dropbear instance”, set “Interface” to “unspecified”.

This will cause dropbear to accept connections on all interfaces.

Open port 22 (or other)

  1. Go to the Network / Firewall / Traffic Rules.
  2. Scroll down to the “Open ports on router” section.
  3. Enter a name for this rule, e.g. “Allow-SSH-WAN”.
  4. Set “Protocol” to “TCP”.
  5. Enter “22” as the “External Port”.
  6. Click “Add”.
  7. Click “Save and Apply”.

Source

Using USB storage devices and FAT32&NTFS filesystems

  1. Connect to router using SSH
  2. # opkg update
  3. # opkg install kmod-usb-storage
  4. # opkg install usbutils
  5. # lsusb -t
    /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
       |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 480M
  6. To add support of FAT32 and NTFS (not tested yet) usb flash/disk drives:
    # opkg install kmod-fs-vfat ntfs-3g
  7. Then go to the LuCI administration page, System > Mount points, and configure :

Sources 1, 2, 3, 4, 5

Using the Huawei E3372 Hi-Link LTE Dongle with OpenWRT

Huawei E3372 and AR-150 have 192.168.8.1/24 IPv4 networks, change the LAN IP of AR-150.

  1. # opkg update && opkg install kmod-usb-net-rndis usb-modeswitch
    Of course, an internet connection is needed through Ethernet or Wifi for this step. :(
  2. Then go to the LuCI administration page, Network > Interfaces > Add new interface...:
  3. In my case interface "eth2" is now available to configure:
  4. In tab Firewall Settings, add this new interface in the wan firewall-zone:
  5. Click on Connect of the new network 4G_LTE:
  6. Done, you even have access to the USB dongle administration page 192.168.8.1.

Source Nouvelle source (2020-02)

DDNS

  1. # opkg install luci-app-ddns
  2. Go to LuCI administration interface > Services > Dynamic DNS.
  3. I used a Free DNS provider named freedns.afraid.org.

Source

Samba network share

  1. # opkg install luci-app-samba
  2. Go to LuCI administration interface > Services > Network Shares.
  3. Add shared directories:
    • Name: samba
    • Path: /Path/to/mounted/usb/key
    • Allowed user: empty
    • Create mask: 777
    • Directory mask: 777

Source

SFTP server

  1. # opkg update && opkg install openssh-sftp-server
  2. Use Filezilla or other to connect to sftp server.

Source

Rss feed of the category