Tuesday, September 11, 2018

OpenWRT / Rooter Notes

Quiet dnsmasq-dhcp in syslog:

Network -> DHCP and DNS -> Advanced Settings tab -> Suppress Logging
adds quiet-dhcp to dnsmasq.conf

Fix 'External Internet IP Address' 'Not Available' on Overview:

The current script uses a website to get the modem's IP address but is using http instead of https in the URL. A browser will auto redirect but the Lua script will not. We need to change the URL and disable wget's SSL certificate validation. Also, wget in the Lua script runs /bin/wget (no SSL support) whereas the command line runs /usr/bin/wget (symlink to wget-ssl, which supports SSL).

Open the script file to edit:
#> nano /usr/lib/lua/luci/controller/admin/modem.lua

Towards the bottom of the file, change this line:
os.execute("rm -f /tmp/ipip; wget -O /tmp/ipip http://ipecho.net/plain > /dev/null 2>&1")

to this:

 os.execute("rm -f /tmp/ipip; wget-ssl --no-check-certificate -O /tmp/ipip https://ipecho.net/plain > /dev/null 2>&1")

Save (ctrl+O) then exit (ctrl+X)

Clear Luci's UI cache to refresh the script:

 #> rm -r /tmp/luci-modulecache

Set MTU on modem (GUI setting doesn't persist properly)

new script file: /etc/hotplug.d/iface/05-set-mtu


#1484 is the largest that worked with 173.127.*.* subnet
# However, 1428 is a common mtu for LTE connections 
#  and is what Windows uses. Experiment.

if [ "$ACTION" = ifup -a "$DEVICE" = "wwan0" ]; then
        logger -t hotplug.d-set-mtu "Setting $DEVICE MTU to $mtu"
        ifconfig "$DEVICE" mtu "$mtu"


Hide router/host name in header

Improves mobile display and functionality

header > .container > .brand > font {
    display: none;

(prelim) Send Pushover notification on network change

https://pushover.net  to get token and user id (TTTTT & UUUUU below)

wget info: https://www.reddit.com/r/pushover/comments/1ezepb/howto_using_wget_instead_of_curl_to_send_pushover/

directory /etc/hotplug.d/iface

nano 98-pushover
if [ "$ACTION" = ifup -a "$DEVICE" = "wwan0" ]; then
        ip=`ifconfig | grep -A 1 'wwan0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1`
        logger -t hotplug.d-pushover-notification "Sending notification"
        wget-ssl -q --no-check-certificate --post-data="token=TTTTT&user=UUUUU&title=Rooter&message=WAN is up with $ip" https://api.pushover.net/1/messages.json

98-pushover copied from script 20-firewall

No comments:

Post a Comment